1
0
mirror of https://github.com/ianstormtaylor/slate.git synced 2025-08-07 07:46:32 +02:00

67 Commits

Author SHA1 Message Date
Felix Feng
c56a98fd65 skip nonselectable nodes when move (#5885)
* skip nonselectable nodes when move

* fix

* docs

* remove ignoreNonSelectable

* docs

* revert
2025-06-10 15:37:56 -07:00
Alex
11b957a441 Add way to prevent data loss in normalizeNode (#5878)
* fix(docs): Consider passed options when overriding normalizeNode

* feat: Allow to prevent data-loss on normalizeNode

When overriding normalizeNode, you can specify a `wrapperElement`
that is used to wrap text & inline nodes which would otherwise be
deleted in the normalization path if they are not allowed.

* changeset
2025-05-24 13:53:02 -07:00
Ziad Beyens
22a3dda36d Add renderText and leafPosition (#5850)
* feat

* revert

* revert

* docs

* test

* refactor

* test

* revert

* refactor

* doc

* docs

* refactor

* docs

* test

* docs

* docs

* docs

* refactor
2025-04-29 07:30:57 -07:00
Joe Anderson
63c0db5b86 Add pass option to Editor.nodes (#5843) 2025-04-15 08:41:31 -07:00
Deepak Kharah
5adb8ededf doc: add missing APIs in the doc (#5835)
* doc: add missing APIs in the doc

* refactor: apply lint
2025-04-03 22:10:34 -07:00
yf-yang
5a1c728c62 feat: add optional method to decoration object (#5776) 2024-12-07 00:19:30 -07:00
Pengfei Han
6bc5758358 docs: specify default value of edge in Editor.point as start (#5765)
Clarify in the documentation that the default value for `edge` in `Editor.point` is `start`.
This is helpful for developers who are not deeply familiar with the framework but need to quickly use it for development.
They no longer need to inspect the source code or experiment with sample code to understand the default behavior.
2024-11-26 11:49:43 -07:00
Abner Yang
cd93871ae6 Fix relative url to normalizing-11.md (#5596) 2024-01-27 23:05:04 -07:00
Ziad Beyens
01f0210bcc Consistent insert* methods (#5415)
* feat: add reviewpad.yml file

* Update reviewpad.yml

*  options to `Editor.insert*`

* 📝 options to `Editor.insert*`

*  getDefaultInsertLocation

*  getDefaultInsertLocation

*  getDefaultInsertLocation

* 📝 consistent selection

* Create tasty-lizards-remain.md

* Update tasty-lizards-remain.md

---------

Co-authored-by: reviewpad[bot] <104832597+reviewpad[bot]@users.noreply.github.com>
Co-authored-by: Dylan Schiemann <dylan@dojotoolkit.org>
2023-05-06 15:41:42 -07:00
Ziad Beyens
0ac72a626c fix: normalizeNode (#5311)
* fix

* Create large-worms-jog.md

* Update large-worms-jog.md

* Update large-worms-jog.md

* Update large-worms-jog.md

* fix
2023-02-23 16:10:08 -07:00
Ziad Beyens
84f811a79c More control on editor.normalizeNode (#5295)
* feat

* fix

* Create two-books-bow.md

* docs

* feat

* fix
2023-02-22 04:54:35 -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
Brian Bucknam
2f8f6913e4 Simplify / clarify wording (#5170)
Slight improvement to editor documentation
2022-10-26 16:33:33 -07:00
Haakon Borch
f5ccab241c update docs on Node.ancestors/levels and Path.ancestors (#4987) 2022-05-17 16:23:47 -07:00
Horacio Herrera
0e598ab229 feat(docs): add missing Element methods (#4943) 2022-04-13 10:56:59 -07:00
Sunny Hirai
bb4f1934c9 Moved documentation for refs in the Editor into its own section 2022-04-10 15:35:48 -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
Bryan Haakman
20acca4bc8 Add soft break as a separate overridable editor method (#4873)
add changeset
2022-03-20 04:30:08 -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
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
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
Jim Fisher
08f67d9cbc Fix typo (#4598) 2021-10-13 15:46:53 -07:00
Dylan Schiemann
4d133e02fc Fix broken plugins link in Editor documentation (#4335) 2021-08-04 21:59:10 -07:00
Sunny Hirai
03e8230196 docs: Improve documentation around Editor.before and Editor.after 2021-07-08 13:12:11 -07:00
Sunny Hirai
7d14bef63b docs: Improve documentation for Editor.previous and Editor.next 2021-07-08 13:06:41 -07:00
Sunny Hirai
26f4b2521c docs: Clarified that Editor.positions in reverse with a word changes the returned positions 2021-06-07 08:59:27 -07:00
Sunny Hirai
06121a3d82 docs: Fix typo 2021-06-06 22:57:30 -07:00
Sunny Hirai
c86d0b040b docs: Improve styling and wording in Editor.positions 2021-06-06 22:52:20 -07:00
Sunny Hirai
1f08442ab2 docs: Add detailed description of how Editor.positions works 2021-06-06 22:42:32 -07:00
Sunny Hirai
1e6f60aa6d docs: Try options syntax with defaults 2021-06-06 19:42:19 -07:00
Sunny Hirai
665b6c81ab docs: Experiment with alternate Options syntax for documentation 2021-06-06 18:04:18 -07:00
Sunny Hirai
614260f771 docs: Experiment with using ts for showing API signature 2021-06-06 17:53:21 -07:00
Sunny Hirai
e2ae33043a docs: Experiment with alternate options documentation format 2021-06-06 17:50:49 -07:00
Sunny Hirai
3baf1301bc docs: Add docs for Text.isTextList 2021-06-06 17:33:02 -07:00
Sunny Hirai
3156bd0b94 docs: Describe Text.matches in detail and describe 'loose' option in Text.equals 2021-06-06 17:27:01 -07:00
Sunny Hirai
33083833fb docs: Add API reference for NodeEntry 2021-06-06 13:01:31 -07:00
Sunny Hirai
c05d4c4e55 docs: Add detail to how the Editor.nodes method works 2021-06-06 12:28:48 -07:00
Sunny Hirai
8ba06cdfd0 docs: Fix duplicate Editor.nodes in documentation 2021-06-05 22:02:44 -07:00
Sunny Hirai
1ef84f4d48 docs: Fix marks definition in Editor interface 2021-05-26 00:20:39 -07:00
Sunny Hirai
5e4459ed17 docs: Fix spacing in Editor API interface code 2021-05-26 00:19:19 -07:00
Sunny Hirai
708372c745 docs: Add fat arrows to Text API 2021-05-26 00:16:24 -07:00
Sunny Hirai
c1496f4729 docs: Add fat arrows to Nodes API 2021-05-26 00:15:09 -07:00
Sunny Hirai
21a213e5a5 docs: Add return types to Editor schema specific overrides 2021-05-26 00:11:48 -07:00
Sunny Hirai
2fbcb335bb docs: change Editor static methods to use fat arrows in method names 2021-05-26 00:06:46 -07:00
Sunny Hirai
ced37b93c7 docs: Try changing function format to use fat arrow to see how it looks 2021-05-26 00:00:59 -07:00
Sunny Hirai
03746d9eed docs: Add generics to Editor API and add missing method 2021-05-25 23:52:03 -07:00
Sunny Hirai
cf6145dc6e docs: minor grammatical fix 2021-05-25 18:52:36 -07:00