What a plugin can do
Everything is in index.d.ts. The plugins on Bläck Studio's list are written this way too, in this repository's plugins/ folder, and make good examples:
| Plugin | Shows |
|---|---|
filter-words | sandboxed: marks in the text, settings, a status bar item, events |
markdown-export | sandboxed: a format in Compile |
name-generator | in the window: a view, an inspector tab, a menu entry, a TipTap shortcut, changing the book |
pomodoro | in the window: its own React in the status bar, a hotkey |
cast-suggest | sandboxed: suggestions as you type, kept ready as the binder changes |
pandoc-export | sandboxed: running a program, in its temporary folder, with formats that follow its settings |
continue-writing, today, book-progress, writing-calendar, series-overview, recent-activity | in the window: cards on the welcome screen's dashboard, from the writer's library; starting a sprint |
dictation | in the window: the microphone, speech written down on the device (app.speech), a toolbar button, a hotkey, a secret setting, a request to a service with the writer's own key |
In short:
| Method | Adds |
|---|---|
addCommand | a command in the palette (Ctrl+K) and the Plugins menu, with a hotkey if you like |
addView | a view beside the corkboard and outliner (window only) |
addInspectorTab | a tab in the inspector, for the items you choose (window only) |
addStatusBarItem | something in the status bar: drawn with React, or text you change |
addEditorMenuItem | an entry in the text's right-click menu |
addBinderMenuItem | an entry in the binder's right-click menu |
addExporter | a format in Compile |
addHighlighter | marks in the text, found a paragraph at a time; never saved |
registerEditorExtension | TipTap extensions: marks, nodes, input rules, shortcuts (window only) |
addSidebarPanel | a tab beside the binder and collections (window only) |
addToolbarButton | a button in the editor's toolbar |
addSuggester | suggestions under the caret after a trigger: @ for characters, # for tags… |
addImporter | a kind of file for File → Import Documents |
addSettings | settings Bläck Studio draws for you in Settings → Plugins |
addSettingsPanel | settings of your own drawing (window only) |
on | project-open, project-close, selection-change, doc-change, nodes-change |
loadData, saveData | data of your own on this computer |
Settings declared with addSettings are read from this.settings. Only what the writer changed is kept, so a better default in a new version of the plugin reaches everyone who hadn't changed it. updateSettings({ key: undefined }) puts one back to its default.
this.app reaches the rest, each described below:
app.project: the book.app.editor: the selection, comments on it, typing at the caret, and the editor itself in the window.app.ui: notices and dialogs.app.net: the internet, to the hosts you asked for.app.files: files and folders the writer chose.app.exec: the programs you named.
A plugin's own styles.css, beside its manifest, is loaded with it.
In the window, react, react/jsx-runtime, @tiptap/core and @tiptap/pm/* are Bläck Studio's own copies. The build leaves them out of your script, and your interface follows the theme if you use Bläck Studio's classes: btn, input, insp-section, sb-btn and so on.