* 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>
* fix(android): Fix mark is not inputed on insert text in android
* add changeset
* null mark only when mark exist
Co-authored-by: surya darma <budi.surya@kumparan.com>
* fix(android): clipboard application/x-slate-fragment is missing on paste in android
* add event onCut
* add changeset
* make slate fragment available when props onPaste, call preventDefault
* .
* get the fragment from text/html when it missing
* remove setData
* use getClipboardData instead of hooks
* Do not needlessly JSON.stringify() the whole editor
* Refactor based on feedback
* Linting fix for error messages
* linting fix
Co-authored-by: Dylan Schiemann <dylan@dojotoolkit.org>
* use native character insertion to fix browser/OS text features. (flickering spellcheck, autocorrect, text shortcuts, etc.)
move some checks into previous if statement, remove commented out code
move native behavior into `slate-react`, and remove any external interface
dont use native editing if marks are set, as a new node will be inserted
match -> above
remove nativeOperationsQueue from editor
bail out of native queueing and immediately flush events if non insert_text operation is being applied.
* Convert TextString to a functional component
* Batch normalization of native op application
* Add changeset
* only proceed as native event if single character non-special character or space, to limit potential bad side effects.
* Revert "fix ime double input with mark"
* Comment wording tweak
Co-authored-by: Dylan Schiemann <dylan@dojotoolkit.org>
* Comment wording tweak
Co-authored-by: Dylan Schiemann <dylan@dojotoolkit.org>
* Comment wording tweak
Co-authored-by: Dylan Schiemann <dylan@dojotoolkit.org>
* Comment wording tweak
Co-authored-by: Dylan Schiemann <dylan@dojotoolkit.org>
* Comment wording tweak
Co-authored-by: Dylan Schiemann <dylan@dojotoolkit.org>
Co-authored-by: Ludwig Pettersson <luddep@gmail.com>
Co-authored-by: Dylan Schiemann <dylan@dojotoolkit.org>
* Remove fast-deep-equal in favour of a custom slate-specific equality check that only supports nested objects
* Add array comparison to deep equal. Fix bug with multiple nested objects.
* Comment out currently flaky integration test
Even with a longer timeout, this test is intermittently failing, causing most PRs to show as failing.
* Update cypress/integration/examples/code-highlighting.ts
* test: add test case for bug
* prefer next will transforming selection in remove_node
* add remove_node test
* Add changeset
* review: handle nested blocks
* refactor
* Revert "refactor"
This reverts commit 45a8aab7cb8408295c93d48186f5c7ecb135f4ae.
Co-authored-by: Dylan Schiemann <dylan@dojotoolkit.org>
* Update `findDocumentOrShadowRoot` to return undefined instead of throwing unnecessarily
* Small refactoring to improve the diff for reviewers
* Add changeset for patch
* Update new-trainers-peel.md
* Resolve PR comments
* Revert undefined checks, return window.document and update changeset
* Simplify findDocumentOrShadowRoot based on PR feedback
* Re-run CI
Thanks everyone for your review and thanks @ben10code for your first contribution!
* Add third parameter to `toSlateRange` method
The `toSlateRange` method accepts an optional third parameter that is an object with property `exactMatch` and value is a boolean.
Example of this implementation can be found at the `Editable` component of `slate-react`, inside the custom `onDOMSelectionChange`.
* toSlateRange third param is optional
Co-authored-by: Dylan Schiemann <dylan@dojotoolkit.org>
No changeset as it's a doc update.
* created editable-voids cypress test
* created markdown-preview cypress test
* created images cypress test
* created huge-document cypress test
* added hovering-toolbar, and forced-layout cypress tests
* added embeds cypress test
No changeset as it's adding tests for the examples.