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

16 Commits

Author SHA1 Message Date
Kyle McLean
9c4097a26f
Simplify implementation of custom editor styling (#5278)
* Switch back to using inline styles for default editor styles

* Add example page and test for editor styling

* Add section in docs for editor styling

* Add test for editor height being set to placeholder height

* Add changeset
2023-01-31 19:17:27 -07:00
Dylan Schiemann
ce1e096df7
update emotion dependency for site (#4783) 2022-01-11 08:36:04 -07:00
Jim Fisher
f1b7d18f43
Official custom inlines example (#4615)
* Official custom inlines example

This generalizes the "links" example to an "inlines" example, adding
a new example of an inline: an "editable button".

Firstly, this is important to demonstrate that Slate really does allow
_custom_ elements, and not just "standard" ones like links that you'll
find in any editor.

Secondly, it's important to show an example of an inline where "offset"
movement should be used. With links, it's arguable that the cursor
positions <link>foo<cursor/></link> and <link>foo</link><cursor/>
should be considered the same, because they display in the same
position. But with the editable button, the cursor is clearly in a
different position, and so offset movement should be used.

* lint

* fix integration test

* update readme

* try again
2021-10-22 13:19:41 -07:00
Sunny Hirai
506d9bce53 Add syntax highlighting example to menu 2021-07-01 17:10:35 -07:00
Julian Krispel-Samsel
ea2eefefb8
Add renderPlaceholder (#4190) 2021-04-23 21:22:11 +01:00
Ian Storm Taylor
4eec49de16 rename master to main 2021-04-01 13:40:25 -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
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
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
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
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
Ian Storm Taylor
124ff37c3a update docs 2019-12-05 12:52:52 -05:00
Dylan Markow
fe2cebb58f Load with correct starting example (#3220) 2019-12-04 10:43:06 -05:00
Charlie Rudenstål
4140066c0b fix links to examples in readme and site (#3132) 2019-11-28 10:33:10 -05:00
Ian Storm Taylor
4ff6972096
Next (#3093)
* remove some key usage from core, refactor Operations.apply

* undeprecate some methods

* convert more key usage to paths

* update deprecations

* convert selection commands to use all paths

* refactor word boundary selection logic

* convert many at-range commands to use paths

* convert wrapBlock and wrapInline to not use keys

* cleanup

* remove chainability from editor

* simplify commands, queries and middleware

* convert deleteAtRange

* remove key usage from schema, deprecate *ByKey methods

* migrate *ByKey tests, remove index from *ByPath signatures

* rename at-current-range tests

* deprecate mode key usage, migrate more tests away from keys

* deprecate range and point methods which rely on keys to work

* refactor insertBlock, without fixing warnings

* add pathRef/pointRef, fix insertBlock/Inline deprecations, work on insertFragment

* refactor insertFragment

* get rich-text example rendering

* fix lint

* refactor query files, fix more tests

* remove unused queries, refactor others

* deprecate splitDescendantsByPath

* merge master

* add typescript, convert slate, slate-hyperscript, slate-plain-serializer

* add Point, Path, Range, Annotation tests

* add Annotation, Change, Element, Fragment, Mark, Range, Selection, Value interfaces tests

* add Operation and Text tests

* add Node tests

* get operations and normalization tests working for slate

* get *AtPath command tests passing

* rename *AtPath command tests

* rename

* get *AtPoint tests working

* rename

* rename

* add value queries tests

* add element, mark and path queries tests

* convert most on-selection tests

* convert on-selection commands

* rename

* get addMarks and delete commands working

* rename

* rename

* rename

* refactor value.positions(), work on delete tests

* progress on delete tests

* more delete work

* finish delete tests

* start converting to at-based commands

* restructure query tests

* restructure operations tests

* more work converting to multi-purpose commands

* lots of progress on converting to at-based commands

* add unwrapNodes

* remove setValue

* more progress

* refactor node commands to use consistent matching logic

* cleanup, get non-fragment commands passing

* remove annotations and isAtomic

* rename surround/pluck to cover/uncover

* add location concept, change at-path to from-path for iterables

* refactor batches

* add location-based queries

* refactor hanging logic

* more location query work

* renaming

* use getMatch more

* add split to wrap/unwrap

* flip levels/ancestors ordering

* switch splitNodes to use levels

* change split to always:false by default

* fix tests

* add more queries tests

* fixing more delete logic

* add more splitNodes tests

* get rest of delete tests passing

* fix location-based logic in some commands

* cleanup

* get previous packages tests passing again

* add slate-history package

* start slate-schema work

* start of react working

* rendering fixes

* get rich and plain text examples working

* get image example working with hooks and dropping

* refactor onDrop to be internal

* inline more event handlers

* refactor lots of event-related logic

* change rendering to use render props

* delete unused stuff

* cleanup dom utils

* remove unused deps

* remove unnecessary packages, add placeholder

* remove slate-react-placeholder package

* remove unused dep

* remove unnecessary tests, fix readonly example

* convert checklists example

* switch to next from webpack

* get link example working

* convert more examples

* preserve keys, memoized leafs/texts, fix node lookup

* fix to always useLayoutEffect for ordering

* fix annotations to be maps, memoize elements

* remove Change interface

* remove String interface

* rename Node.entries to Node.nodes

* remove unnecessary value queries

* default to selection when iterating, cleanup

* remove unused files

* update scroll into view logic

* fix undoing, remove constructor types

* dont sync selection while composing

* add workflows

* remove unused deps

* convert mentions example

* tweaks

* convert remaining examples

* rename h to jsx, update schema

* fix schema tests

* fix slate-schema logic and tests

* really fix slate-schema and forced-layout example

* get start of insertFragment tests working

* remove Fragment interface

* remove debugger

* get all non-skipped tests passing

* cleanup deps

* run prettier

* configure eslint for typescript

* more eslint fixes...

* more passing

* update some docs

* fix examples

* port windows undo hotkey change

* fix deps, add basic firefox support

* add event overriding, update walkthroughs

* add commands, remove classes, cleanup examples

* cleanup rollup config

* update tests

* rename queries tests

* update other tests

* update walkthroughs

* cleanup interface exports

* cleanup, change mark transforms to require location

* undo mark transform change

* more

* fix tests

* fix example

* update walkthroughs

* update docs

* update docs

* remove annotations

* remove value, move selection and children to editor

* add migrating doc

* fix lint

* fix tests

* fix DOM types aliasing

* add next export

* update deps, fix prod build

* fix prod build

* update scripts

* update docs and changelogs

* update workflow and pull request template
2019-11-27 20:54:42 -05:00