In Firefox, `range.cloneContents()` returns an extra trailing '\n', when the document ends with a new-line character. This results in the offset length being off by one, so we need to subtract one to account for this.
* correct immutability lockfile flag for yarn 3
* More experiments to re-enable the Version Packages action
* add changeset
* more work to fix automated changeset workflow
* Upgrade `is-plain-object` to v5.0.0
The `is-plain-object` package recently had a major version upgrade that
broke libraries which import its default export, such as this one. This
causes issues when other packages in the same application require a
higher version of `is-plain-object`, resulting in an error originating
in Slate's codebase. To remedy this, Slate is now depending on
`is-plain-object@^5.0.0` and its import references across the codebase
have been updated.
Fixes#4499
* Add changeset
Co-authored-by: Dylan Schiemann <dylan@dojotoolkit.org>
* fix: check if data-slate-tring node is not null
Only reset the focus node of a selection when the node with attribute `data-slate-string` is defined
* fix: rewrite logic for checking triple click
* Add changeset
Co-authored-by: Dylan Schiemann <dylan@dojotoolkit.org>
* initial skeleton for jest testing
* run in serial mocha, then jest on slate-react only
* run-s without glob patterns https://github.com/yarnpkg/berry/issues/22
* don't run mocha on slate-react package
* use yarn run instead of run-s
* fix(editable component): reselect the range created by triple click
* Revert "fix(editable component): reselect the range created by triple click"
Reason: attaching a handler for `onClick` event is no longer needed.
* fix(react-editor): reselect DOMSelection when triple clicked
Reason: Triple clicking an element in Chrome will falsely set the focus node as the next sibling node with focusOffset 0
* test: add e2e test for triple click
* Migrate to yarn berry v3
* Fix yarn dependencies for linting
* Specifically invoke bash in yarn clean to make brace expansion work
* Upgrade cypress to 8.x to support yarn berry
* Try out yarn berry workaround for netlify
From https://answers.netlify.com/t/using-the-new-yarn-release-2-0-0-berry/8270
* Update .yarnrc.yml for syntax consistency
Co-authored-by: Dylan Schiemann <dylan@dojotoolkit.org>
* use rimraf for clean command with escaped glob pattern
* Use workspace:* resolution for workspace packages and rewrite yarn.lock
* set workspace package versions explicit again
* update peer dependencies
* disable import/named for ts and tsx files
* Replace 'key' with 'key=true' wherever babel complains
* replace all instances of key to someKey in tests to satisfy eslint and babel
* remove unnecessary yarn packageExtension and remove cross-env dependency
* upgrade yarn to latest
* Upgrade next.js to 10.x to support yarn berry
* update .yarnrc to satisfy netlify
Co-authored-by: Dylan Schiemann <dylan@dojotoolkit.org>
* [slate-react]: fix selection bugs when multiple editors share value
The KEY_TO_ELEMENT weakmap must be scoped to the instance to avoid collisions between multiple editors.
This is solved by wrapping it in another WeakMap keyed on the editor object, that returns the KEY_TO_ELEMENT Weakmap for that editor.
* Add changeset
Co-authored-by: Dylan Schiemann <dylan@dojotoolkit.org>
* Update forced-layout example
Enforce layout to an explicit block index to allow for other block types
* Update site/examples/forced-layout.tsx
* fix layout example to comply with linting rules
Co-authored-by: Lukas Murdock <lukas.murdock@gmail.com>
* Proposal for Remove useCallback from walkthroughs
I have seen in the walkthrough the use of `useCallback` but I don't think are need it, and add a small complexity while understanding the concept, if we moved out the function outside of the component will be stable and will not require to maintain either referential identity or calculated complex logic.
If people think this is a good idea I can go and update all documentation to remove unnecessary `useCallback` from the example.
unless I'm missing something.
* Update docs/walkthroughs/04-applying-custom-formatting.md
Co-authored-by: Dylan Schiemann <dylan@dojotoolkit.org>