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

Start

Building

Beyond Bläck Studio

How it runs

Sharing

Look up

More of the interface

  • addSidebarPanel({ id, name, render }): a tab beside the navigator, drawn with React (window only).
  • addToolbarButton({ id, title, icon, active?, run }): a button in the editor's toolbar. In the window the icon is a component. In either mode it can also be a few characters ('★'). active shows the button as pressed.
  • addImporter({ id, name, extensions, import }): a kind of file for File → Import Documents. Bläck Studio offers it in the file dialog and passes import the file (name, ext, data as bytes, text). You return the documents to create: [{ title, html }].
  • addBookImporter({ id, name, from?, extensions, folder?, import }): imports a whole book from another app's file or folder. Use folder: true for a folder, as with a Scrivener project's .scriv. On a phone, the writer chooses a zip of it. The importer appears in File → Import as name, and on the welcome screen as "Import from from". Bläck Studio asks the writer for the file and passes it to import. For a file, that's name, ext, data and text. For a folder, it's files (every file in the folder, by its path there), plus read(path) and readText(path) to read one of them. You return the book:
    • its title, labels, statuses and storylines;
    • the items in each part of the navigator (manuscript, characters, places, notes, research, trash), each with its text as HTML, synopsis, notes, keywords, label and status;
    • beats on the storylines.

Items refer to each other (a scene's cast and place, a beat's scene) by ids that you make up for the import. Bläck Studio shows the writer what it created, and either makes it a new book or adds it to the open one. To say why a file can't be read, throw an Error. Book importers need no permission and work in sandboxed plugins. They need "apiVersion": 7. The Scrivener and Plottr imports on the list are built this way.

  • styles.css: if it's next to the manifest, Bläck Studio loads it with the plugin and removes it when the plugin is removed. Put your plugin's id in your class names, so they don't clash with Bläck Studio's or another plugin's.