1
0
mirror of https://github.com/ianstormtaylor/slate.git synced 2025-01-19 06:18:16 +01:00

56 Commits

Author SHA1 Message Date
Jacob
0513539ed7
fix: Operation.isOperationList just check value[0] (#4061)
* Fix list queries.
2021-01-31 10:21:04 -05: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
Wendell Hu
59ee7f8488
doc: change example readme doc link (#3853) 2020-11-03 12:38:08 -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
e7b5f75989 fixed path to examples 2020-08-19 09:23:39 -07:00
Wendell Hu
912d4b79da
docs: convert examples to typescript (#3766)
* docs: convert examples to typescript

* docs: convert remaining examples

* docs: update next.js

* ci: fix lint

* docs: fix next.js path

* docs: cleanup

* update

Co-authored-by: wendellhu <wendellhu@tencent.com>
2020-08-19 09:14:51 -07:00
Maria Jaramillo
d5eaa1164d
Fixed html (#3809)
* Add version 100.0.0 to package.json

* Revert "Add version 100.0.0 to package.json"

This reverts commit 329e44e43d968700655b1c46f968bfd3147e7339.

* fixed typo in html file

Co-authored-by: Tim Buckley <timothypbuckley@gmail.com>
2020-08-05 15:57:48 -07:00
Maria Jaramillo
a35b8737b7
syntax highlighting (#3762)
* syntax highlighting

* Delete package-lock.json

* Update package.json

* Update package.json

* Delete syntax-highlighting.js

* Update [example].js

* Update [example].js

* Update [example].js

* added correct file

* linting

* Update site/examples/code-highlighting.js

Co-authored-by: Tim Buckley <timothypbuckley@gmail.com>

* Update site/examples/code-highlighting.js

Co-authored-by: Tim Buckley <timothypbuckley@gmail.com>

* Update site/examples/code-highlighting.js

Co-authored-by: Tim Buckley <timothypbuckley@gmail.com>

* updated pull request with some linting

* moved getLength fcn

Co-authored-by: Tim Buckley <timothypbuckley@gmail.com>
2020-07-09 18:23:56 -04:00
whyour
08f7ef588c
fix hovering toolbar format hotkeys (#3667) 2020-05-10 23:01:35 -07:00
Entkenntnis
1d7ab97429
use state to avoid cursor jumping in controlled input (#3552)
Co-authored-by: dal <test@x.com>
2020-03-24 18:16:32 -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
Douwe den Blanken
1d9a7fa01d
Fix for backspace press in list (#3533)
Made a fix for the fact that if you were standing in a <li> wrapped in an <ul> with no text and pressed backspace, the <ul> would go away while the <li>'s stay.
2020-03-02 14:29:46 -08:00
Ryan Mitts
d17a1e86e3
Added source-map-loader to the Next Webpack config to pass through the source maps from the compiles Slate libraries. (#3445) 2020-02-26 08:02:47 -08:00
Cameron Ackerman
0aaab07792
fixed some bugs with the input event handler on the embeds example (#3516)
* fixed some bugs with the input event handler on the embeds example, got rid of the non functional 'is selected and is focused' conditions for showing the input.

* fix linting error

Co-authored-by: DamareYoh <34608378+DamareYoh@users.noreply.github.com>
2020-02-26 07:48:39 -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
Synthetic Dream
0d6271bc15
docs: update an example's link (#3514) 2020-02-23 10:44:41 -08:00
Josh McFarlin
9137a1663f
Fixed incorrect editor usage in Embed example (#3397) 2020-02-20 17:28:11 -08:00
Adam Sanderson
e9e1eb2524
Adds Transforms import to forced-layout (#3503)
The forced layout demo included Editor, but not Transforms, and would crash when it needed to enforce the layout.
2020-02-20 16:20:36 -08: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
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
7d832b5e12
Standardize node matching APIs (#3327)
* 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
6552da940a
Add format_text command, and editor.marks state (#3308)
* add format_text command, refactor command extensions

* update onChange to not receive selection

* update docs

* fix tests
2019-12-12 15:37:55 -05:00
Ziad Beyens
ed40c08b80 fix: ts (#3301) 2019-12-11 17:18:38 -05:00
Sidwyn Koh
26a91f805a Allow links to be pasted without a selection (#3297)
* Allow links to be pasted without a selection

* Update links.js
2019-12-11 13:04:34 -05:00
Dylan Markow
28c31c2c0c Fix forced layout example (#3294) 2019-12-10 23:58:40 -05:00
Ian Storm Taylor
e68a5cd305
remove the slate-schema package (#3291) 2019-12-10 17:53:27 -05:00
Ziad Beyens
a234667935 fix: typo (#3281) 2019-12-09 18:39:50 -05:00
Ziad Beyens
0e95b02399 fix: ts (#3271)
* fix: ts

* remove suggest
2019-12-07 15:33:59 -05:00
Ziad Beyens
3b16a1c3f0 fix: ts (#3270)
* fix: ts

Fix:

- Argument of type 'Point | undefined' is not assignable to parameter of type 'Location'.
  Type 'undefined' is not assignable to type 'Location'.
- Types of property 'zIndex' are incompatible.

* use &&

* use optional chaining

* revert optional chaining (not supported)
2019-12-07 15:31:51 -05:00
Ian Storm Taylor
043a5c1709 fix parse error 2019-12-07 15:27:22 -05:00
Ziad Beyens
7ac85e6a93 style: no-unused-vars (#3269) 2019-12-07 11:53:31 -05:00
Dylan Markow
b629be3398 Fix paste example: nested formatting (#3264) 2019-12-06 17:14:35 -05:00
Ian Storm Taylor
90d40fd764
change schema plugin to be returned from function (#3252)
* change schema plugin to be returned from function

* fix forced-layout example
2019-12-05 15:29:02 -05:00
Ian Storm Taylor
97426525ca fix richtext and plaintext naming 2019-12-05 12:57:39 -05:00
Ian Storm Taylor
124ff37c3a update docs 2019-12-05 12:52:52 -05:00
Ian Storm Taylor
f3fc2c2a54
Change <Slate> to a controlled component (#3216)
* change <Slate> to be a controlled component

* add comment about unstable React API
2019-12-05 11:36:44 -05:00
Ian Storm Taylor
4c03b497d9
remove marks, in favor of text properties (#3235)
* remove marks, in favor of text properties

* fix lint

* fix more examples

* update docs
2019-12-05 11:21:15 -05:00
Urban Etter
31df397930 Fix check list example (#3232)
* Fix check list example

* Fix lint errors
2019-12-04 15:02:18 -05:00
Ian Storm Taylor
6627ba4b94
fix universal matching mode for marks (#3230)
* fix universal matching mode for marks

* fix lint
2019-12-04 12:57:15 -05:00
Dylan Markow
fe2cebb58f Load with correct starting example (#3220) 2019-12-04 10:43:06 -05:00
Dylan Markow
f355f8a6f0 Fix child_min_invalid checks (#3219) 2019-12-03 21:22:05 -05:00
Ziad Beyens
b5fe096844 fix: support upper case search (#3218) 2019-12-03 21:19:15 -05:00
Ian Storm Taylor
62af4cb053
upgrade mentions example to use a portal with suggestions, closes #3206 (#3214) 2019-12-03 14:40:42 -05:00
Urban Etter
5a8a5dcdcf Fix InsertImageButton in image example (#3210) 2019-12-03 10:59:50 -05:00
Ian Storm Taylor
e39f1e77ea fix rich-text to unwrap lists with splitting, closes #3199 2019-12-02 18:19:51 -05:00
Ziad Beyens
b1b0052705 fix: promptMention not defined (#3195)
* fix: promptMention not defined

* style: eslint
2019-12-01 20:56:28 -05:00
Ziad Beyens
2ad3dfeef8 fix: typo (#3193)
url is not defined
2019-12-01 20:18:21 -05:00
Ziad Beyens
357e3b8547 fix: typo (#3194) 2019-12-01 20:17:21 -05:00
Ziad Beyens
c12d0ff9de fix: typo (#3187) 2019-12-01 14:50:41 -05:00