From be553fa3cfc4723fa67cf03bfd1eb096235a9c35 Mon Sep 17 00:00:00 2001 From: dotCooCoo Date: Fri, 16 Oct 2026 05:19:09 -0700 Subject: [PATCH] Window: the SVG Interactivity panel attaches JavaScript events and files for SVG export MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Window › SVG Interactivity was a disabled menu item. VectorCraft could not attach JavaScript to an object's events or link JavaScript files for SVG export. The SVG Interactivity panel lists 19 events, from onfocusin to onscroll. Pick one, type its JavaScript and press Enter to add it to the selected objects; the list shows their events. Remove Selected Entry removes the picked event, and the panel menu's Clear Events removes all of them. Link JavaScript Files… opens the JavaScript Files dialog, which adds a path or URL to the document's list and removes the selected one. Its Choose… button puts a picked file in as a file:/// URL. The commands are svgInteractivity.info, setEvent, removeEvent, clearEvents, addFile and removeFile, and ui.javascriptFilesDialog. Each edit is one undo step. A document links at most 64 files. SVG export writes each event as an event attribute on the object's element and each file as a + + "#); + let (doc, warnings) = import_with(&text, &ImportOptions { folder: Some("/tmp"), read: Some(&read) }).unwrap(); + let asked = asked.lock().unwrap().clone(); + assert!(asked.iter().any(|p| p.contains("photo.png")) && !asked.iter().any(|p| p.contains("evil")), "read {asked:?}"); + assert_eq!(doc.svg_scripts, ["evil.js"], "each link once, the inline script left out"); + assert!(warnings.iter().any(|w| w.contains("inline scripts were left out")), "{warnings:?}"); + assert_eq!(events(&doc, "shape"), [pair("onclick", "fetch('https://example.com')")]); + assert_eq!(doc.title, "Untitled-1", "the inline script didn't run"); +} +/// Import keeps the first 64 different `