1
0
mirror of https://github.com/ianstormtaylor/slate.git synced 2025-08-08 08:16:30 +02:00
Commit Graph

424 Commits

Author SHA1 Message Date
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
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
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
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
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>
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
I Made Budi Surya Darma
236754c4d2 feature(slate): Add isElementType utility function to Element Interface (#4349) 2021-08-09 10:55:45 -04:00
Dylan Schiemann
e0776c5c92 Allow setFragmentData without clipboardData object (#4333)
* allow setFragmentData to be used without a copy/paste or DnD data structure

* Add changeset

* return data for use outside of setFragmentData call
2021-08-06 07:43:42 -07:00
Ulion
6c84422721 Fix ios chrome ime double input issue. (#4049)
* Fix ios chrome ime double input issue.

* add changeset

* pretty fix.

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

Thanks @ulion!
2021-08-05 20:58:46 -07:00
Sihong
4b373dc290 fix: hide placeholder when composing (#4352) 2021-08-05 11:05:42 -07:00
gyh9457
bde6e80476 fix(slate-react): use Text.equals to compare leaf (#4175)
* fix(slate-react): use Text.equals to compare leaf

* refactor(slate-react): simplify MenoizedLeaf logic

* Create breezy-lizards-travel.md

* Update packages/slate-react/src/components/leaf.tsx

Co-authored-by: Ian Storm Taylor <ian@ianstormtaylor.com>
Co-authored-by: Dylan Schiemann <dylan@dojotoolkit.org>
2021-08-05 10:42:41 -07:00
liangxiwei
13b3f9c783 Do not remove empty node in merge operation if it is first children i… (#4287)
* Do not remove empty node in merge operation if it is first children in parent(#4228)

* Create merge-nodes-issue

* fix typo in changeset

Co-authored-by: Dylan Schiemann <dylan@dojotoolkit.org>
2021-08-05 10:38:31 -07:00
Jake Donham
0188980796 fix bug: decorate is not called for immediate children of editor (#4394)
* fix bug: decorate is not called for immediate children of editor

* short-circuit return instead of else in Child

Co-authored-by: Tim Buckley <timothypbuckley@gmail.com>

* oops missing brace

* changeset

Co-authored-by: Tim Buckley <timothypbuckley@gmail.com>
2021-08-05 13:22:48 -04:00
Andrew Herron
0214b63077 Skip wrapping nodes when the only match is an editor (#4253)
* Skip wrapping nodes when the only match is an editor

* Check for empty path instead of using isEditor
2021-08-05 10:12:53 -07:00
Sunny Hirai
c217dbb5b9 Fix scroll into view to scroll parent scrollables (#4369) 2021-07-09 15:12:13 -07:00
Krzysztof Mędrzycki
46c8871c9c Re-render leaf when new properties were added to it (#4347) 2021-07-09 08:52:06 -07:00
github-actions[bot]
ea5e3e4ebf Version Packages (#4332)
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2021-06-09 12:04:11 -04:00
Szymon Wiszczuk
a3bc97af3e Fix deletion of selected inline void nodes in Safari (#4331)
Co-authored-by: Claudéric Demers <clauderic.d@gmail.com>
2021-06-09 11:54:41 -04:00
github-actions[bot]
6c993523ca Version Packages (#4325)
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2021-06-09 11:07:27 -04:00
Claudéric Demers
61171a2382 Fix backward typing bug in Safari by ensuring the selection is removed on blur (#4324)
Safari doesn't always remove the selection, even if the contenteditable element no longer has focus. In this scenario, we need to forcefully remove the selection on blur https://stackoverflow.com/questions/12353247/force-contenteditable-div-to-stop-accepting-input-after-it-loses-focus-under-web
2021-06-07 15:25:48 -04:00
github-actions[bot]
dbf9962af1 Version Packages (#4273)
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2021-06-01 15:08:20 -04:00
Andrew Herron
411e5a193b Don't import slate-history in slate-react (#4266) 2021-06-01 14:22:54 -04:00
Claudéric Demers
a7e3a18187 Fix deletion in Chrome when inline void node is selected (#4307) 2021-06-01 14:11:05 -04:00
georgberecz
2c17e2b7f9 Allow control of Slate's event handler execution in custom event handler API (#4299)
Co-authored-by: Georg Berecz <gberecz@palantir.com>
Co-authored-by: Claudéric Demers <clauderic.d@gmail.com>
2021-06-01 10:26:08 -04:00
Nicolas DUBIEN
dfc039601f Fix warnings related to autoCorrect and autoCapitalize (#4295)
Related to https://github.com/ianstormtaylor/slate/issues/4248
2021-05-26 22:27:41 -04:00
Omer Gurarslan
ff267767f6 chore(slate-react) typo - rename extractMatch to exactMatch (#4271)
* Fix typo - rename extractMatch to exactMatch

* update changelog

* update changelog
2021-05-20 17:21:38 +01:00
Claudéric Demers
294d5120ae Fix errors accessing globalThis in browsers that do not implement it (#4272) 2021-05-20 11:49:29 -04:00
github-actions[bot]
7632d4d0e5 Version Packages (#4259)
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2021-05-14 15:35:42 -04:00
Claudéric Demers
4f0d1120d4 (Re)-Introduce Android support via a MutationObserver based reconciliation layer
* Revert "Temporarily revert Android commits in order to create a release of Slate focused solely on Android (#4256)"

This reverts commit 4f50211984. 

* Updates to android composition manager

* Add user input tracking

It's necessary to only track mutations that result from user input. Some mutations that happen inside block or leaf nodes can happen outside of the render loop of the Editable component.
2021-05-14 15:25:52 -04:00
github-actions[bot]
39b0254867 Version Packages (#4243)
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2021-05-12 21:29:31 -04:00
Claudéric Demers
4f50211984 Temporarily revert Android commits in order to create a release of Slate focused solely on Android (#4256)
* Revert "Add DefaultEditable and AndroidEditable to exports (#4255)"

This reverts commit 5298e51f6e.

* Revert "Feature/android keyboard support (#4200)"

This reverts commit e03ce7c561.
2021-05-12 21:24:57 -04:00
Wayne Leroux
e03ce7c561 Feature/android keyboard support (#4200)
* Added Android Keyboard Support

* Added changeset for android keyboard support

* Removed dead code in android editable that supported non-android environments

* Removed unnecessary attributes observation for android-editable

* Removed dead code

* Added no-error boundary

* Fixed issues with linters
2021-05-12 16:30:39 -07:00
Jonas Kruckenberg
b33a531bd0 replace lodash depency in slate (#4245)
* replace lodash/omit with custom fn

* replace lodash/isEqual with fast-deep-equal
2021-05-13 06:45:45 +10:00
Ulion
e6413d4625 Fix addMark/removeMark caused unexpected onChange. (#4227)
* Fix addMark/removeMark caused unexpected onChange.

* Create three-parrots-remember.md

Co-authored-by: Ian Storm Taylor <ian@ianstormtaylor.com>
2021-05-05 20:30:17 -04:00
Dylan Schiemann
623960a7d1 Update IS_FIREFOX_LEGACY flag to prevent FF crash (#4237)
* Update IS_FIREFOX_LEGACY flag to prevent FF crash

#4118 and #4150 introduced IS_FIREFOX_LEGACY, but this block of code was not updated to reflect that. This breaks insertion of emoji and unicode characters in slate-react. This change fixes #3855.

* Update editable.tsx

* Create forty-mails-roll.md

* Update editable.tsx

Apologies, in my tests I was using yarn patch and didn't need to modify the import statement, hopefully this will pass CI now.

Co-authored-by: Ian Storm Taylor <ian@ianstormtaylor.com>
2021-05-05 19:56:10 -04:00
Andrew Herron
feb293aaa2 Apply no-children normalization fix before normalization (#4208)
* Test cases for failure condition

* Before normalizing ensure all elements have at least one text child. This is a normalization requirement that some normalization fixes require, so it must be done as an initial dedicated pass.
2021-05-05 19:39:37 -04:00
Andrew Herron
796389c7d3 Added insert_node path checking to match how other operations are applied (#4230)
* Added try/finally to editor.apply and Editor.withoutNormalizing for state cleanup

* Added insert_node path checking to match how other operations are applied
2021-05-05 19:31:13 -04:00
Claudéric Demers
c14e1fbc77 Fix duplicated content and other bugs related to drag and drop handling (#4238)
* Fix drag and drop logic

* Add changeset
2021-05-05 19:26:43 -04:00
github-actions[bot]
f2d110100b Version Packages (#4198)
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2021-05-05 19:10:11 -04:00
Claudéric Demers
1c32b97d23 Collapse expanded selection before move word (#4211) 2021-05-03 15:29:27 -04:00
Julian Krispel-Samsel
737aaa9cde Fix iframe crash (#4219)
* fixes #4170

* add smoke test for iframe example

* add changeset

* update changeset wording
2021-04-26 14:47:12 +01:00