I'm starting to work on adding plugins to Scribe, and so I thought I'd write down the notes I've taken so far so others could look and correct/add. Eventually I'd like to add them to the source/wiki, but I'm still working on them and I haven't figured out which yet.
Q: How to add Commands to Scribe?
Required API for any Command added to Scribe
Command.execute = run the command
Command.queryState = whether the command has already been applied to the selection
Command.queryEnabled = whether a command is available to use
How does one "patch" a command with CommandPatch?
If a command already exists in document.execCommand, creating a CommandPatch for it will enable that command (and wrap it in a transactionManager). It will otherwise use the default command.
Scribe has a getCommand function that automatically creates a new command if necessary
You can see CommandPatches in plugins/core/patches
Be nice to say a bit more about the APIs for commands and that you can patch a command by replacing the default APIs with your own but otherwise this looks like a good start!
Hello,
I'm starting to work on adding plugins to Scribe, and so I thought I'd write down the notes I've taken so far so others could look and correct/add. Eventually I'd like to add them to the source/wiki, but I'm still working on them and I haven't figured out which yet.