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

3369 Commits

Author SHA1 Message Date
Ian Storm Taylor
b15fba61f8 port re-rendering on focus pr to master 2021-03-31 22:02:41 -04:00
Ian Storm Taylor
df23ed7aa7 port update to serialization pr to master 2021-03-31 22:00:33 -04:00
Ian Storm Taylor
7723935b68 port remove link button pr to master 2021-03-31 21:59:57 -04:00
Ian Storm Taylor
c60020244b update changesets 2021-03-31 21:55:10 -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 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
Johan Sörlin
e344f47f03
added support for deleting selection properties by setting them to null (#4109)
added tests for setting and deleting custom selection props
2021-03-31 18:32:51 -04:00
Claudéric Demers
1b77385848
Fix deletion of hanging range with trailing void block node (#4125)
Only unhang the range if the end of the range doesn't match the end of the document.
2021-03-31 18:30:45 -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
kenzobanaag
2db9a36f93
Added isImageUrl validation to button, added alert when not image (#3933)
* Added isImageUrl validation to button, added alert when not image

* Fixed lint error
2021-03-31 18:03:36 -04:00
Kiko Estrada
b57422b0e6
Docs: Optimize image sizes (#4045)
* [ImgBot] Optimize images

*Total -- 753.66kb -> 550.59kb (26.94%)

/docs/images/glossary/anchor-point.gif -- 193.91kb -> 31.38kb (83.82%)
/docs/images/logo.png -- 2.95kb -> 2.50kb (15.31%)
/docs/images/icon.png -- 1.04kb -> 0.91kb (12.7%)
/docs/images/banner.png -- 3.95kb -> 3.48kb (11.76%)
/docs/images/jsfiddle.png -- 139.22kb -> 124.94kb (10.25%)
/docs/images/slack.png -- 251.73kb -> 232.76kb (7.53%)
/docs/images/preview.png -- 72.85kb -> 69.25kb (4.95%)
/docs/images/glossary/focus-point.gif -- 27.86kb -> 26.82kb (3.74%)
/docs/images/glossary/collapsed.gif -- 60.15kb -> 58.54kb (2.67%)

Signed-off-by: ImgBotApp <ImgBotHelp@gmail.com>

* Docs: Fix example code links

Replaced old .js links with current .tsx format

Co-authored-by: ImgBotApp <ImgBotHelp@gmail.com>
2021-03-31 18:01:10 -04:00
Ulion
286f4b2f55
Fix toSlatePoint wrong offset for void element. (#4057) 2021-03-31 17:59:34 -04:00
Krzysztof Mędrzycki
b7a56276b2
Normalize moved node (#3851) 2021-03-31 17:49:09 -04:00
Githoniel
aafee36834
fix: mergeNodes by point would delete nested multi-child node (#3825) 2021-03-31 17:41:14 -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
Luke Murray
e2576108a6
Add voids to the interface definition of positions (#4062)
* Add voids to the interface definition of positions

* Update editor.ts
2021-03-31 17:35:42 -04:00
Ian Storm Taylor
d12413fff9 add v0.59 chinese docs translation, fixes #3985 2021-03-31 17:23:56 -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
Yangyang Li
6799dfd228
fix typo (#3890) 2021-03-31 16:49:06 -04:00
Isaac Schultz
2a9ceee03c
using js-to-ts converter on JSX. (#3906)
Added 'include' parameter to tsconfig to tell the compiler to only look inside the src directory
2021-03-31 16:48:09 -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
Tim Buckley
e4e48b9fa7
Text.equals now works with more nested Text nodes, and non-primitive attributes. (#3532)
* Use lodash.isEqual to compare text nodes

The key improvement here is that this allows Text nodes to have more complex attributes like objects. The previous behavior failed to find equivalent object properties as equal due to JS's !== reference check.

* Install lodash in slate's pkgjson
2021-03-31 16:44:26 -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
cvlmtg
f4668d51bd
remove duplicated code (#3395)
* remove duplicated code

* remove now useless import
2021-03-31 16:04:11 -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
Mateusz Burzyński
42d99af6fa
Do not store focus/blur in history (#3616) 2021-03-31 15:46:53 -04:00
Ian Storm Taylor
c20855ff52 update chinese translation docs, fixes #3399 2021-03-31 15:26:33 -04:00
Mitchell Hamilton
1256e1c6aa
Memoize Node.isNodeList and Editor.isEditor (#4072)
* Memoize Node.isNodeList

* Memoize Editor.isEditor
2021-03-31 15:21:59 -04:00
Johan Sörlin
e46779dbd9
Fix for Editor.positions not working correctly in all cases (#4073)
* fixed bug with Editor.positions slicing beyond the available characters in the current text node

* fixed issues with line and word Editor.positions on fragmented text

* renamed some of the tests and added some more
2021-03-31 15:21:05 -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
Ian Storm Taylor
4ca9591015 fix portals in ssr, fixes #3525 2021-03-31 15:14:54 -04:00
Ian Storm Taylor
a21b6739e3 update changsets changelog config 2021-03-31 15:07:23 -04:00
Silviu Bogan
b4641d1486
Small correction to docs concepts/06-editor.md (#4047) 2021-03-31 14:46:00 -04:00
Ian Storm Taylor
21943ff96a fix readme lint 2021-03-31 14:45:22 -04:00
dependabot[bot]
eb10ddf10b
Bump prismjs from 1.21.0 to 1.23.0 (#4106)
Bumps [prismjs](https://github.com/PrismJS/prism) from 1.21.0 to 1.23.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.21.0...v1.23.0)

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

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2021-03-31 14:41:58 -04:00
dependabot[bot]
f49d6a3c7f
Bump y18n from 4.0.0 to 4.0.1 (#4147)
Bumps [y18n](https://github.com/yargs/y18n) from 4.0.0 to 4.0.1.
- [Release notes](https://github.com/yargs/y18n/releases)
- [Changelog](https://github.com/yargs/y18n/blob/master/CHANGELOG.md)
- [Commits](https://github.com/yargs/y18n/commits)

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

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2021-03-31 14:41:51 -04:00
Ryan Wu
639904ae02
Fixed example links (#3869)
replace .js with .tsx
2021-03-31 14:33:18 -04:00
Naresh Bhatia
b169211c64
docs: add react-force/slate-editor to the list of pre-packaged editors (#3876) 2021-03-31 14:32:48 -04:00