1
0
mirror of https://github.com/ianstormtaylor/slate.git synced 2025-07-31 12:30:11 +02:00
Commit Graph

3795 Commits

Author SHA1 Message Date
Doug Reeder
8b85aeb205 Adds an example to the docs for Transforms.select (#4507) 2021-09-10 17:49:13 -07:00
Dylan Schiemann
269e59c93a Immer 9 security update (#4505)
* add yarn upgrade-interactive plugin

* chore(immer): update immer to address security issue

* Add changeset
2021-09-09 14:16:50 -07:00
Tom Scott
50bb3d7e32 Upgrade is-plain-object to v5.0.0 (#4500)
* 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>
2021-09-09 12:55:13 -07:00
Trang Le
2065c5bdfd Add changeset for triple click fix (#4503)
* Remove changeset for the fix for regression caused by triple click fix

* fix: incorrect Slate range when triple clicking a block (#4455)
2021-09-09 09:46:45 -07:00
Trang Le
f5c0cbd7ec Fix: regression caused by triple click fix (#4498)
* 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>
2021-09-08 17:34:57 +01:00
Dylan Schiemann
3dd74dd58d Update error message for useSlate (#4493)
* Update error message for useSlate

fixes #4479

* Add changeset
2021-09-07 05:00:48 -07:00
JokcyLou
dd752df11d fix cursor not correct when insert multiple nodes using insertNodes (#4482)
* fix cursor not correct when insert multiple nodes using insertNodes

* fix lint

* add changeset
2021-09-07 04:39:47 -07:00
Nemanja Tosic
1b560de3e1 Fix paste to empty node losing structure of first block (#4489) 2021-09-06 12:00:54 -07:00
Kristoffer K
29473b0290 chore: follow-up to Yarn update (#4478)
* fix(site): `require.resolve` webpack loader

* chore: add pnp sdk

* ci: cache dependencies

* ci: add release `version` command
2021-09-02 04:42:45 -07:00
Eric Charles
d338dcc7ce Jest testing for slate-react (#4459)
* 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
2021-09-01 14:25:11 -07:00
I Made Budi Surya Darma
e51566ada8 Add key for Children SelectedContext.Provider (#4480)
* Add key for Children context

* add changeset
2021-08-31 05:22:56 -07:00
Trang Le
2d1aaafa0b Fix(editable component): reselect the range created by triple click (#4455)
* 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
2021-08-28 05:02:30 -07:00
Bryan Haakman
8eb1abac87 Migrate yarn to berry v3 (#4417)
* 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>
2021-08-28 04:59:10 -07:00
Per-Kristian Nordnes
c1433f56cf [slate-react]: fix selection bugs when multiple editors share value (#4475)
* [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>
2021-08-25 15:59:23 +02:00
Bryan Haakman
781b7f795c Increase timeout for markdown-shortcuts test for now (#4474) 2021-08-25 06:36:25 -07:00
Bryan Haakman
8a5a50d904 Upgrade cypress to 8.x and next to 10.x (#4469) 2021-08-24 21:41:15 -07:00
Dylan Schiemann
5f6d7b4770 Fix typo in TypeScript concepts documentation (#4468)
Fixed #4467
2021-08-24 21:40:00 -07:00
Ulion
48b7129447 Make onDomSelectionChange triggered after onClick. (#4132)
* Delay onDomSelectionChange but not cause performance issue.

* Add changeset

* Update changeset

Changeset editor via GitHub's UI seems to violate our prettier rules 🤦🏼‍♂️

Co-authored-by: Dylan Schiemann <dylan@dojotoolkit.org>
2021-08-21 17:03:07 -07:00
Dylan Schiemann
3e7ff3bb0d Layout example fix (#4463)
* 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>
2021-08-21 04:32:04 -07:00
Tim
95c759a19c Normalization: Nonempty to empty to inline should remove empty node (#4458)
* Normalization: Nonempty to empty to inline should remove empty node

* Fix lint
2021-08-21 03:55:28 -07:00
Dylan Schiemann
ace397f966 Double character insert regression (#4460)
* fix double character regression

* add changeset
2021-08-19 07:49:17 -07:00
Ind. Puking Rainbows
2fa928103d Proposal for Remove useCallback from walkthroughs documentation (#4091)
* 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>
2021-08-18 15:59:31 -07:00
Githoniel
8e4120ae31 fix: insert new node in advance to avoid ime double input with editor marks (#4451)
* fix: insert new node in advance to avoid ime double input

* chore: add changeset

* refactor: minor refator as review
2021-08-16 04:42:26 -07:00
I Made Budi Surya Darma
d06706c9e1 Read data-slate-fragment when application/x-slate-fragment is missing (#4454)
* fix missing slate-fragment onpaste ion safari

* add changeset
2021-08-13 10:54:58 -07:00
Dylan Schiemann
935b3a79d6 fix: chinese input double in qq browser (#4452)
* fix: chinese input double in qq browser

* add changeset

* update changeset
2021-08-13 04:46:06 -07:00
I Made Budi Surya Darma
834ce3483d fix(android): Fix editors mark is not inserted on insert text in android (#4342)
* 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>
2021-08-13 03:55:27 -07:00
Seiichi Nishikata
220f2d2ce6 Fix invalid cursor when IME converting (#4450) 2021-08-13 03:52:42 -07:00
Jimmy Oliger
0025900349 Add unicode sequences support (#4326)
* Add failing test

* Handle sequences

* Uncomment test cases

* Handle RTL unicode sequences

* Remove esrever

* Add tests

* Use iterator instead of Array.from

* Add changeset

* Rename split to splitByCharacterDistance

* Make reverse optional

* Fix casing

* Fix yarn.lock

* Fix tests

* Remove fast-deep-equal after bad merge
2021-08-13 03:50:52 -07:00
I Made Budi Surya Darma
a1f925bddf fix(android): Get fragment from text/html when application/x-slate-fragment is missing on copy-paste slate fragment in android (#4433)
* 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
2021-08-13 03:44:41 -07:00
Georgy Perepecho
d32ce0f49b fix example paste-html if children are empty (#4446)
Co-authored-by: Georgii Perepecho <georgii.perepecho@revolut.com>
2021-08-12 14:54:01 -07:00
Githoniel
c6203a2d68 fix unwrapNode when split && add in nested block (#3820)
* fix unwrapNode when splite && add in nested block

* Update packages/slate/src/transforms/node.ts

chore: add comment

Co-authored-by: Dylan Schiemann <dylan@dojotoolkit.org>

* chore: prettier fix

* chore: add changeset

* Update packages/slate/src/transforms/node.ts

chore: update comments

Co-authored-by: Dylan Schiemann <dylan@dojotoolkit.org>

Co-authored-by: Dylan Schiemann <dylan@dojotoolkit.org>
2021-08-12 07:04:14 -07:00
Samarjeet
906e5af1b1 Capture element selections through useSelected (#4365)
* Capture element selections (ianstormtaylor#4338)

* Rebase

* Add changeset
2021-08-12 07:03:22 -07:00
Tomas Carnecky
62d1a068be Do not needlessly JSON.stringify() the whole editor (#4411)
* 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>
2021-08-12 06:59:53 -07:00
Samarjeet
3e4d92005a cypress: paste html example test (#4439) 2021-08-12 04:42:53 -07:00
Samarjeet
8f46d686ac cypress: fix flaky code highlight test (#4444)
* cypress: fix flaky code highlight test

* condition spelling fix
2021-08-12 04:34:02 -07:00
Brian Krausz
25afbd4300 Use native character insertion to fix browser/OS text features (#3888)
* 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>
2021-08-11 15:57:10 -07:00
Andrew Herron
55ff8f00e4 Fixed regression in #4208 where normalization on empty block nodes could not be overridden (#4431) 2021-08-11 13:01:44 -07:00
Andrew Herron
6f47cbbe0d Remove fast-deep-equal (#4276)
* 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.
2021-08-11 12:58:25 -07:00
Pulkit Singh
69ee04ac14 Update 02-nodes.md (#4442)
* Update 02-nodes.md

* Update 02-nodes.md
2021-08-11 12:55:41 -07:00
Dylan Schiemann
4cb1837934 Comment out currently flaky integration test (#4441)
* 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
2021-08-11 10:16:23 -07:00
Dylan Schiemann
03ffe4596d Add CoCalc to list of resources (#4437) 2021-08-11 06:28:45 -07:00
Kelly Joseph Price
479a759108 Fix mergeNodes moving node into parent sibling (#4296)
* 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 45a8aab7cb.

Co-authored-by: Dylan Schiemann <dylan@dojotoolkit.org>
2021-08-10 19:07:11 -07:00
dependabot[bot]
4dea740862 build(deps): bump path-parse from 1.0.6 to 1.0.7 (#4435)
Bumps [path-parse](https://github.com/jbgutierrez/path-parse) from 1.0.6 to 1.0.7.
- [Release notes](https://github.com/jbgutierrez/path-parse/releases)
- [Commits](https://github.com/jbgutierrez/path-parse/commits/v1.0.7)

---
updated-dependencies:
- dependency-name: path-parse
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2021-08-11 10:01:30 +10:00
Andrew Herron
b47d3fd191 Don't set null in set_node newProperties when using unsetNodes (#4428) 2021-08-11 07:55:32 +10:00
github-actions[bot]
936070738c Version Packages (#4368)
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
slate@0.65.3 slate-react@0.65.3 slate-history@0.65.3
2021-08-10 10:12:29 -07:00
Benny Zhao
3f69a9f395 Update findDocumentOrShadowRoot to return the root node instead of throwing unnecessarily (#4427)
* 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!
2021-08-10 10:03:41 -07:00
Jake Donham
237edc6ea6 fix decorate bug (#4277) without adding extra layers of render tree (#4421)
* fix #4394 without adding extra layers of render tree

* oops unused import

* Add changeset

Co-authored-by: Dylan Schiemann <dylan@dojotoolkit.org>
2021-08-09 19:59:59 -07:00
Andrew Herron
748bf75005 Remove unused slate-history dependency on immer (#4430) 2021-08-10 11:43:47 +10:00
dependabot[bot]
4f0ba30f0a build(deps-dev): bump prismjs from 1.23.0 to 1.24.0 (#4355)
Bumps [prismjs](https://github.com/PrismJS/prism) from 1.23.0 to 1.24.0.
- [Release notes](https://github.com/PrismJS/prism/releases)
- [Changelog](https://github.com/PrismJS/prism/blob/master/CHANGELOG.md)
- [Commits](https://github.com/PrismJS/prism/compare/v1.23.0...v1.24.0)

---
updated-dependencies:
- dependency-name: prismjs
  dependency-type: direct:development
...

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2021-08-10 11:26:20 +10:00
dependabot[bot]
247372d5e1 build(deps): bump tar from 4.4.13 to 4.4.15 (#4410)
Bumps [tar](https://github.com/npm/node-tar) from 4.4.13 to 4.4.15.
- [Release notes](https://github.com/npm/node-tar/releases)
- [Changelog](https://github.com/npm/node-tar/blob/main/CHANGELOG.md)
- [Commits](https://github.com/npm/node-tar/compare/v4.4.13...v4.4.15)

---
updated-dependencies:
- dependency-name: tar
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2021-08-10 11:25:09 +10:00