Cannot resolve a Slate point from DOM point:
See original GitHub issueerror info
Uncaught Error: Cannot resolve a Slate point from DOM point: [object Text],3 at Object.toSlatePoint (index.es.js:618) at Object.toSlateRange (index.es.js:663) at index.es.js:1554 at commitHookEffectListMount (react-dom.development.js:19731) at commitLifeCycles (react-dom.development.js:19787) at commitLayoutEffects (react-dom.development.js:22803) at HTMLUnknownElement.callCallback (react-dom.development.js:188) at Object.invokeGuardedCallbackDev (react-dom.development.js:237) at invokeGuardedCallback (react-dom.development.js:292) at commitRootImpl (react-dom.development.js:22541) at unstable_runWithPriority (scheduler.development.js:653) at runWithPriority$1 (react-dom.development.js:11039) at commitRoot (react-dom.development.js:22381) at finishSyncRender (react-dom.development.js:21807) at performSyncWorkOnRoot (react-dom.development.js:21793) at react-dom.development.js:11089 at unstable_runWithPriority (scheduler.development.js:653) at runWithPriority$1 (react-dom.development.js:11039) at flushSyncCallbackQueueImpl (react-dom.development.js:11084) at flushSyncCallbackQueue (react-dom.development.js:11072) at Object.batchedUpdates$1 [as unstable_batchedUpdates] (react-dom.development.js:21862) at Object.e.onChange (index.es.js:964) at index.es.js:5321
##code demo
const [value, setValue] = useState<Node[]>(initialValue)
const editor = useMemo(() => withHistory(withReact(createEditor())), [])
return (
<Slate editor={editor} value={value} onChange={value => setValue(value)}>
<Editable placeholder="Enter some plain text..." />
</Slate>
)
I use placeholder in Editable, and when I input, I first input in English mode, then delete all characters, and then switch to Chinese input, this time an error will occur.
Issue Analytics
- State:
- Created 3 years ago
- Reactions:18
- Comments:8 (1 by maintainers)
Top GitHub Comments
It would break if the initial empty value is like this
[]
. I found the trick to set empty value as below, it’s weird that we have no official documentation or fix on such issue.@Silvercast it breaks
ExitBreakPlugin
and when I use this it works correctly: