Implementation:0xranx OpenContext Plate SlashMenu
| Knowledge Sources | |
|---|---|
| Domains | Editor, React |
| Last Updated | 2026-10-24 00:00 GMT |
Overview
⚠ DEPRECATED: Slash command menu for the legacy Plate editor, triggered by typing "/" to insert blocks like headings, lists, tables, code blocks, and page references. Only imported by the dead PlateMarkdown component. See Heuristic:0xranx_OpenContext_Warning_Deprecated_Plate_Editor.
Description
The SlashMenu component in src/ui/src/editor/components/ detects when the user types "/" in the Plate editor by inspecting text before the cursor. It opens a filterable dropdown of block types (H1-H3, bullet/numbered/task lists, tables, columns, quotes, code blocks, page references). The menu supports keyboard navigation (arrow keys, Enter, Escape), filtering by label/description/keywords (including Chinese), and i18n labels. Selecting an item deletes the "/" trigger text and inserts the corresponding block via Plate transforms.
Usage
Import this component in PlateMarkdown.jsx and render it with the editor context.
Code Reference
Source Location
- Repository: 0xranx_OpenContext
- File: src/ui/src/editor/components/SlashMenu.jsx
- Lines: 1-284
Signature
const SlashMenu = memo(({ trigger, onOpenPageRefPicker, tableNodeType, insertTable, columnNodeType, insertColumnGroup })
export default SlashMenu;
Import
import SlashMenu from './editor/components/SlashMenu';
I/O Contract
Inputs
| Name | Type | Required | Description |
|---|---|---|---|
| trigger | number | Yes | Counter to force re-check |
| onOpenPageRefPicker | Function | No | Opens page reference picker |
| tableNodeType | string | Yes | Node type for tables |
| insertTable | Function | Yes | Inserts table into editor |
| insertColumnGroup | Function | No | Inserts column layout |
Usage Examples
Rendering SlashMenu
import SlashMenu from './editor/components/SlashMenu';
<SlashMenu
trigger={contentVersion}
onOpenPageRefPicker={() => setPageRefOpen(true)}
tableNodeType={types.table}
insertTable={(editor, opts) => editor.tf.insertTable(opts)}
columnNodeType={types.column}
insertColumnGroup={(editor, opts) => insertColumnGroup(editor, opts)}
/>