Implementation:0xranx OpenContext Node Types
| Knowledge Sources | |
|---|---|
| Domains | Editor, React |
| Last Updated | 2026-10-24 00:00 GMT |
Overview
⚠ DEPRECATED: Centralized node type mapping utilities for the legacy Plate editor, providing a single source of truth for resolving editor plugin type keys with proper fallbacks. Only used by the dead PlateMarkdown component and its dependents. See Heuristic:0xranx_OpenContext_Warning_Deprecated_Plate_Editor.
Description
The nodeTypes.js module in src/ui/src/editor/ exports getNodeTypes which resolves all Plate editor node type keys (paragraph, headings, code block, lists, table, link, etc.) by querying editor.getType() with fallback strings. It also provides helper predicates isListContainer, isOrderedList, isUnorderedList, isTaskList, getListStart, and countListItems for list-related logic.
Usage
Import getNodeTypes and helpers in editor components and normalizers to avoid scattered editor.getType?.(KEYS.xxx) || 'fallback' patterns.
Code Reference
Source Location
- Repository: 0xranx_OpenContext
- File: src/ui/src/editor/nodeTypes.js
- Lines: 1-157
Signature
export function getNodeTypes(editor) // → NodeTypes object
export function isListContainer(node, types) // → boolean
export function isOrderedList(node, types) // → boolean
export function isUnorderedList(node, types) // → boolean
export function isTaskList(node, types) // → boolean
export function getListStart(node) // → number
export function countListItems(node, types) // → number
Import
import { getNodeTypes, isListContainer, isOrderedList, getListStart, countListItems } from './editor/nodeTypes';
I/O Contract
Inputs
| Name | Type | Required | Description |
|---|---|---|---|
| editor | PlateEditor | Yes | Plate editor instance (optional for getType) |
| node | object | Yes (predicates) | Slate node to check |
| types | NodeTypes | Yes (predicates) | Resolved types from getNodeTypes |
Outputs
| Name | Type | Description |
|---|---|---|
| NodeTypes | object | { p, h1, h2, h3, codeBlock, codeLine, ul, ol, taskList, li, lic, table, tr, td, th, link, hr, blockquote } |
Usage Examples
Using Node Types
import { getNodeTypes, isListContainer } from './editor/nodeTypes';
const types = getNodeTypes(editor);
// types.p → 'p', types.ul → 'ul', types.codeBlock → 'code_block', etc.
if (isListContainer(node, types)) {
// Handle list node
}