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

1079 Commits

Author SHA1 Message Date
CameronAckermanSEL
8737f0411a v0.58.0 2020-05-05 18:50:22 -07:00
Cameron Ackerman
f4ee75d13d
fix issue where initial click on a void block can cause the editor to crash ()
* fix issue  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 ()
* 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 ()""
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 ()"
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 ()
* 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. ()
* 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 () 2020-04-27 12:05:28 -07:00
喵喵喵
cc57894f98
fix(unmount): add destroyed flag, prevent apply change when component… ()
* 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 ()
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 ()
* 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 ()
* 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. ()
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 ()
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 () 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 () 2020-02-25 20:52:11 -08:00
Efim
d8cc9fc46b
fix: check isContentEditable of target element in ReactEditor.hasDOMNode ()
* 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 ()
* 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 ) () 2020-02-22 08:36:09 -08:00
Marcin Grzywaczewski
83b1319c63
Fix Paste without Formatting / Paste and Match Style producing uneditable text nodes. ()
* 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 ()
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 () 2020-02-20 16:27:13 -08:00
Andreas Geffen Lundahl
eb181f3279
Allow zero as offset on <anchor> and <focus> inside <selection> ()
* 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 ()
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 ()
* 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 () 2019-12-19 11:51:44 -05:00
Corentin.Andre
e54b07eba8 fix: undoing and redoing are switched () 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 ()
* 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 () 2019-12-18 11:15:59 -05:00
cvlmtg
0b7644e975 fix onBeforeInput memoization ()
* 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 ()
* 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 () 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 ()
* 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
Ian Storm Taylor
0f1d97eced add match option to Editor.levels 2019-12-16 15:59:02 -05:00
Ian Storm Taylor
40856cfa95 v0.55.0 2019-12-15 21:03:17 -05:00
Ian Storm Taylor
7d832b5e12
Standardize node matching APIs ()
* add lowest mode and universal flag to `Editor.nodes`

* add `mode` handling to all transforms

* add extra `Editor.is*` helpers

* change `Editor.previous` to make all optional

* change `Editor.next` to make all optional

* change `Editor.match` to make all optional

* add `Editor.void` helper

* remove non-function match arguments

* remove NodeMatch interface

* change to lowest match by default everywhere

* rename `Editor.match` to `Editor.above`

* use new helpers

* cleanup

* make NodeEntry generic, cleanup

* fix NodeEntry generics

* ensure only ancestors are returned from Editor.above

* add type-narrowing to `Editor.nodes`, remove extras

* remove other Node entry types

* cleanup

* remove `Editor.block` and `Editor.inline` helpers
2019-12-15 19:36:05 -05:00
Ian Storm Taylor
b927fa3a11 Publish
- slate-history@0.54.6
 - slate-hyperscript@0.54.6
 - slate-react@0.54.6
 - slate@0.54.6
2019-12-13 19:15:11 -05:00
Ian Storm Taylor
b9c441f1a4 fix nested unwrapping with splitting 2019-12-13 19:12:50 -05:00