Replies: 3 comments 1 reply
-
|
Hi @caspersf! I'm Dosu and I’m helping the plate team. Good bug report. This is a real issue — here's what I found digging into the code: Root cause: In the Slate fork's Plate does have a wrapper around Why TrailingBlockPlugin masks it: Without Two things that could fix this:
For now, adding To reply, just mention @dosu. Share context across your team and agents. Try Dosu. |
Beta Was this translation helpful? Give feedback.
-
|
Even with TrailingBlockPlugin or a block between tables, clicking in the padding region of the editor, takes focus away from the table, and causes this issue. Suppressing the error is also not a workaround, since it causes text to render outside the intended position(typing in table, renders texts outside it), and not part of the Plate Value structure. |
Beta Was this translation helpful? Give feedback.
-
|
@zbeyens if you could check this out please. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Description
When a note-style editor contains one or more tables, clicking inside the editor on a DOM region that has no
data-slate-nodeancestor (the contentEditable's own padding, the gap between two adjacent tables, or below the last table if no trailing paragraph exists) leaveseditor.selectionstale while DOM selection drifts to the unmapped wrapper. Subsequent typing or pasting then crashes insideslate-react:Uncaught Error: Cannot resolve a Slate point from DOM point: [object HTMLDivElement],2
at Object.toSlatePoint (index.es.js)
at Object.toSlateRange (index.es.js)
at HTMLDivElement. (index.es.js)
Related symptoms from the same root cause:
editor.selection), not where the click was.This is reproducible in the official Plate demo at https://platejs.org/docs/table — the error is thrown to the console there too, but the demo has no top-level error boundary so the page doesn't visibly crash. Apps that register a
window.errorhandler or an ErrorBoundary-style unmount-on-error will crash.My integration registers only the table plugins (
TablePlugin,TableRowPlugin,TableCellPlugin) alongside basic marks, paragraph, font, indent, list, and docx/juice paste plugins. I do not installTrailingBlockPlugin,DndPlugin/DndKit,BlockSelectionPlugin,CursorOverlayPlugin,NodeIdPlugin, or any related helper plugin. The docs demo does install these, which seems to mask some of the click-landing problems by providing additional mapped click surfaces — but the underlying throw fromtoSlateRangestill fires there.Expected behavior
Clicks inside the editor should always produce a valid
editor.selection, either by ensuring a clickable Slate-mapped region exists for every reachable pixel (e.g., a trailing paragraph after the last table + inter-table paragraph normalization in the table plugin), or bytoSlateRangenever throwing on user-interaction paths (returning null and falling through).Nice-to-have: when a click lands outside any table (in an unmapped region of the editor), the selection could be snapped to the last cell of the nearest table — the same behavior that already happens when only a single table is present. With a single table, clicking below/outside the table keeps focus in the table's last cell; with multiple tables, that fallback is lost and focus/selection disappears entirely.
The current behavior is that a single stray click inside the editor can put the editor in an unrecoverable state.
Reproduction URL
https://platejs.org/docs/table
Reproduction steps
On https://platejs.org/docs/table (or any editor built from the docs demo with
TableKit):Insert two tables (or one table followed by no trailing paragraph).
Put the caret in a cell and type a few characters.
Click in the gap between the two tables (or just below the last table). Note the caret disappears visually —
editor.selectiondid not update because the click target has nodata-slate-nodeancestor.Type text. The text is inserted into the last cell (where the caret was) rather than where you clicked, because
editor.selectionis stale.Click outside again, type again. Repeat.
After a few iterations, native contentEditable insertion ends up in the unmapped DOM region (visible text appears below the table with no Slate block backing it), and the next interaction throws:
Error: Cannot resolve a Slate point from DOM point: [object HTMLDivElement],<offset>Variant (paste-only, no repeated typing needed):
3a. After step 3 above, press Ctrl+V with anything rich in the clipboard (e.g. a previously copied paragraph or cell from within the editor).
Observed: immediate throw of the same error.
Plate version
52.0.17 (
platejs), 52.0.11 (@platejs/table)Slate React version
0.120.0
Screenshots
The ccsc text below the first table, is invalid text that is rendered below the table, post the error
Logs
Uncaught Error: Cannot resolve a Slate point from DOM point: [object HTMLDivElement],2
at Object.toSlatePoint (index.es.js)
at Object.toSlateRange (index.es.js)
at HTMLDivElement. (index.es.js)
Browsers
Chromium (Chrome/Edge) on Linux and macOS
Beta Was this translation helpful? Give feedback.
All reactions