Skip to Content

@stesura/core/keymap

stesuraKeymap(schema) is ProseMirror’s baseKeymap with these bindings added or overridden (Mod is Cmd on macOS, Ctrl elsewhere):

KeyBinding
EnterOpens a selected equation’s editor; otherwise a newline in code, outdent or un-number an empty list item, or split the block (applying the style’s next style at its end); where no block can be added (a narrowed schema), a line break
Shift-EnterA newline in code, otherwise a line break (insertHardBreak)
F2Opens a selected equation’s editor
Tab / Shift-TabNext / previous table cell (Tab in the last cell appends a row); outside tables, indent / outdent
BackspaceSelects an equation before deleting it; at the start of a line, outdents an unnumbered block or removes a list item’s numbering; over a whole story (Ctrl+A), leaves one Normal paragraph
DeleteJoins into or removes a code block from its end; removes a fully selected table; over a whole story (Ctrl+A), leaves one Normal paragraph
ArrowLeftMoves the caret out of a selected numbering counter
ArrowUpStops the caret at the top of a section’s content instead of entering its hidden header; in later sections, jumps to the end of the previous one
Mod-b / Mod-i / Mod-uToggle bold / italic / underline
Mod-Shift-cToggle code
Mod-Shift-sToggle strikethrough
Mod-Shift-= / Mod-=Toggle superscript / subscript
Mod-zundo
Mod-Shift-z / Mod-yredo
Mod-aSelect all within the part holding the caret (content, header or footer)
EscapeDisarms the format painter, otherwise closes search
Mod-fOpens search
Mod-> / Mod-<incrementFontSize("up") / incrementFontSize("down")
Mod-EnterInserts a paragraph after the table when inside one, otherwise a page break
Mod-l / Mod-e / Mod-r / Mod-jsetTextAlign "start" / "center" / "end" / "justify"
Alt-tinsertTable({ rows: 3, cols: 3 })
Mod-ksetPendingLink
Mod-Shift-xtoggleDirection
Shift-F3cycleCase
Ctrl-SpaceclearFormatting(): character formatting only (Word’s Ctrl+Space; Ctrl on macOS too, where Cmd+Space is Spotlight)
Ctrl-qParagraph formatting only, keeping the style (Word’s Ctrl+Q; Ctrl on macOS too, where Cmd+Q quits the browser)

Functions & values

stesuraKeymap

The editor’s key bindings: ProseMirror’s baseKeymap plus Stesura’s own handlers for Enter, Tab, Backspace, Delete and the arrow keys, and the usual formatting, history and alignment shortcuts.

Takes the schema because the mark shortcuts resolve mark types up front.

Parameters:
NameTypeDefault
schemaSchema<any, any>
Returns:
Record<string, Command>

stesuraKeymapPlugin

stesuraKeymap as a plugin.

Parameters:
NameTypeDefault
schemaSchema<any, any>
Returns:
Plugin<any>
Last updated on