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

691 Commits

Author SHA1 Message Date
John Isaac
09807df24f Fix typo in marks (#2929) 2019-08-08 07:10:26 -05:00
Brent Farese
767812cad3 Update plugins.md (#2950)
renderMark function signature is missing from the initial description of Hooks.
2019-08-08 07:03:49 -05:00
Zixiang Li
799df414a5 [Doc] Add missing previous property in rules (#2957) 2019-08-08 07:03:01 -05:00
Zixiang Li
7a434ca881 Add missing next property in rules (#2953) 2019-08-05 10:01:24 -05:00
Charley DAVID
7377266b43 Fix slate-react plugin documentation (#2910)
* Re-add removed renderMark
* Fix renderAnnotation & renderDecoration props
2019-07-05 09:28:43 -07:00
Jorge Valdez
a0b2aa3d4f replaced renderNode and renderMark documentations in slate-react with 0.22.0 changes (#2898) 2019-07-03 12:56:54 -07:00
Victor Pontis
cfa693411a Fix typo on Data Model docs page (#2849) 2019-06-07 18:57:36 +01:00
Daniil Khanin
5f26890ff9 Update applying-custom-formatting.md (#2843) 2019-06-07 18:56:36 +01:00
Ken Powers
e4c6beaab4 Remove leaves from walkthough docs (#2831) 2019-06-07 18:53:33 +01:00
Jon Portella
fbe70a1f28 Fix: prop name (#2780)
Nodes weren't properly rendering because the Editor was trying to call the function prop renderBlock but instead another called renderNode was passed.
2019-05-20 13:34:30 -07:00
Ralph Feltis
fd8e18b9cf Fix typo in commands.md (#2791)
* Adding Guilded to Products list

* Fixing typo

* Fixing typo
2019-05-16 16:25:49 -07:00
Matthew Steedman
f76a00acdc Replace renderNode with renderBlock (#2762) 2019-05-11 18:52:09 -07:00
Dan Schuman
376015df6c Text documentation update (#2758)
`text` property is no longer computed. Add `marks` field.
2019-05-10 10:47:58 -07:00
fchenTelus
7cbf15e3cc insertBlock is missing description (#2682) 2019-04-24 17:09:15 -07:00
Bryan Haakman
bb5d6beffa Make all ops invertible and remove value from ops (#2225) 2019-04-02 06:34:06 -07:00
Dominik Serafin
071424cda0 Use <s> for strikethrough example (#2676)
`<strike>` is obsolete and discouraged https://developer.mozilla.org/en-US/docs/Web/HTML/Element/strike

`<s>` is better alternative https://developer.mozilla.org/en-US/docs/Web/HTML/Element/s
2019-04-02 06:26:05 -07:00
Tom Locke
2380aa094f Clarify semantics of return from deserialize (#2665)
This can trip folks up who are using compile-to-JS languages (ClojureScript in my case), where return semantics may be different.
2019-03-26 07:29:41 -07:00
Aaron Greenlee
edbafa6fcb Glossary Enhancements (#2663)
* Rephrased to removed idiom and better describe Slate.

* Added links to educate folks about the core DOM concepts

* Renamed headline to `Slate Mirrors the Dom`

* Rephrased immutable js introduction

* Corrected spelling error

* Simplified language introducing how one can change values.

* Simplified statement about collection methods

* Added encouraging language for Immutable JS learning suggestion

* Quoted mozilla links

* Suggestions to improve readability of data-model documentation

* Added serialized example value

* Resolved one prettier complaints

* `yarn run prettier`

* anchor/focus point glossary content

* normalized term identifiers

* added mark

* Added plugin

* Added schema

* `yarn run prettier` and enhancements to collapsed, focus, and value
2019-03-26 07:27:48 -07:00
Ivan Ha
b3107fc142 docs: fix immutablejs doc domain (#2655) 2019-03-25 19:23:53 -07:00
Mate Paiva
bd7ee85c9b Fix missing break in last example (#2629)
In the last chunk of code, it was missing the `break` (or `return`). So, if used as is, the bold key will toggle the `code` feature as well.
2019-03-06 16:45:08 -05:00
Brendan
646ff2a80f
Fix onCommand docs that referenced query instead of command (#2625) 2019-03-06 15:44:41 -06:00
Mate Paiva
e5e1e570b8 Remove return true on key down function (#2628)
Correct me if I am wrong, but I believe that this `return true` is a no-op. I removed it and everything kept working as usual. And, when I was following the tutorial, that particular line created an interrogation mark in my brain. So, my suggestion is to remove that line to avoid creating entropy for no reason.
2019-03-06 16:44:35 -05:00
Brendan
a3f91e139f Add @convertkit/slate-lists to plugins page (#2615) 2019-02-28 12:08:34 -08:00
Bryan Haakman
8e659dbd28 Small doc fix for isNodeInRange (#2580) 2019-02-04 16:29:18 -08:00
Brendan
58709123dd Add @convertkit/slate-code to docs (#2568) 2019-01-30 12:12:05 -08:00
Konrad Lisiczyński
63cbfb3266 Clarify children access in renderEditor in docs (#2286)
* Clarify children access in renderEditor in docs

* Applied review changes of renderEditor doc update

* Updated renderEditor docs to match Slate 0.43

* Prettified plugins.md
2019-01-29 16:05:03 -08:00
Vritant Bhardwaj
6bf36a35d4 Update link to source (#2497)
The link to the package directory previously lead to a 404 page.
2019-01-29 16:04:05 -08:00
Nandu
7a6de8725c Add break in the Switch statement for Custom Formatting Walkthrough (#2550)
The Custom Formatting Walkthrough does not work as expected. When
Ctrl + B is pressed it applies both Bold and Code styles to the
content. This is because of the case statement running beyond
the Bold case due to the absence of a break keyword.
2019-01-21 18:27:43 -08:00
Tom Moor
43ee38e39d Update commands.md (#2551)
Fixed incorrect documentation for `moveToRangeOfNode`
2019-01-21 18:25:09 -08:00
Dundercover
76a88a649a Add editor.HasCommand and editor.HasQuery (#2438)
* Add `editor.hasCommand` method

* Add `editor.hasQuery` method

* Rename directories `hasCommand` and `hasQuery` to kebab case

* Add tests for `editor.hasCommand` of React component

* Add tests for `editor.hasQuery` of React component
2018-12-11 11:25:53 -08:00
Ralph Feltis
5cca509db2 Fix typo in resources.md (#2484)
* Adding Guilded to Products list

* Fixing typo
2018-12-05 12:22:37 -08:00
Gijs Nelissen
ab91240af7 Add prezly.com to resources.md (#2483) 2018-12-04 20:57:10 -08:00
Ralph Feltis
bc252de9e1 Adding Guilded to Products list (#2482) 2018-12-04 20:53:19 -08:00
Shawn Erquhart
ce8bfa56a6 add Netlify CMS to products list (#2478) 2018-12-04 11:07:28 -08:00
Denys Vuika
59d184b153 Update saving-and-loading-html-content.md (#2452)
fix example code
2018-12-02 13:15:16 -08:00
Eric Edem
b8420fce3f docs: replace change with editor (#2433)
Just in a couple places.
2018-12-02 13:12:41 -08:00
Knut Melvær
6d8df18f01 Add Sanity.io to the list of products (#2441)
Hi Ian! Took the liberty to add Sanity.io to the list 🙌
2018-11-19 14:43:43 -08:00
Ian Storm Taylor
c615a89fec
Update Introduction.md 2018-11-15 08:33:05 -08:00
Ian Storm Taylor
c184be6da4
Update Introduction.md 2018-11-15 08:32:18 -08:00
Ankit Goel
5849dcb810 Fix broken links (#2426) 2018-11-15 08:08:05 -08:00
Dundercover
4df88cfaeb Add node.isNodeInRange (#2401)
* Add `node.isNodeInRange`

* Add tests for `node.isNodeInRange`
2018-11-08 15:38:18 -08:00
Dundercover
13107b0c43 Add optional id prop to the Editor component (#2402) 2018-11-08 15:36:44 -08:00
Krzysztof Mędrzycki
746b63db7e Improve schema validation for nodes and min/max (#2388)
* Better schema violations for underflow and overflow

* Rename child_required_under/overflow to child_min/max_invalid

* Remove tailing whitespace

* Add tests to cover more branches

* Insert missing comma
2018-11-08 13:05:59 -08:00
Dundercover
698edc24d8 Add node.getLeafXAtRange and node.getRootXAtRange (#2399)
#### Is this adding or improving a _feature_ or fixing a _bug_?

Adding and improving

#### What's the new behavior?

Renames the following node methods (deprecating the old ones):

- `getBlocksAtRangeAsArray` -> `getLeafBlocksAtRangeAsArray`
- `getBlocksAtRange` -> `getLeafBlocksAtRange`
- `getInlinesAtRangeAsArray` -> `getLeafInlinesAtRangeAsArray`
- `getInlinesAtRange` -> `getLeafInlinesAtRange`

Adds the following nodes methods:

- `getRootBlocksAtRange`
- `getRootInlinesAtRange`

#### How does this change work?

Have not changed the implementation of the renamed methods. Added tests for both renamed methods and added methods.

#### Have you checked that...?

* [x] The new code matches the existing patterns and styles.
* [x] The tests pass with `yarn test`.
* [x] The linter passes with `yarn lint`. (Fix errors with `yarn prettier`.)
* [x] The relevant examples still work. (Run examples with `yarn watch`.)

#### Does this fix any issues or need any specific reviewers?

Discussed in #2351
2018-11-08 13:04:27 -08:00
Dundercover
e6d611d726 Add node.getNodesAtRange (#2398)
* Add `Node.getNodesAtRange`

* Add tests for `Node.getNodesAtRange`
2018-11-08 11:31:54 -08:00
CameronAckermanSEL
88aa5a5cc8 added the schema reference to the list of documents for gitbook, renamed Readme.md to Summary to be consistent with conventions. (#2387) 2018-11-06 12:15:43 -08:00
Dundercover
a8972f3f3d Add documentation for the Operation.data property (#2377)
* Add documentation for the `Operation.data` property

* Fix typo in documentation for `Operation` model
2018-11-05 08:29:18 -08:00
Ian Storm Taylor
a09c3c2fdf
Remove renderPlaceholder (#2370)
* add placeholder plugin in slate-react

* remove renderPlaceholder logic

* extract placeholder into a plugin

* remove other old placeholder-based logic

* update changelogs
2018-11-02 17:04:20 -07:00
Dylan
ea3443eb42 Fix a typo (#2362) 2018-11-01 12:15:13 -07:00
Ian Storm Taylor
8dd919dc34
remove change, fold into editor (#2337)
#### Is this adding or improving a _feature_ or fixing a _bug_?

Improvement / debt.

#### What's the new behavior?

This pull request removes the `Change` object as we know it, and folds all of its behaviors into the new `Editor` controller instead, simplifying a lot of the confusion around what is a "change vs. editor" and when to use which. It makes the standard API a **lot** nicer to use I think.

---

###### NEW

**The `editor.command` and `editor.query` methods can take functions.** Previously they only accepted a `type` string and would look up the command or query by type. Now, they also accept a custom function. This is helpful for plugin authors, who want to accept a "command option", since it gives users more flexibility to write one-off commands or queries. For example a plugin could be passed either:

```js
Hotkey({
  hotkey: 'cmd+b',
  command: 'addBoldMark',
})
```

Or a custom command function:

```js
Hotkey({
  hotkey: 'cmd+b',
  command: editor => editor.addBoldMark().moveToEnd()
})
```

###### BREAKING

**The `Change` object has been removed.** The `Change` object as we know it previously has been removed, and all of its behaviors have been folded into the `Editor` controller. This includes the top-level commands and queries methods, as well as methods like `applyOperation` and `normalize`. _All places that used to receive `change` now receive `editor`, which is API equivalent._

**Changes are now flushed to `onChange` asynchronously.** Previously this was done synchronously, which resulted in some strange race conditions in React environments. Now they will always be flushed asynchronously, just like `setState`.

**The `render*` and `decorate*` middleware signatures have changed!** Previously the `render*` and `decorate*` middleware was passed `(props, next)`. However now, for consistency with the other middleware they are all passed `(props, editor, next)`. This way, all middleware always receive `editor` and `next` as their final two arguments.

**The `normalize*` and `validate*` middleware signatures have changed!** Previously the `normalize*` and `validate*` middleware was passed `(node, next)`. However now, for consistency with the other middleware they are all passed `(node, editor, next)`. This way, all middleware always receive `editor` and `next` as their final two arguments.

**The `editor.event` method has been removed.** Previously this is what you'd use when writing tests to simulate events being fired—which were slightly different to other running other middleware. With the simplification to the editor and to the newly-consistent middleware signatures, you can now use `editor.run` directly to simulate events:

```js
editor.run('onKeyDown', { key: 'Tab', ... })
```

###### DEPRECATED

**The `editor.change` method is deprecated.** With the removal of the `Change` object, there's no need anymore to create the small closures with `editor.change()`. Instead you can directly invoke commands on the editor in series, and all of the changes will be emitted asynchronously on the next tick.

```js
editor
  .insertText('word')
  .moveFocusForward(10)
  .addMark('bold')
```

**The `applyOperations` method is deprecated.** Instead you can loop a set of operations and apply each one using `applyOperation`. This is to reduce the number of methods exposed on the `Editor` to keep it simpler.

**The `change.call` method is deprecated.** Previously this was used to call a one-off function as a change method. Now this behavior is equivalent to calling `editor.command(fn)` instead.

---

Fixes: https://github.com/ianstormtaylor/slate/issues/2334
Fixes: https://github.com/ianstormtaylor/slate/issues/2282
2018-10-27 12:18:23 -07:00