* * remove scheduling of text updates using setTimeout
* call Transforms.setSelection before Editor.insertText
* changeset
* Restore logic to set isComposing to false
As already discussed almost a year ago in #3198, `useMemo` doesn't guarantee persistence. This breaks Fast Refresh.
`useState` without a setter is a straightforward fix that avoids dependencies; let's get the docs updated so Fast Refresh works again.
Fixes#3198
There is a Chromium bug where, if you have an inline at the end of a block,
clicking the end of a block puts the cursor inside the inline
instead of inside the final {text: ''} node.
This commit updates the inlines example to show the problem, and to show
a known workaround for the problem.
See for context: https://github.com/ianstormtaylor/slate/issues/4704
* Warn when normalization removes node
Slate requires the invariant that children are all blocks or all inlines.
It enforces this in default normalization by removing children.
When such a node is removed, it's almost certainly due to a programming
error: the developer needs to fix their application to ensure it
maintains this invariant. But currently Slate does not tell the
developer this.
I made such a programming error, and spent a long time debugging nodes
that mysteriously went missing. I would have fixed it within 30 seconds
if Slate had warned me when it detected this error.
(Note I have used console.warn despite the eslint rule. As far as I can
see, Slate has no other facility for runtime warnings.)
* Add changeset
* Version Packages
* Update CHANGELOG.md
Add a missing changeset from one of the PRs.
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
Co-authored-by: Dylan Schiemann <dylan@dojotoolkit.org>
* slate-react: use a layout effect to render leaf text nodes instead of via virtual DOM, which implements diffing with real DOM avoiding interference with native TextNode behaviors for example spellcheck
* lint
* clarify and simplify extreme case of null text in TextString rendering
* code style: use string interpolation in TextString
Co-authored-by: Nemanja Tosic <netosic90@gmail.com>
Co-authored-by: Peter Sipos <schipy@craft.do>
Co-authored-by: Nemanja Tosic <netosic90@gmail.com>
* fix: isBlockActive should use Array.from()
The richtext.tsx example `isBlockActive` was not working for me in my environtment because `Editor.nodes` returns a Generator, not an Array. So `isBlockActive` always returned false. Wrapping it in `Array.from` fixes the example.
* run prettier
Co-authored-by: Dan Tello <dtello@medallia.com>
* fix: resolve CJK IME double input
* fix: resolve UC mobile no input issue
* feat: add changeset
* Update .changeset/large-melons-warn.md
Co-authored-by: Dylan Schiemann <dylan@dojotoolkit.org>
* fix: more specific way to deal with browsers
Co-authored-by: Dylan Schiemann <dylan@dojotoolkit.org>
* Adds clarification & examples to demystify Transforms.
* Fleshes out documentation of NodeOptions for Transforms
* Update docs/concepts/04-transforms.md
Co-authored-by: Dylan Schiemann <dylan@dojotoolkit.org>
* Uses 'API' in the title of all API documents
Co-authored-by: Dylan Schiemann <dylan@dojotoolkit.org>