1
0
mirror of https://github.com/ianstormtaylor/slate.git synced 2025-02-19 14:44:39 +01:00

126 Commits

Author SHA1 Message Date
Wayne Leroux
e03ce7c561
Feature/android keyboard support (#4200)
* Added Android Keyboard Support

* Added changeset for android keyboard support

* Removed dead code in android editable that supported non-android environments

* Removed unnecessary attributes observation for android-editable

* Removed dead code

* Added no-error boundary

* Fixed issues with linters
2021-05-12 16:30:39 -07:00
katsew
c70e30f83d
fix: shadow-dom example not found in examples (#4226) 2021-04-26 10:35:54 +01:00
Julian Krispel-Samsel
ea2eefefb8
Add renderPlaceholder (#4190) 2021-04-23 21:22:11 +01:00
Julian Krispel-Samsel
602f170156
Update readonly example and add test (#4212)
* fixes #4039, update readonly example

* add cypress test for readonly mode
2021-04-21 09:29:19 +01:00
case
6a6d9f614d
Fix Underline <FormatButton /> in Hovering Toolbar Example (#4128)
* Fix Underline <FormatButton /> in `Hovering Toolbar Example`

* Update hovering-toolbar.tsx

Co-authored-by: Ian Storm Taylor <ian@ianstormtaylor.com>
2021-04-13 10:57:39 -04:00
hoangbits
8c3c7ada87
Update images.tsx (#4180) 2021-04-08 19:59:36 -04:00
Ian Storm Taylor
4eec49de16 rename master to main 2021-04-01 13:40:25 -04:00
Ian Storm Taylor
7723935b68 port remove link button pr to master 2021-03-31 21:59:57 -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
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
Ian Storm Taylor
4ca9591015 fix portals in ssr, fixes #3525 2021-03-31 15:14:54 -04:00
Sunny Hirai
c803e5ffd0 Switch initialValue type in examples to Descendant 2021-03-29 09:49:44 -07:00
Sunny Hirai
4661f19d4b Add language type for examples Readme.md code blocks 2021-03-29 09:38:20 -07:00
Sunny Hirai
b88149c2f9 Remove unused imports from all examples 2021-03-29 09:37:24 -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
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
Jacob
5267f07175
fix: fix 404 status of iframe example page (#4092) 2021-02-28 23:00:33 -05: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
6d66d87f67 Exclude checking source maps for next and @next 2021-02-16 18:03:24 -08:00
Steve Marquis
e4936c3f32
Fix broken attribute references (#4011) 2021-02-11 18:29:03 -05:00
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