1
0
mirror of https://github.com/ianstormtaylor/slate.git synced 2025-02-24 09:13:24 +01:00

22 Commits

Author SHA1 Message Date
Ian Storm Taylor
d79267c144
Update silent-bees-sing.md 2021-04-13 11:17:02 -04:00
Ridham Bhat
95f402c594
Correcting the splitting logic in setNodes (#4168)
* Defined conditions to always split nodes

Those conditions are:
- When the anchor does not lie at the start of a node.
- When the focus does not lie at the end of a node.

* prev variable now points to correct updated node.

Previously, in the case the previous node gets merged in last iteration,
prev pointer could be pointing to the wrong node.
That posed problems, especially when normalizing empty text nodes.
So, now in every iteration, we get a copy of updated node structure,
and take value of prev from that.

* Test to check splitting and normalization logic.

- In this, since anchor and focus bleeds on both sides, splits happen.
- Empty text nodes are introduced on either side.
- New properties are set in the new node selection.
- Normalization happens and takes care of those empty text nodes.

* Create two-lies-appear.md

* Update two-lies-appear.md

Co-authored-by: Ian Storm Taylor <ian@ianstormtaylor.com>
2021-04-13 11:15:47 -04:00
Bjørn Stabell
fd70dc0b2c
Save some remove_text calls if the text is zero length (#4193)
* Save some remove_text calls if the text is zero length.

* Remove unnecessary !text check - text is always string, and add similar check to 'insert_text' as well

* Create giant-adults-matter.md

Co-authored-by: Ian Storm Taylor <ian@ianstormtaylor.com>
2021-04-13 11:14:30 -04:00
Andrew Herron
2dad21d1d7
set_node operations did not invert correctly after serialization (#4078)
* Use null instead of undefined as the old value for set_node operations that add a property

* Changelog

* Omit undefined values from `set_node` operations completely. Delete missing property values in `Transforms.apply()` instead.

* Add tests for removing set_node properties with null and undefined
2021-04-13 11:06:07 -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
4eec49de16 rename master to main 2021-04-01 13:40:25 -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
d5e27bedbd try updating changesets config 2021-03-31 22:36:02 -04:00
Ian Storm Taylor
d5589279e8 add changesets 2021-03-31 22:07:22 -04:00
Ian Storm Taylor
c60020244b update changesets 2021-03-31 21:55:10 -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 58cb7f1d61e81788e0257bace9be59bc47be8851.

* 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
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
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
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
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
Ian Storm Taylor
a21b6739e3 update changsets changelog config 2021-03-31 15:07:23 -04:00
Ian Storm Taylor
914e085be2 add github changelog to changesets 2021-03-31 13:56:28 -04:00
Ian Storm Taylor
7283c51feb
Add changesets (#4154)
* add first changesets integration

* remove readme

* readd readme

* update auto-release workflow logic

* update auto-release script order, fix prettier

* change access to public

* update release script

* try to fix changesets

* add experimental snapshot version config

* try fixing

* remove excess

* switch auto-release branch to master

* add release pull request workflow

* add changeset todo to pr template

* update changeset
2021-03-31 13:14:40 -04:00