@knights-of-the-editing-table/spell-book
v1.0.3
Published
Add Spell Book support to an extension. Execute actions with shortcuts or control surface.
Maintainers
Readme
Spell Book
Spell Book is a support app to listen for a shortcut or a control surface button press in Adobe apps, to trigger extension commands. This module provides an interface for registering commands and handling shortcuts in your Adobe extension.
Installation
npm install @knights-of-the-editing-table/spell-bookUsage
Basic Setup
import Spellbook from '@knights-of-the-editing-table/spell-book';
const commands = [
{
commandID: 'command.id',
name: 'Command 1', // use localised name if needed
group: 'Group 1', // optional
action: () => { // run action when command is triggered
console.log('command.id triggered!')
}
}
];
const spellbook = new Spellbook('Extension name', 'extension.id', commands);Command Interface
/**
* @typedef {Object} Command
* @property {string} commandID - Unique identifier for the command
* @property {string} name - Display name for the command
* @property {string?} group - Name of group the command belongs to
* @property {(args?: any) => void} [action] - Function to execute when command is triggered
*/API Reference
Spellbook
Constructor
new Spellbook(
pluginName: string,
pluginID: string,
commands?: Command[])Methods
register(commands: Command[]): void- Add or update commandsstart(): void- Start listening for command eventsstop(): void- Stop listening for command events
Events
The plugin extends EventEmitter and emits events when commands are triggered:
spellbook.on('command.id', (commandID) => {
console.log('command.id triggered!')
});Supported Adobe Hosts
- Premiere Pro
- After Effects
- Photoshop (CEP)
- Illustrator
- InDesign
Integration with Adobe CEP
This module is designed to work with Adobe CEP extensions and uses the native window.__adobe_cep__ interface.
Make sure that Spell Book is installed (both app and Spell Book extension).
UXP support
Use UXP Spellbook plugin: https://www.npmjs.com/package/@knights-of-the-editing-table/spell-book-uxp
License
MIT License - see LICENSE file for details.
Contributing
Contributions are welcome! Please feel free to submit a Pull Request.
