Bläck StudioPlugin SDK v1.0.0 · API 4
Contents

Start

Building

Beyond Bläck Studio

How it runs

Sharing

Look up

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:

PluginShows
filter-wordssandboxed: marks in the text, settings, a status bar item, events
markdown-exportsandboxed: a format in Compile
name-generatorin the window: a view, an inspector tab, a menu entry, a TipTap shortcut, changing the book
pomodoroin the window: its own React in the status bar, a hotkey
cast-suggestsandboxed: suggestions as you type, kept ready as the binder changes
pandoc-exportsandboxed: running a program, in its temporary folder, with formats that follow its settings
continue-writing, today, book-progress, writing-calendar, series-overview, recent-activityin the window: cards on the welcome screen's dashboard, from the writer's library; starting a sprint
dictationin 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:

MethodAdds
addCommanda command in the palette (Ctrl+K) and the Plugins menu, with a hotkey if you like
addViewa view beside the corkboard and outliner (window only)
addInspectorTaba tab in the inspector, for the items you choose (window only)
addStatusBarItemsomething in the status bar: drawn with React, or text you change
addEditorMenuIteman entry in the text's right-click menu
addBinderMenuIteman entry in the binder's right-click menu
addExportera format in Compile
addHighlightermarks in the text, found a paragraph at a time; never saved
registerEditorExtensionTipTap extensions: marks, nodes, input rules, shortcuts (window only)
addSidebarPanela tab beside the binder and collections (window only)
addToolbarButtona button in the editor's toolbar
addSuggestersuggestions under the caret after a trigger: @ for characters, # for tags…
addImportera kind of file for File → Import Documents
addSettingssettings Bläck Studio draws for you in Settings → Plugins
addSettingsPanelsettings of your own drawing (window only)
onproject-open, project-close, selection-change, doc-change, nodes-change
loadData, saveDatadata 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.