Plite keeps editor reads under editor.read. The groups make state ownership
explicit and prevent query helpers from accumulating on the editor root.
The complete reference lives in Plite Editor. This page is the Plate-facing index for that API.
Direct Reads
Use a direct group method for one read.
const selection = editor.read.selection();
const block = editor.read.nodes.block();
const text = editor.read.text.string([]);
const isInline = editor.read.schema.isInline(element);const selection = editor.read.selection();
const block = editor.read.nodes.block();
const text = editor.read.text.string([]);
const isInline = editor.read.schema.isInline(element);The main groups are:
| Group | Purpose |
|---|---|
editor.read.nodes | Traverse, locate, and inspect document nodes. |
editor.read.points | Resolve and compare points. |
editor.read.ranges | Build, project, and inspect ranges. |
editor.read.selection | Inspect the current selection or an explicit target. |
editor.read.text | Read text from a location. |
editor.read.schema | Ask block, inline, void, and selectable policy. |
editor.read.view | Read focus, composition, and read-only state. |
editor.read.runtime | Read runtime IDs and snapshots. |
Snapshot Reads
Use the callback form when several reads must share one coherent state view.
const summary = editor.read((state) => ({
block: state.nodes.block(),
selection: state.selection(),
text: state.text.string([]),
}));const summary = editor.read((state) => ({
block: state.nodes.block(),
selection: state.selection(),
text: state.text.string([]),
}));The callback is for grouped reads. It does not unlock a second API.
Node Targets
Read methods with an at option accept a location or a live descendant.
const path = editor.read.nodes.path(element);
const entry = editor.read.nodes.get(element);
const parent = editor.read.nodes.parent(element);const path = editor.read.nodes.path(element);
const entry = editor.read.nodes.get(element);
const parent = editor.read.nodes.parent(element);Lifecycle node, point, and range reads return undefined when their target is
unavailable. For node targets, that includes detached nodes and nodes owned by
another editor or root.
Matching Nodes
Node queries accept predicates or shallow property objects.
const callout = editor.read.nodes.find({
match: { type: "callout" },
});
const structural = editor.read.nodes.toArray({
match: { type: ["table", "table_cell"] },
});
const blocks = editor.read.nodes.toArray({
match: (node) =>
NodeApi.isElement(node) && editor.read.schema.isBlock(node),
});const callout = editor.read.nodes.find({
match: { type: "callout" },
});
const structural = editor.read.nodes.toArray({
match: { type: ["table", "table_cell"] },
});
const blocks = editor.read.nodes.toArray({
match: (node) =>
NodeApi.isElement(node) && editor.read.schema.isBlock(node),
});Property values use exact equality. An array means one-of. Use predicates for computed policy and TypeScript narrowing.
Selection Queries
Selection checks are explicit methods, not boolean query flags.
const isCollapsed = editor.read.selection.isCollapsed();
const spansBlocks = editor.read.selection.isAcrossBlocks();
const startsHeading = editor.read.selection.isAtBlockStart({
match: { type: "heading" },
});
const containsFirstBlock = editor.read.selection.contains([0]);
const intersectsCallout = editor.read.selection.intersects(calloutElement);const isCollapsed = editor.read.selection.isCollapsed();
const spansBlocks = editor.read.selection.isAcrossBlocks();
const startsHeading = editor.read.selection.isAtBlockStart({
match: { type: "heading" },
});
const containsFirstBlock = editor.read.selection.contains([0]);
const intersectsCallout = editor.read.selection.intersects(calloutElement);Point checks live under editor.read.points.
const selection = editor.read.selection();
const isWordEnd = selection
? editor.read.points.isWordEnd(selection.anchor)
: false;const selection = editor.read.selection();
const isWordEnd = selection
? editor.read.points.isWordEnd(selection.anchor)
: false;Extension APIs
editor.api contains installed extension services. It is not the document
query namespace.
editor.api.dom.focus();
editor.update({ history: "skip" }).text.insert("Imported");editor.api.dom.focus();
editor.update({ history: "skip" }).text.insert("Imported");Document mutations live under editor.update. See
Editor Transforms and the canonical
Plite transform reference.