mirror of
https://github.com/storytold/vectorcraft.git
synced 2026-11-25 22:39:07 +00:00
Plug-ins: calls need doc.read, and an edit in progress is kept before a calling run
A command's result describes the document, so a plug-in without doc.read gets -6 for every call, whether or not the id names a command. A run that calls commands commits an edit still in progress first and prepares its input again when that changed the document or the selection.
This commit is contained in:
+3
-3
@@ -6937,9 +6937,9 @@ each of them as `{"id": …}` or exactly as given, otherwise `plugin.run` return
|
||||
field, and the document and undo history are unchanged. A filter at plug-in API level 2 whose manifest lists the
|
||||
`commands` permission and a `commandAllowlist` (both in its `plugin.list` entry) runs the commands that list names
|
||||
while it runs, through `vc_call`: the calls and its output are one undo step, and a run that fails or makes a call that
|
||||
fails leaves the documents, selections and history as they were. A command that reads or writes files, uses the
|
||||
clipboard, changes preferences or the view, runs a script, an action or a plug-in, switches documents or undoes is
|
||||
never called; `plugin.install` refuses a manifest that lists one, and `plugin.inspect` lists such ids as
|
||||
fails leaves the documents, selections and history as they were. Without `doc.read` every call fails. A command that
|
||||
reads or writes files, uses the clipboard, changes preferences or the view, runs a script, an action or a plug-in,
|
||||
switches documents or undoes is never called; `plugin.install` refuses a manifest that lists one, and `plugin.inspect` lists such ids as
|
||||
`refusedCommands` and ids no command has as `unknownCommands` (`plugin.install` lists those too). A live-effect plug-in is an effect with
|
||||
id `plugin.<id>`: `effect.apply`, `effect.setParams` and `effect.expandAppearance` work as for built-in effects, and
|
||||
`effect.list` lists it. One whose manifest declares `paintOutput` (at plug-in API level 2; `plugin.list` gives `api`
|
||||
|
||||
+9
-5
@@ -414,16 +414,20 @@ call commands on.
|
||||
traps, runs out of budget or is cancelled leaves every document, its selection and its history as they were.
|
||||
- Each call runs on the document the run is for, with its params checked as any request's are, and sees what the calls
|
||||
before it changed: a `select.all` followed by `object.move` moves everything. The filter's own input is the one it
|
||||
was given when the run started.
|
||||
was given when the run started; an edit still in progress (typing, or a shape being drawn) is kept as its own undo
|
||||
step before that input is made.
|
||||
- A plug-in never calls a command that reads or writes a file or folder, uses the clipboard, changes preferences or
|
||||
the view, runs a script, an action or a plug-in (a `plugin.*` command, or arguments naming one, such as an
|
||||
`effect.apply` of `plugin.<id>`), opens, closes or switches documents, or undoes or redoes, whatever its manifest
|
||||
lists. The same goes for a command that changes a tool's options, keeps a drag's state or adds font names for the
|
||||
whole app, and for a command VectorCraft adds later until it has been checked for plug-in calls. Installing a manifest that lists such a command is refused, and the error names it; `plugin.inspect` lists
|
||||
them as `refusedCommands`.
|
||||
whole app, and for a command VectorCraft adds later until it has been checked for plug-in calls. Installing a
|
||||
manifest that lists such a command is refused, and the error names it; `plugin.inspect` lists them as
|
||||
`refusedCommands`.
|
||||
- An id in `commandAllowlist` that no command has installs, so a plug-in can list a command a later version adds;
|
||||
`plugin.install` and `plugin.inspect` list such ids as `unknownCommands`, and calling one returns `-5`.
|
||||
- Without `doc.write`, a call that changes the document fails with `-6`.
|
||||
`plugin.install` and `plugin.inspect` list such ids as `unknownCommands`, and calling one returns `-5` (`-6` without
|
||||
`doc.read`).
|
||||
- Without `doc.read`, every call of a listed id fails with `-6`, since a command's result describes the document.
|
||||
Without `doc.write`, a call that changes the document fails with `-6`.
|
||||
- These limits are VectorCraft's own values: at most 1,000 calls a run, 8 MiB of arguments or result a call and 64 MiB
|
||||
of arguments and results a run. Each call costs 10,000 instructions of the run's budget, plus one for every 64 bytes
|
||||
of its arguments and its result, and the run checks Cancel and its time budget before and after each call.
|
||||
|
||||
Reference in New Issue
Block a user