1
0
mirror of https://github.com/ianstormtaylor/slate.git synced 2025-09-03 04:02:33 +02:00

927 Commits

Author SHA1 Message Date
Lagu Longa
c8c75e9e2d remove duplicate useState import (#5194) 2022-11-17 09:21:51 -07:00
Jacob Carpenter
d8dbbb19f7 Docs: fix incorrect name. (#5182)
A reference to the sample above incorrectly mentions `Editor.unwrapNodes` instead of `Transforms.unwrapNodes`.
2022-11-08 05:38:52 -07:00
Brian Bucknam
346f6572fc Allow void elements to receive marks (#5135)
Some void elements are effectively stand-ins for text, such as with the mentions example,
where the mention element renders the character's name. Users might want to format Void
elements like this with bold, or set their font and size, so `editor.markableVoid` tells
Slate whether or not to apply Marks to the text children of void elements.

- Adds `markableVoid()` as a schema-specific overrideable test.
- Changes `addMark` and `removeMark` so marks can apply to voids. Also changes behavior
of collapsed selection so that if a markable Void is selected, the mark will be applied /
removed.
- Shows how `markableVoid()` can work in the mentions example
2022-11-08 05:38:15 -07:00
Doug Reeder
469bec3d04 Adds an example using SlateNode.common() with the editor selection (#5176) 2022-11-01 05:13:15 -07:00
Denis Sokolov
d868c930f6 Fix a typo in docs on Normalizing (#5164) 2022-10-28 08:47:09 -07:00
Brian Bucknam
2f8f6913e4 Simplify / clarify wording (#5170)
Slight improvement to editor documentation
2022-10-26 16:33:33 -07:00
Doug Reeder
5e7815eded Products: adds Quill Forms & renames GraphCMS to Hygraph (#5163) 2022-10-23 21:48:12 -07:00
Doug Reeder
4e52e5043e Adds descriptions to list of products (#5161)
* Adds descriptions to list of products

* Products: Add Aline, Campfire, Coda, Dropdeck & Sana. Removes broken link
2022-10-22 06:10:27 -07:00
Samy Rahmani
56ab505485 Added missing brackets to resolve inconsistancy (#5097) 2022-08-22 17:15:40 -07:00
Liy
f273647984 Fix wrong 'Transforms' name. (#5065) 2022-07-28 05:06:42 -07:00
Bryan Haakman
9bc0b6132a Change how Slate context updates and introduce useSlateSelection hook (#5041)
* Fix DOM selection sync when there are unexpected rerenders

* Create a useSlateSelection hook and expose it

* update docs

* add changeset

* Undo the useEffect change and add a useSlateValue method

* Use a version counter instead for SlateContext

* comment out layout effect prevention for now

* Undo useV comparison for now

* Change the changeset

* Fix lint

* Remove the useSlateValue hook

* remove some unused imports

* Add useSlateWithV to the docs

* fix changeset lint

* Change changeset to minor instead
2022-07-22 16:27:26 -07:00
魔王卷子
abea3a3dd4 replace slate to Slate (#5024) 2022-07-10 15:41:51 -07:00
魔王卷子
588a808b2f Update transforms.md (#5030) 2022-06-26 20:51:02 +01:00
Gabin Aureche
22308b3417 Replace useMemo with useState in the docs (#5022)
* Replace useMemo with useState

* Fix formatting
2022-06-11 07:58:19 -07:00
Gabin Aureche
a66c7315a3 Replace useState with useMemo in the "Installing Slate" walkthrough (#5020)
* Update 01-installing-slate.md

* Revert changes to types definitions
2022-06-07 21:31:52 -07:00
Alexander Campbell
fe13a8f9e7 implement scrubber for end user data in exceptions (#4999) 2022-05-26 14:44:22 -07:00
Haakon Borch
f5ccab241c update docs on Node.ancestors/levels and Path.ancestors (#4987) 2022-05-17 16:23:47 -07:00
Abdullah Ammar
863357f994 docs: fix links example not working (#4986) 2022-05-17 16:23:32 -07:00
Eric Meier
cb8a551508 Add ReactEditor.isComposing(editor) (#4981)
* Add ReactEditor.isComposing(editor)

* Upate changeset from patch to minor
2022-05-02 12:09:42 -07:00
Dylan Schiemann
acdc5c3417 fix linting issue (#4976) 2022-04-26 10:10:55 -07:00
wojtek-kowalczyk
731fdf3457 Fixed a bug in the example code in docs (#4973) 2022-04-26 09:10:00 -07:00
James
34cfc1c704 closed bracket on complete code example (#4950) 2022-04-19 08:48:22 -07:00
Horacio Herrera
0e598ab229 feat(docs): add missing Element methods (#4943) 2022-04-13 10:56:59 -07:00
vagusX
99d24a63af docs: remove yuque in Products (#4940) 2022-04-13 10:56:14 -07:00
Johan Davidsson
d460bb42f0 Doc serializing fix (#4937)
Fixing a never ending recursive function in the serializing documentation.
2022-04-12 08:55:26 -07:00
cptKNJO
ce02acd2fd Docs remove unused selection (#4927) 2022-04-11 06:10:41 -07:00
Sunny Hirai
bb4f1934c9 Moved documentation for refs in the Editor into its own section 2022-04-10 15:35:48 -07:00
Sunny Hirai
daa68dab89 Add descriptions of affinity to PathRef, PointRef and RangeRef documentation 2022-04-10 15:31:43 -07:00
Sunny Hirai
e7aa292323 Fixed several broken and missing links in the Location Types API Reference 2022-04-10 15:09:43 -07:00
Sunny Hirai
5400296e45 Add PathRef to Table of Contents of Documentation 2022-04-10 15:06:26 -07:00
Doug Reeder
2b94e17874 Documents how to implement a Void Element. (#4924)
* Documents how to implement a Void Element.

* Tightens up phrasing
2022-04-03 16:34:33 -07:00
Eric Meier
f17413086e Update examples in docs, editable voids example (#4925)
* Update examples in docs, editable voids example

* Update typescript docs
2022-04-03 09:57:38 -07:00
Eric Meier
9892cf0ffb Make onChange prop optional, update examples and docs to treat slate as uncontrolled (#4922)
* Make onChange prop optional, update examples and docs to treat slate as uncontrolled

* Add changeset
2022-04-03 08:52:32 -07:00
Bryan Haakman
20acca4bc8 Add soft break as a separate overridable editor method (#4873)
add changeset
2022-03-20 04:30:08 -07:00
Marc
1356f2afc3 Fix a teeny tiny typo (#4875) 2022-03-08 19:32:39 -07:00
Jan Paepke
df1720d311 DOCS: improved deserialization example (#4856)
* Updated deserialize function

* forgot the .flat()

* made prettier happier
2022-03-03 18:27:19 -07:00
Jim Fisher
465cf777cd Define "hanging range" and intended behavior of unhangRange (#4852)
There is currently no definition of this in the docs, so it's very hard
to understand what this function is supposed to do, and whether it's
buggy. I've written this definition based on Ian Taylor's messages on
Slack [1]:

    Jason: Why does unhangRange only unhang the end of a range and not
    the start as well? Trying to tell if this is a bug or some logic I'm
    not following. If the start of the range is at the last index of a
    text shouldn't unhangRange advance that to the next node?

    ianstormtaylor: I don’t believe it’s a bug. It was designed to
    handle ranges that result from triple-clicks. Not that there might
    not be improvements, or that there might not be some other better
    way to solve for triple-clicks, or that there might be a better
    name for it

    Jason: When you say triple-click handling you mean the fact that
    the browser selection by default gets placed from start of line to
    start of next line? In that cause yes the end of the selection is
    where the problem is. If looked at as a more generic implementation
    it seems like unhanging the start in cases where you have
    {text: 'foo|'}, {text: 'bar|', bold: true} and it makes sense to
    normalize the selection to {text: 'foo'},
    {text: '|bar|', bold: true} which helps in some cases by avoiding
    splits that immediately get merged back, etc.

    ianstormtaylor: Yup, that’s exactly right. It was created for the
    triple-click case. I agree that something to handle the
    start-edged cases would be nice too. But folks in GitHub
    discussions have been kind of assuming that the code meant to be
    written for both, and that it’s a bug to fix, which isn’t true.
    I’m not sure if there are gotchas to expanding the scope to
    handle both edges

[1]: https://slate-js.slack.com/archives/CC58ZGGU9/p1632188507024300
2022-02-23 13:13:09 -07:00
Jim Fisher
b8020ee6fc Document additional schema constraints due to design of operations (#4838)
As discussed in https://github.com/ianstormtaylor/slate/issues/4836
2022-02-16 09:22:08 -07:00
Antonio Sanchez Gomez
51e02de9de Update docs to reflect Slate is an uncontrolled component (#4768)
* Updated documentation

* Update docs/walkthroughs/01-installing-slate.md

Co-authored-by: Dylan Schiemann <dylan@dojotoolkit.org>

* fix: formatting errors

Co-authored-by: Dylan Schiemann <dylan@dojotoolkit.org>
2022-01-10 03:42:46 -07:00
Desmond Brand
1b0e7c6b92 Docs shouldn't useMemo for editor (#4766)
As already discussed almost a year ago in #3198, `useMemo` doesn't guarantee persistence. This breaks Fast Refresh.

`useState` without a setter is a straightforward fix that avoids dependencies; let's get the docs updated so Fast Refresh works again.

Fixes #3198
2022-01-08 04:34:40 -07:00
Doug Reeder
c90ec8e837 Adds documentation for PathRef (#4740) 2021-12-22 05:04:14 -07:00
Doug Reeder
228cee56a1 Clarifies when to use Editor.insertNode vs. Transforms.insertNodes (#4731) 2021-12-18 07:05:10 -07:00
Doug Reeder
5d3eccf262 Documents use of Editor.withoutNormalizing in conjunction with normalization (#4737) 2021-12-16 22:15:22 -07:00
Doug Reeder
e04671ffe8 Clarifies docs for RangeRef & PointRef; fixes TOC for Editor API (#4724) 2021-12-10 05:53:37 -07:00
Bryan Haakman
1217021a9a Add origin event type to setFragmentData to be able to distinguish copy, cut and drag (#4720)
* Add origin event to setFragmentData to be able to distinguish copy, cut, drag

* fix lint

* add changeset

* Make originEvent optional
2021-12-08 10:56:11 -07:00
Doug Reeder
7d9d25e179 Adds clarification & examples to demystify Transforms. (#4653)
* Adds clarification & examples to demystify Transforms.

* Fleshes out documentation of NodeOptions for Transforms

* Update docs/concepts/04-transforms.md

Co-authored-by: Dylan Schiemann <dylan@dojotoolkit.org>

* Uses 'API' in the title of all API documents

Co-authored-by: Dylan Schiemann <dylan@dojotoolkit.org>
2021-11-16 02:20:43 -07:00
meri-leeworthy
5dc9dc5227 missing dependency (#4656) 2021-11-15 02:02:51 -07:00
Eric Charles
e54f2a0ea0 Fix double insertion due to insertTextData being called when it should not (#4625)
* fix double paste due to insertTextData being called when it should not

* Document return type of insertTextData and insert FragmentData

* Add changeset
2021-10-26 21:09:36 -07:00
Eric Charles
72160fac08 Add insertFragmentData and insertTextData to the ReactEditor API (#4614)
* Add insertFragmentData and insertTextData to the ReactEditor API

* Add patch changeset

* Docs for insertFragment and insertTextData
2021-10-22 06:44:56 -07:00
Jim Fisher
08f67d9cbc Fix typo (#4598) 2021-10-13 15:46:53 -07:00