Closed thesunny closed 3 years ago
Well, yes, if Slate changed their API not to have selection
as a prop, they broke the contract we relied on for updating the selection and the selection will get out of sync... Causing all sorts of issues. In the meantime, it means that the version with the breaking API change onwards is currently not supported until we can provide support for the latest version of Slate. 😒
This can cause other issues; if a secondary client updates text, the selection would not be updated appropriately either... And if the client has an invalid selection, it would cause that same issue.
Looking into this ATM and it appears that the code still works when you assign selection
, however the specification for Slate does not specify a selection
node and require a ts-ignore to work.
{/* @ts-ignore */}
<Slate editor={editor} value={value} selection={selection} onChange={onChange}>
I have updated the selection to be updated even if it was not specified in the Slate properties. While it is still possible to pass in the parameter directly, it is no longer required.
Type some words and then undo the typing results in this:
http://g.recordit.co/mw7CIONVc7.gif
Which eventually ends in this error:
Looks like it's a small issue to do with how Slate is now ingesting the
selection
. I think previously we added it to the<Slate />
component but that's not a prop to pass in anymore. So I think it's a matter of updating the selection directly on the editor object? I'll leave you to figure out the details but this may be just a small Slate upgrade issue.Here's a snippet of my integration: