Block Document
A block workspace where the slash menu and the drag handle are the interface. Type / for the block menu, # for a heading, - for a list, > for a quote. Hover any block for its drag handle. The Decision entry command in the slash menu is registered by this page, not by a plugin.
Type / for the block menu# heading- list> quoteHover a block for the drag handle
Blocks – · Headings – · Slash commands available –
Example code
var cfg = RTE_CreateConfig();
cfg.dragHandleEnabled = true; // hover a block, grab the handle
cfg.dragHandleKeyboard = true; // and the keyboard equivalent, for a11y
cfg.foldHeadingsEnabled = true; // collapse a section by its heading
cfg.markdownShortcutsEnabled = true; // core: "# ", "> ", "- ", "1. ", "---"
var editor = new RichTextEditor("#editor", cfg);
// Slash commands registered from PAGE code, not from a plugin. A plugin would
// have to sort after slashcommand.js in the alphabetical bundle order or
// editor.slashCommands would not exist yet; page code always runs last.
editor.slashCommands.register({
id: "decisionlog",
section: "Workspace",
title: "Decision entry",
description: "A dated decision with owner and rationale",
keywords: ["decision", "adr", "log"],
run: function () {
editor.insertHTML("<h3>Decision — " + new Date().toISOString().slice(0, 10) + "</h3>" +
"<p><b>Owner:</b> unassigned</p><p><b>Why:</b> </p>");
}
});