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

664 Commits

Author SHA1 Message Date
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
Julian Krispel-Samsel
ea2eefefb8 Add renderPlaceholder (#4190) 2021-04-23 21:22:11 +01:00
kamilkazmierczak
6a1376332b Make HAS_BEFORE_INPUT_SUPPORT flag more generic. (#4118)
* Change "HAS_BEFORE_INPUT_SUPPORT" flag to more generic.

* Fix patterns and styles issues.

* Fix lint issues.

* Create dirty-rabbits-speak.md

* Update dirty-rabbits-speak.md

* Update editable.tsx

Co-authored-by: Ian Storm Taylor <ian@ianstormtaylor.com>
2021-04-13 11:20:09 -04:00
Githoniel
ea6dc08913 fix ime double input with mark (#4158)
* fix ime double when apply mark

* add changeset

* refactor to use auto-incrementing key and add comments for it

* Update lovely-walls-knock.md

* Update lovely-walls-knock.md

Co-authored-by: Ian Storm Taylor <ian@ianstormtaylor.com>
2021-04-13 10:59:07 -04:00
Githoniel
de5cc7e5ed feat: sync selection to extactly matched DOM selection (#4157)
* feat: sync selection to extractly dom selection

* revert mistakenly modified files

* add changeset

* toSlatePoint will throw error again when not extractMatch

* Fix misspellings, rename extractMatch to exactMatch

* rename option to match code style

* Update four-poets-move.md

Co-authored-by: Ian Storm Taylor <ian@ianstormtaylor.com>
2021-04-13 10:58:46 -04:00
Ian Storm Taylor
c5d412f5c6 add lint-staged for auto-formatting commits 2021-04-01 01:41:07 -04:00
github-actions[bot]
f76ff2a276 v0.62.0 (#4156)
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2021-04-01 01:38:28 -04:00
Ian Storm Taylor
d288842aee fix typescript errors 2021-04-01 00:43:24 -04:00
Ulion
8a2a60b052 Fix normalizeDOMPoint to do better job. (#4048) 2021-03-31 22:06:30 -04:00
Ian Storm Taylor
00393bb185 port long placeholder pr to master 2021-03-31 22:04:30 -04:00
Ian Storm Taylor
b15fba61f8 port re-rendering on focus pr to master 2021-03-31 22:02:41 -04:00
Ulion
39e47dc518 Decorate re-render optimize to not re-render all elements. (#4138)
* Decorate re-render optimize to not re-render all elements.

* Move provider one level up due to Children no longer component.

* lint fix
2021-03-31 21:24:07 -04:00
dchikulaev
7a9b4c5787 Fixed converting querySelectorAll results to array (#4099)
for Babel loose mode.
2021-03-31 20:26:38 -04:00
cvlmtg
469e6b26f5 fix onPaste handler on Chrome / Safari (#3396)
* fix onDOMBeforeInput callback definition

* fix onPaste on chrome / safari

* improve comment

* Update editable.tsx

* Create real-suns-matter.md

Co-authored-by: Ian Storm Taylor <ian@ianstormtaylor.com>
2021-03-31 18:34:04 -04:00
Mikel Canovas
7fe41f1566 Fix error when trying to grab selection of a void node while read only (#3894)
* fix(react-editor): text node spacer can be non-existant if editor is in readonly mode

* v0.59.1

* Revert "v0.59.1"

This reverts commit 58cb7f1d61.

* Update react-editor.ts

* Update react-editor.ts

* Create rude-lemons-crash.md

Co-authored-by: Ian Storm Taylor <ian@ianstormtaylor.com>
2021-03-31 18:33:28 -04:00
Ulion
b64fbd06d3 Fix move_node caused full re-render. (#4120) 2021-03-31 18:25:09 -04:00
nivekithan
bbd7d9c330 replace IS_FIREFOX with IS_FIREFOX_LEGACY in HAS_BEFORE_INPUT_SUPPORT (#4150)
* replace IS_FIREFOX with IS_FIREFOX_LEGACY in HAS_BEFORE_INPUT_SUPPORT

* fix linting errors

* Create afraid-donuts-flow.md

* Update environment.ts

Co-authored-by: Ian Storm Taylor <ian@ianstormtaylor.com>
2021-03-31 18:09:46 -04:00
Jack Hanford
165ac3c695 disable spellCheck, autoCorrect, autoCapitalize when browser doesnt HAS_BEFORE_INPUT_SUPPORT (#3946) 2021-03-31 18:05:33 -04:00
Ulion
286f4b2f55 Fix toSlatePoint wrong offset for void element. (#4057) 2021-03-31 17:59:34 -04:00
Krzysztof Mędrzycki
9fce1066ba Collapse selection according to reverse (#3799)
* Rename test slate transforms delete unit-character inline-before to inline-afte

* Add missing tests for Transforms.delete, symmetric to existing tests with respect to options.reverse

* In Transforms.delete collapse selection according to options.reverse

* Add directionality to Editor#deleteFragment
2021-03-31 17:38:02 -04:00
Githoniel
5b24c86547 fix: cut will remove void element when only select void element (#4107) 2021-03-31 17:19:25 -04:00
pubuzhixing8
bf83f333e6 fix DOM selection can not be updated when use composition input on Safari #3196 (#3698)
* fix DOM selection can not be updated when use composition input on Safari #3196

* Update editable.tsx

* Create dry-deers-applaud.md

Co-authored-by: Ian Storm Taylor <ian@ianstormtaylor.com>
2021-03-31 17:06:31 -04:00
Josias
a95ec9249d Correct onDOMBeforeInput typings (#3549)
TS will report an error when trying to access event.inputType since it was declared of type "Event" and not "InputEvent".
2021-03-31 16:45:20 -04:00
Ken Aoki
3cc9effdd1 Fix IME input bug (#3292) (#3342)
* Fix IME input bug (#3292)

* Changed delete_fragment according to #3351
2021-03-31 16:33:40 -04:00
Mateusz Burzyński
f3fb40cce0 Fixed an issue with controlled value messing up editor.selection (#3652)
* Fixed an issue with controlled value messing up editor.selection

* Create fifty-ducks-sip.md

Co-authored-by: Ian Storm Taylor <ian@ianstormtaylor.com>
2021-03-31 16:13:42 -04:00
Samu
d5b2d7f55e add guard checks for value and editor in <Slate /> (#3326)
* add guard checks for value and editor in <Slate />

* adding tiny-invariant to slate-react; refactoring errors

* import Editor for guard check

* Create fuzzy-yaks-drive.md

Co-authored-by: Cameron Ackerman <cameron_ackerman@selinc.com>
Co-authored-by: Ian Storm Taylor <ian@ianstormtaylor.com>
2021-03-31 16:13:28 -04:00
Sophia Saiada
12988060ff Fix cursor movement in RTL elements (#2963) (#3727)
* Fix cursor movement in RTL elements (#2963)

* Fix cursor movement in RTL elements even when jumping between whole words (using option + arrow key) (#2963)
2021-03-31 16:13:07 -04:00
gyh9457
459e826d58 fix: IME repeat input (#3768) 2021-03-31 16:00:37 -04:00
oyzhen
efce5373fd Aligning DOM checking condition to what facebook/react does (#4114)
* feat: add Deno SSR support

* fix: check if DOM available as React does

Co-authored-by: oyzhen <oyzhen@vip.qq.com>
2021-03-31 15:59:17 -04:00
Austin Green
4dd8b98f7f feat: delete current line when deleting backward with line unit (#3364)
* feat: delete current line when deleting backward with line unit

* Apply BrentFarase suggestions from code review

Co-authored-by: Brent Farese <25846953+BrentFarese@users.noreply.github.com>

* Update prettier formats and rebase on master

Co-authored-by: Brent Farese <25846953+BrentFarese@users.noreply.github.com>
2021-03-31 15:55:44 -04:00
Tomás González
f8be509e4d fix: autoscroll when block is bigger than viewport (#3746)
* fix: autoscroll when block is bigger than viewport

* Create lazy-trains-sell.md

* Update lazy-trains-sell.md

* Update lazy-trains-sell.md

Co-authored-by: Tomás González <tgonzalez@asapp.com>
Co-authored-by: Ian Storm Taylor <ian@ianstormtaylor.com>
2021-03-31 15:50:54 -04:00
David Ruisinger
0473d0bf93 Use shadow dom if available (#3749)
* getDirtyPaths can now be customized by Slate users (#4012)

* Moved getDirtyPaths() into the editor object so it can be customized via plugin

* docs: Update document in Chinese (#4017)

Co-authored-by: liuchengshuai001 <liuchengshuai001@ke.com>

* Removed unused import

* Use shadowRoot if available

* Removed optional chaining

* Added workaround for chrom bug in ShadowDOM

* Added shadow DOM example

* Add a shadow DOM example

Shadow DOM brings different behaviours for selection and active
elements. This adds an example where the editor is found within a shadow
DOM, in fact, the editor is two levels deep in nested shadow DOMs.

The handling of selections means that this editor doesn't work properly
so Slate will need to be made aware of the shadow DOM in order to fix
this.

* User DocumentOrShadowRoot for selection and active elements

If the editor is within a ShadowDom, the selections and active element
APIs are implemented on the ShadowRoot for Chrome. Other browsers still
use the Document's version of these APIs for the shadow DOM.

Instead of defaulting to `window.document`, find the appropriate root to
use for the editor in question.

* Add compatibility for Chrome's isCollapsed bug

Chrome will always return true for isCollapsed on a selection from the
shadow DOM. Work around this by instead computing this property on
Chrome.

https://bugs.chromium.org/p/chromium/issues/detail?id=447523

* Removed duplicated example

* Fixed possible null value

* Use existing PlainTextExample

* Re-added local Editor to have clear initialValue

* Optimize shadowRoot checkup

* Remove getDocumentOrShadowRoot util in favor of findDocumentOrShadowRoot

* Re-added getDocumentOrShadowRoot

* Put selectionchange listener on window.document

* Resetted changes from main branch

* Create tiny-walls-deliver.md

* Update tiny-walls-deliver.md

* Update tiny-walls-deliver.md

Co-authored-by: Tommy Dong <contact@tomdong.io>
Co-authored-by: Jacob <40483898+jacob-lcs@users.noreply.github.com>
Co-authored-by: liuchengshuai001 <liuchengshuai001@ke.com>
Co-authored-by: Andrew Scull <andrew.scull@live.com>
Co-authored-by: Ian Storm Taylor <ian@ianstormtaylor.com>
2021-03-31 15:47:28 -04:00
Ryan Mitts
0c2f52976a Updating memoization checks on element, leaf, and text components. (#3437)
The element, text, and leaf components do not properly check the decorator list and make sure the properties in
addition to the anchor/focus are the same.

In addition, the renderLeaf function cannot be memoized because the leaf component does not compare the actual
text values within the leafs.
2021-03-31 15:18:49 -04:00
Sunny Hirai
2ca10c7f95 Use children (#4152)
* useChildren

* path fix

* Revert .github files

* Revert .github files to earlier version

Co-authored-by: Radim Malota <radim.malota@suitu.cz>
2021-03-30 21:52:46 -07:00
Sunny Hirai
7b6c986661 v0.61.3 2021-03-30 16:32:04 -07:00
Ian Storm Taylor
476f1e195c delete extra changelog cruft 2021-03-30 01:41:42 -04:00
Automation
5fa8fb3471 v0.61.2 2021-03-30 01:03:00 +00:00
Automation
4ec2dc9d5c v0.61.1 2021-03-29 22:39:50 +00:00
Sunny Hirai
b5cb9ee6db v0.61.0 2021-03-29 08:50:06 -07:00
Sunny Hirai
c2bc4f6444 v0.60.17 2021-03-29 01:15:14 -07:00
Sunny Hirai
ad7abdad7a v0.60.16 2021-03-29 01:09:18 -07:00
Sunny Hirai
cf42529704 Fix linting 2021-03-29 01:06:51 -07:00
Sunny Hirai
0434182166 Added comments to with-history and with-react to help fix TypeScript errors 2021-03-29 01:01:25 -07:00
Sunny Hirai
cd13b4c7de v0.60.15 2021-03-20 21:11:18 -07:00
Sunny Hirai
3caf0e1849 Allow useSlate and useSlateStatic to use a generic to return a Custom Editor (#4135)
* Have useSlate and useSlateStatic return the Custom Editor

* v0.60.12

* Add generic to useSlate and useSlateStatic

* v0.60.13

* Fix useSlate and useSlateStatic to return customized Editor type

* v0.60.14
2021-03-20 20:49:58 -07:00
Sunny Hirai
b0c27496ec v0.60.11 2021-03-20 13:50:24 -07:00
Sunny Hirai
5be428a0b3 Enable Extending Editor types in TypeScript (#4133)
* Change HistoryEditor from type to interface

* v0.60.8

* v0.60.9

* Have ReactEditor and HistoryEditor extend BaseEditor instead of Editor

* v0.60.10
2021-03-20 13:47:33 -07:00
Sunny Hirai
a72958e6c3 Improved Types (#4119)
* Experimental release to see if CustomTypes holds up through a publish

* Add experimental release script

* Fix lint

* v0.60.5-alpha.0

* Allow null properties in setNodes

* v0.60.6-alpha.0

* Revert null properties on Transforms.setNodes

* v0.60.7-alpha.0

* Update examples to use custom Element and Text with discriminated unions

* Add documentation for using TypeScript improvements

* Be explicit about typescript version in package.json

* Force lerna bootstrap to fix build issues on CI and fix a few type examples

* Add slate devDependencies with * back

* v0.60.7

* Switch to a non prerelease version to fix lerna not linking in root

* Add documentation for not using prerelease versions and on how to create experimental releases

* Try removing lerna bootstrap and see if it works
2021-03-11 11:48:31 -08:00