Skip to content
This repository has been archived by the owner on Jun 15, 2021. It is now read-only.

About Commands

Robert Rees edited this page Jun 14, 2016 · 1 revision

Commands are objects that describe formatting operations. For example, the bold command.

Commands tell Scribe:

  • how to format some HTML when executed (similar to document.queryCommand);
  • how to query for whether the given command has been executed on the current selection (similar to document.queryCommandState);
  • how to query for whether the command can be executed on the document in its current state (similar to document.queryCommandEnabled)

To ensure a separation of concerns, commands are split into multiple layers. When a command method is called by Scribe, it will be filtered through these layers sequentially.

Scribe
Where custom behaviour is defined.
Scribe Patches
Where patches for browser inconsistencies in native commands are defined.
Native
Browser's native `contenteditable` implementation
Clone this wiki locally