Bläck StudioPlugin SDK v1.0.0 · API 10
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, and each shows a part of the API:

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: React in the status bar, a hotkey
cast-suggestsandboxed: suggestions as you type, kept up to date as the navigator 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, built from the writer's library; starting a sprint
dictationin the window: the microphone, speech turned into text on the device (app.speech), a toolbar button, a hotkey, a secret setting, a request to a service using 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)
addStatusBarIteman item in the status bar, drawn with React or as text you change
addEditorMenuIteman entry in the text's right-click menu
addBinderMenuIteman entry in the navigator's right-click menu
addExportera format in Compile
addHighlightermarks in the text, found one paragraph at a time and never saved
registerEditorExtensionTipTap extensions: marks, nodes, input rules, shortcuts (window only)
addSidebarPanela tab beside the navigator (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
addBookImportera whole book from another app's file or folder, in File → Import and on the welcome screen (API 7)
addSettingssettings that Bläck Studio draws for you in Settings → Plugins
addSettingsPanelsettings that you draw yourself (window only)
onproject-open, project-close, selection-change, doc-change, nodes-change
loadData, saveDatayour plugin's data, stored on this computer

You read settings declared with addSettings from this.settings. Bläck Studio keeps only the values the writer changed. So if a new version of your plugin has a better default, everyone who hadn't changed that setting gets it. updateSettings({ key: undefined }) puts a setting back to its default.

this.app gives you the rest, each part described below:

  • app.project: the book.
  • app.editor: the selection, comments on it, typing at the caret, and, in the window, the editor itself.
  • app.ui: notices and dialogs.
  • app.net: the internet, limited to the hosts you asked for.
  • app.files: files and folders the writer chose.
  • app.exec: the programs you named.

If your plugin has a styles.css next to its manifest, Bläck Studio loads it with the plugin.

In the window, react, react/jsx-runtime, @tiptap/core and @tiptap/pm/* are Bläck Studio's copies. The build leaves them out of your script. Your interface follows the theme if you use Bläck Studio's classes: btn, input, insp-section, sb-btn and so on.