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

984 Commits

Author SHA1 Message Date
anatolzak
20d7dd41b7
disabled user select on placeholder (#3701)
* disabled user select on placeholder

* fixed css property value without quotes
2020-05-27 08:46:02 -07:00
Mitchell Busby
26fbc1dc41
Fix scrolling boundary detection (see #3463) (#3678) 2020-05-20 17:32:56 -07:00
Nikolay Martynenko
31709160a3
Fix selection, if click event fired after (#3650) 2020-05-20 17:26:21 -07:00
Matthew Steedman
c1760127f1
Fix Editable onPaste handler not getting called (#3670) 2020-05-20 17:22:39 -07:00
CameronAckermanSEL
aabb9b50bd v0.58.1 2020-05-11 16:31:12 -07:00
CameronAckermanSEL
8737f0411a v0.58.0 2020-05-05 18:50:22 -07:00
Cameron Ackerman
f4ee75d13d
fix issue #3651 where initial click on a void block can cause the editor to crash (#3654)
* fix issue #3651 where initial click on a void block can cause the editor to crash

* simplify non null cast for editor to element weakmap retrieve

* get prettier to shut up

* fixed comment
2020-05-05 10:31:01 -07:00
Nikolay Martynenko
e25c30c7a8
Fixing selection across a void node (i.e. mention or image) with the mouse (#3649)
* Fixing selection across a void node (i.e. mention or image) with the mouse.

* Fixing selection across a void nodes via mouse
2020-05-04 17:49:37 -07:00
CameronAckermanSEL
d82ffe49a5 Revert "Revert "TypeScript Improvement: Use [key: string]: unknown, not [key: string]: any (#3565)""
This reverts commit 81d2f9bb8f6a78590d7868deb289ec36fb208629.
2020-05-04 17:38:14 -07:00
CameronAckermanSEL
036ee664af v0.57.3 2020-05-04 17:36:43 -07:00
CameronAckermanSEL
81d2f9bb8f Revert "TypeScript Improvement: Use [key: string]: unknown, not [key: string]: any (#3565)"
This reverts commit d8adf51add861c81b51e969de704d93a51a8990f.
2020-05-04 17:33:39 -07:00
Tim Buckley
d8adf51add
TypeScript Improvement: Use [key: string]: unknown, not [key: string]: any (#3566)
* Change all [key:string]:any -> unknown

Skipping slate-hyperscript, since it seems to be an appropriate use of key: any

* Minor typo fix docs/api/locations

* Check/assert unknown attributes when needed
2020-05-04 17:16:03 -04:00
Brent Farese
217b84ff1f
Update wrapNodes to use lowest mode and create passing test. (#3579)
* Update wrapNodes to use lowest mode and create passing test.

* Add .idea to .gitignore.

* Restore wrapNodes/inline/inline-across.js test.

Co-authored-by: Brent Farese <brentfarese@gmail.com>
2020-04-30 15:11:35 -07:00
Jamie Talbot
ddef719467
Make setFragmentData and getFragment pluggable in ReactEditor (#3620) 2020-04-27 12:05:28 -07:00
喵喵喵
cc57894f98
fix(unmount): add destroyed flag, prevent apply change when component… (#3553)
* fix(unmount): add destroyed flag, prevent apply change when component has been destroyed.

* style(format): update format

* refactor(unmount): remove destroyed flag, use effect return callback to destroy onchange event

* styles(format): format styles

Co-authored-by: wangchao <wangchao08@kuaishou.com>
2020-04-26 12:19:25 -07:00
David Hrdlicka
67c4b3b330
Prioritize using Selection over Range to preserve direction (#3594)
accout for zero-width nodes
2020-04-25 22:23:52 -07:00
CameronAckermanSEL
4f6ca7bc62 v0.57.2 2020-04-24 16:26:26 -07:00
CameronAckermanSEL
23141c046b Revert "v0.57.2"
This reverts commit f9ec4cfaa852d4aaf937c8347f2adb41e23bc793.
2020-04-08 10:35:45 -07:00
CameronAckermanSEL
f9ec4cfaa8 v0.57.2 2020-04-07 13:19:28 -07:00
Cameron Ackerman
54b9b63f04
fix issue where inline voids can no longer be selected (#3572)
* fix issue where inline voids can no longer be selected by allowing the zero width space to be an editable target

Co-authored-by: damareyoh <chackerman@wsu.edu>
2020-04-07 09:14:57 -07:00
pavlyna
16ff44d056
3536 cover beforeinput behavior on edge legacy browser (#3537)
* 3536 support flat functionality + beforeinput in Edge

* 3536 support flat functionality + beforeinput in Edge

* 3536 remove support for flat functionality

* 3536 added description of regexp

Co-authored-by: Pavlyna Bevz <pavlynabevz@pbevz-mbp.local>
2020-03-11 08:20:30 -07:00
Ryan Mitts
7857a68a2b
Attach the cloned DOM node before coputing its plaintext representation when copying. (#3543)
The cloned dom node constructed when copying must be attached to the dom for getComputedStyle to work.

This adds the div to the body as a hidden element and removes after computing its text representation.
2020-03-09 14:48:37 -07:00
Andreas Geffen Lundahl
f45058ec31
Avoid mutating the selection in Transforms.setPoint (#3541)
Since Immer freezes the selection, we will get a TypeError if we try to mutate
the selection. Also, there's no need to mutate it directly in
Transforms.setPoint.
2020-03-08 20:51:02 -04:00
Cameron Ackerman
a79e11c74e
add tests (#3535) 2020-03-05 09:53:23 -08:00
Ryan Mitts
9504c4472c
Fix inputs from not being able to be used within void nodes in Firefox and Added example of input and other editable void nodes (#3436) 2020-02-25 20:52:11 -08:00
Efim
d8cc9fc46b
fix: check isContentEditable of target element in ReactEditor.hasDOMNode (#3389)
* fix ReactEditor.hasDOMNode

* make ReactEditor.hasDOMNode variables more clear
2020-02-25 20:50:53 -08:00
Sunny Hirai
bd52b9d080
Use lodash throttle instead of debounce for updating selection change (#3355)
* Add lodash

* Switched debounce to lodash/throttle

* Updated yarn.lock
2020-02-22 09:08:22 -08:00
Ken Aoki
1f11276ebd
Don't use stale readOnly prop. (Fix bug #3321) (#3388) 2020-02-22 08:36:09 -08:00
Marcin Grzywaczewski
83b1319c63
Fix Paste without Formatting / Paste and Match Style producing uneditable text nodes. (#3415)
* handle plaintext-only pastes using onPaste handler, regardless of browser

* remove extra console.log; merge code paths in onPaste - they contain the same code
2020-02-22 07:57:50 -08:00
Tyler Hallada
de9d0a3912
Fix pasting plain text with newlines (#3472)
Fixes https://github.com/ianstormtaylor/slate/issues/1681
2020-02-21 08:35:24 -08:00
Oguz Gelal
e2dd13c24d
Fix test folders name swap for interfaces/Editor/nodes mode-highest vs. mode-all (#3484) 2020-02-20 16:27:13 -08:00
Andreas Geffen Lundahl
eb181f3279
Allow zero as offset on <anchor> and <focus> inside <selection> (#3491)
* Allow zero as offset on <anchor> and <focus> inside <selection>

When creating a selection using the <selection> hyperscript tag, you couldn't
set zero as offset on <anchor> and <focus>, because of a faulty falsiness
check. This is fixed by checking if the offset is falsy and explicitly not zero.

* Make sure offset can't be null or undefined on <anchor> and <focus>

Throw exception when offset is strictly null or undefined, on <anchor> and
<focus> when creating a <selection>.
2020-02-20 16:00:59 -05:00
Tyler Hallada
d341cb1592 Fix links in slate-react readme (#3428)
Fixed the "Plugins" link and changed the "Constants" link (a folder which no longer exists) to a "Hooks" link.
2020-01-27 15:23:13 -05:00
Ian Storm Taylor
22d9095c39 v0.57.1 2019-12-20 12:39:32 -05:00
Ziad Beyens
101661ee27 fix: Slate editor props (#3359)
* fix: Slate editor props

 TS2322: Type 'Editor' is not assignable to type 'ReactEditor'.

* revert

* generic type

* generic type

* generic type

* extends Editor

* extends Editor

* infer

* infer
2019-12-20 12:17:00 -05:00
Johan Sörlin
5418e260d4 moved getLeaves from react to slate core package and added some basic tests (#3358) 2019-12-19 11:51:44 -05:00
Corentin.Andre
e54b07eba8 fix: undoing and redoing are switched (#3363) 2019-12-19 11:50:32 -05:00
Ian Storm Taylor
922d03e006 v0.57.0 2019-12-18 16:04:05 -05:00
Ian Storm Taylor
0bbe121d76
Remove commands (#3351)
* remove commands in favor of editor-level functions

* update examples

* fix lint
2019-12-18 15:00:42 -05:00
Ian Storm Taylor
c2d7905e19 v0.56.1 2019-12-18 14:59:46 -05:00
Christopher Biscardi
af7a7e7c45 deletebackward -> deleteforward (#3346) 2019-12-18 11:15:59 -05:00
cvlmtg
0b7644e975 fix onBeforeInput memoization (#3347)
* fix memoization of onBeforeInput callback

* fix lint

* fix callbacks dependencies
2019-12-18 11:15:17 -05:00
Ian Storm Taylor
d765cbc3a8 v0.56.0 2019-12-17 23:03:12 -05:00
Ian Storm Taylor
28b5217370
split format_text into two commands (#3340)
* split format_text into two commands

* fix lint
2019-12-17 22:17:33 -05:00
Ian Storm Taylor
235a578967
rename Node.text to Node.string (#3341) 2019-12-17 22:17:21 -05:00
Ian Storm Taylor
6f98363566 v0.55.3 2019-12-16 16:36:55 -05:00
Ian Storm Taylor
c77e1233d4 remove unused deps, fix peerDependencies 2019-12-16 16:32:44 -05:00
Ian Storm Taylor
72b4bf11db v0.55.2 2019-12-16 16:20:19 -05:00
Rinoc Johnson
63a94a23c7 Fix emoji offsets (#3310)
* Fix emoji offsets

* Fix linting

* Remove the unused `forward` argument

* Fix linting

* Code review

* Fix linting

* Add newline to end of file
2019-12-16 16:12:27 -05:00
Ian Storm Taylor
1f367a25fa v0.55.1 2019-12-16 16:05:01 -05:00