mirror of
https://github.com/storytold/vectorcraft.git
synced 2026-11-13 17:32:42 -06:00
Plug-ins: Open With runs an importer off the UI thread, and Cancel stops it
File › Open With reads a picked file on the thread File › Open uses, with the importer and its parameters, so a slow importer does not freeze the window. A call that names path still gets document.open's result. Cancel in the progress window now raises a cancel token on that thread, which stops a running importer between two slices of its budget.
This commit is contained in:
+4
-2
@@ -6099,8 +6099,10 @@ as `svg`. The importer is given at most 128 MiB of the file; its objects become
|
||||
their bounds, Save then asks for a name, and `warnings` holds the importer's warnings. `plugin.run` of an importer is
|
||||
an error that names `document.open`. In the app, File › Open With lists the installed importers, and
|
||||
`file.openWith {importer, path?, params?}` opens `path`, or a file picked among the importer's extensions, with one (on
|
||||
the web it opens File › Open's picker) and adds it to Open Recent; an importer with parameters, given no `params`,
|
||||
first asks for them in the `pluginImport` dialog. `params` holds the importer's parameters (their defaults when
|
||||
the web it opens File › Open's picker) and adds it to Open Recent. With `path` the reply is `document.open`'s result;
|
||||
on the desktop a picked file is read off the UI thread and the reply is `{background: true, status}`, and
|
||||
`file.cancelOpen` stops the importer. An importer with parameters, given no `params`, first asks for them in the
|
||||
`pluginImport` dialog. `params` holds the importer's parameters (their defaults when
|
||||
omitted). A failing plug-in returns an error and leaves the document as it was (an export writes
|
||||
no file, and an import opens no document). A filter whose manifest asks for a heavy budget (minutes rather than a minute, `budget: "heavy"` in its
|
||||
`plugin.inspect {path | dataBase64}` entry) installs only with `allowHeavy: true`: ask the user first. `plugin.run`
|
||||
|
||||
+3
-1
@@ -65,7 +65,9 @@ extensions that a built-in format reads, and those File › Open installs, impor
|
||||
`.kys`, `.jsx`, presets, libraries and swatch or graphic style libraries such as `.ase`). File › Open does not give
|
||||
those files to the importer, and Open With does. **File › Open With** lists the
|
||||
installed importers by name (`file.openWith {"importer", "path"?, "params"?}`), and each opens a file picked among its
|
||||
extensions with that importer (on the web, File › Open's picker opens instead) and adds it to Open Recent. An importer
|
||||
extensions with that importer (on the web, File › Open's picker opens instead) and adds it to Open Recent. On the
|
||||
desktop the importer runs off the UI thread, and a run that takes a while shows a progress window with Cancel, which
|
||||
stops it. An importer
|
||||
with parameters, given no `params`, asks for them in a dialog of the same kind once the file is picked, and its Open
|
||||
button opens the file; File › Open runs an importer with its parameters' defaults. **File › Open** of a `.wasm` file installs
|
||||
a plug-in too (on the web this is how plug-ins get in). A heavy filter asks before it is installed, and runs in the
|
||||
|
||||
Reference in New Issue
Block a user