Implementation:0xranx OpenContext Tiptap SlashMenu
| Knowledge Sources | |
|---|---|
| Domains | Editor, React |
| Last Updated | 2026-10-24 00:00 GMT |
Overview
Slash command menu for the Tiptap editor, triggered by typing "/" to insert blocks like headings, lists, tables, code blocks, and page references.
Description
The SlashMenu.jsx component in src/ui/src/editor/tiptap/ detects "/" typed at the start of a line or after whitespace in the Tiptap editor. It opens a filterable dropdown of block types with i18n labels, keyboard navigation (arrows, Enter, Escape), and scroll-into-view for the active item. Selecting an item removes the trigger text and inserts the corresponding block via Tiptap chain commands.
Usage
Import this component in TiptapMarkdown.jsx and render it with the editor instance.
Code Reference
Source Location
- Repository: 0xranx_OpenContext
- File: src/ui/src/editor/tiptap/SlashMenu.jsx
- Lines: 1-565
Signature
export default function SlashMenu({ editor, onOpenPageRefPicker })
Import
import SlashMenu from './editor/tiptap/SlashMenu';
I/O Contract
Inputs
| Name | Type | Required | Description |
|---|---|---|---|
| editor | Editor | Yes | Tiptap editor instance |
| onOpenPageRefPicker | Function | No | Opens page reference picker |
Usage Examples
Rendering Slash Menu
import SlashMenu from './editor/tiptap/SlashMenu';
<SlashMenu
editor={editor}
onOpenPageRefPicker={() => setPageRefOpen(true)}
/>