Skip to content
QuireKit
Plugin docs
Alpha · evolving API
Content and formattingView Markdown ↗

Custom plugins

Connect your own behavior to Core without a second editing state.

This page defines shared Core behavior. Classic and Block can install it through extensions, provided its commands exist and the selected View is validated. Product controls use their own adapter contracts; see editor integration.

Suppose you want a keyboard shortcut that makes the current text bold. This adds behavior without introducing a document structure, so it uses Extension.

This chapter adds a custom shortcut to the editor from Quick start.

1. Define the shortcut

Create shortcuts.ts. Return a map of keys to handlers from addKeyboardShortcuts():

shortcuts.tsts

Mod means Command on macOS and Ctrl elsewhere. The handler invokes the existing toggleBold() command. Its return value tells the editor whether the key was handled; false lets other shortcuts try it.

name identifies this extension within the editor; it is not an npm package name. StarterKit supplies bold. The shortcut only triggers that capability and shares its document and undo history.

2. Add it to the editor

Import the extension in the file that creates Editor and add it to the existing extensions list:

When creating the editorts

This continues to use the Editor, StarterKit, DomViewExtension imports and element from Quick start. Install the extension once; no separate keyboard listener is needed on the host.

Live effect

Select text below and press Command+Shift+B on macOS or Ctrl+Shift+B elsewhere, then undo. The button invokes the same bold command.

Preparing the example…

Use Node or Mark for new persistent content, defining attributes, parsing and serialization. Add separate Canvas or DOCX contributions when needed; a behavior extension does not automatically support every backend.

Complete files

In the example, core/shortcuts.ts defines the shortcut and core/create.ts creates and mounts the editor. Select a file when you need its complete imports or initial content:

core/create.tsts

For persistent custom content and multiple backends, continue to the complete content extension. For ribbon, panels and file services, see product plugins.

QuireKitQuireKit · Core, plugins and Classic docs