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

619 Commits

Author SHA1 Message Date
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
Sunny Hirai
df06528b18 v0.60.4 2021-02-16 19:49:37 -08:00
Sunny Hirai
513771c82a
slate-react: MVP for working with non-global window objects (fix for #3819) (#4079)
* mvp implementation for working with non-global window instances

* remove unused element renderer

* fix typo in comment

* fix wrong example reference

* Add @babel/helper-call-delegate to fix build error

Co-authored-by: Lukas Buenger <lukasbuenger@gmail.com>
2021-02-16 19:40:15 -08:00
Sunny Hirai
291aac9c5b v0.60.3 2021-02-08 13:01:11 -08:00
Sunny Hirai
424a6cbde9 v0.60.2 2021-01-19 00:10:44 -08:00
Ulion
b5859b7e2e
Fix useEditor not inside Slate error caused by introduce useSlateStatic (#4027) 2021-01-14 09:20:44 -05:00
Sunny Hirai
1f067b8d33 v0.60.1 2020-12-11 13:06:26 -08:00
Sunny Hirai
db3f52517f Merge TypeScript types from master into main 2020-11-27 16:31:16 -08:00
Sunny Hirai
db118ee8d8 v0.60.0 2020-11-24 12:39:01 -08:00
Sunny Hirai
08275f68f3
Custom TypeScript Types (#3835)
This PR adds better TypeScript types into Slate and is based on the proposal here: https://github.com/ianstormtaylor/slate/issues/3725

* Extend Slate's types like Element and Text

* Supports type discrimination (ie. if an element has type === "table" then we get a reduced set of properties)

* added custom types

* files

* more extensions

* files

* changed fixtures

* changes eslint file

* changed element.children to descendant

* updated types

* more type changes

* changed a lot of typing, still getting building errors

* extended text type in slate-react

* removed type assertions

* Clean up of custom types and a couple uneeded comments.

* Rename headingElement-true.tsx.tsx to headingElement-true.tsx

* moved basetext and baselement

* Update packages/slate/src/interfaces/text.ts

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

* Fix some type issues with core functions.

* Clean up text and element files.

* Convert other types to extended types.

* Change the type of editor.marks to the appropriate type.

* Add version 100.0.0 to package.json

* Revert "Add version 100.0.0 to package.json"

This reverts commit 329e44e43d968700655b1c46f968bfd3147e7339.

* added custom types

* files

* more extensions

* files

* changed fixtures

* changes eslint file

* changed element.children to descendant

* updated types

* more type changes

* changed a lot of typing, still getting building errors

* extended text type in slate-react

* removed type assertions

* Clean up of custom types and a couple uneeded comments.

* Rename headingElement-true.tsx.tsx to headingElement-true.tsx

* moved basetext and baselement

* Update packages/slate/src/interfaces/text.ts

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

* Fix some type issues with core functions.

* Clean up text and element files.

* Convert other types to extended types.

* Change the type of editor.marks to the appropriate type.

* Run linter.

* Remove key:string uknown from the base types.

* Clean up types after removing key:string unknown.

* Lint and prettier fixes.

* Implement custom-types

Co-authored-by: mdmjg <mdj308@nyu.edu>

* added custom types to examples

* reset yarn lock

* added ts to fixtures

* examples custom types

* Working fix

* ts-thesunny-try

* Extract interface types.

* Fix minor return type in create-editor.

* Fix the typing issue with Location having compile time CustomTypes

* Extract types for Transforms.

* Update README.

* Fix dependency on slate-history in slate-react

Co-authored-by: mdmjg <mdj308@nyu.edu>
Co-authored-by: Brent Farese <brentfarese@gmail.com>
Co-authored-by: Brent Farese <25846953+BrentFarese@users.noreply.github.com>
Co-authored-by: Tim Buckley <timothypbuckley@gmail.com>
2020-11-24 12:30:06 -08:00
Marcus Wood
bf2fe9ffe5
export useEditor back out of package (#3961) 2020-11-02 17:04:36 -05:00
Song You
4ae58e5c95
Differentiate between useSlate and useEditor hooks (#3941)
* Rename useEditor function to useSlateStatic

* Expose useEditor hook with deprecated flag

* Clarify useEditor deprecation in file and in docs
2020-10-29 15:39:21 -04:00
CameronAckermanSEL
60b56651b2 v0.59.0 2020-09-24 20:46:51 -07:00
Wayne Leroux
4c3e737dda
Fixed issue where virtual keyboard closes when resynchronizing selection in Chrome on Android (#3866)
* Fixed issue where virtual keyboard closes when resynchronizing selection

* Fixed lint issue

* Added inversion of start-end to end-start when range is backwards
2020-09-16 20:48:12 -07:00
Githoniel
79eee6b378
fix inconsistent render reversed selection (#3804)
* fix inconsistent render reversed selection

* fix type error

* add comment for setReverseDomSelection

* add comment for setReverseDomSelection

* add comment for toDOMRange
2020-08-20 08:43:16 -07:00
Diana Lease
63f099952e
fix(slate-react): update onDOMBeforeInput when onDOMBeforeInput prop changes (#3617) (#3829)
Signed-off-by: Diana Lease <dianarlease@gmail.com>
2020-08-18 15:21:14 -07:00
Nikolay Martynenko
97dbab13a8
Trigger editor.insertText by paste too (#3776) 2020-07-10 09:31:25 -07:00
Mitchell Busby
68acd6b876
Resolves iamstormtaylor/slate#3778: Check if editable target before handling paste event (#3779) 2020-07-10 09:30:26 -07:00
CameronAckermanSEL
958189bc4a v0.58.4 2020-07-07 18:17:33 -07:00
Dylan Markow
a5720b289f
Fix placeholder text alignment (#3724)
Using verticalAlign: text-top was causing a slight height change when entering actual content.
2020-06-05 11:44:35 -07:00
Dan
788a8cefdc
fix older chrome support (#3722)
* fix older chrome support

* fix chrome regex
2020-06-05 00:02:40 -07:00
CameronAckermanSEL
ca126fbb39 v0.58.3 2020-06-03 18:24:33 -07:00
anatolzak
44675c2080
Overrode Mark Styles in Placeholder (#3703)
* disabled user select on placeholder

* fixed css property value without quotes

* overrode mark styles in placeholder

Co-authored-by: Cameron Ackerman <cameron_ackerman@selinc.com>
2020-05-28 14:56:41 -07:00
CameronAckermanSEL
97a7e8a469 v0.58.2 2020-05-27 08:55:33 -07:00
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
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
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