diff --git a/docs/Readme.md b/docs/Readme.md
index fbd99725c..08620dc72 100644
--- a/docs/Readme.md
+++ b/docs/Readme.md
@@ -41,8 +41,8 @@
- [Operation](./reference/slate/operation.md)
- [Range](./reference/slate/range.md)
- [Schema](./reference/slate/schema.md)
-- [State](./reference/slate/state.md)
- [Text](./reference/slate/text.md)
+- [Value](./reference/slate/value.md)
- [setKeyGenerator](./reference/slate/utils.md)
- [resetKeyGenerator](./reference/slate/utils.md)
diff --git a/docs/guides/changes.md b/docs/guides/changes.md
index 35991c14a..eb768651d 100644
--- a/docs/guides/changes.md
+++ b/docs/guides/changes.md
@@ -1,9 +1,9 @@
# Changes
-All changes to a Slate editor's state, whether it's the `selection`, `document`, `history`, etc. happen via "changes"—specifically, via the [`Change`](../reference/slate/change.md) model.
+All changes to a Slate editor's value, whether it's the `selection`, `document`, `history`, etc. happen via "changes"—specifically, via the [`Change`](../reference/slate/change.md) model.
-This is important because the `Change` model is responsible for ensuring that every change to a Slate state can be expressed in terms of low-level [operations](../reference/slate/operation.md). But you don't have to worry about that, because it happens automatically.
+This is important because the `Change` model is responsible for ensuring that every change to a Slate value can be expressed in terms of low-level [operations](../reference/slate/operation.md). But you don't have to worry about that, because it happens automatically.
You just need to understand changes...
@@ -58,15 +58,15 @@ These are changes like `delete()`, `addMark()`, `insertBlock()`, etc. that are t
### On the Selection
-These are changes like `blur()`, `collapseToStart()`, `moveToRangeOf()`, etc. that change the `state.selection` model and update the user's cursor without affecting the content of the document.
+These are changes like `blur()`, `collapseToStart()`, `moveToRangeOf()`, etc. that change the `value.selection` model and update the user's cursor without affecting the content of the document.
### On a Specific Node
These are changes like `removeNodeByKey()`, `setNodeByKey()`, `removeMarkByKey()`, etc. that take a `key` string referring to a specific node, and then change that node in different ways. These are often what you use when making programmatic changes from inside your custom node components, where you already have a reference to `props.node.key`.
-### On the Top-level State
+### On the Top-level Value
-These are changes like `setData()`, `setDecorations()`, etc. that act on the other top-level properties of the [`State`](../reference/slate/state.md) object. These are more advanced.
+These are changes like `setData()`, `setDecorations()`, etc. that act on the other top-level properties of the [`Value`](../reference/slate/value.md) object. These are more advanced.
### On the History
@@ -75,7 +75,7 @@ These are changes like `undo()`, `redo()`, etc. that use the operation history a
## Making Changes
-When you decide you want to make a change to the Slate state, you're almost always in one of four places...
+When you decide you want to make a change to the Slate value, you're almost always in one of four places...
### 1. In Slate Handlers
@@ -116,7 +116,7 @@ class Image extends React.Component {
}
```
-The `editor.change()` method will create a new [`Change`](../reference/slate/change.md) object for you, based on the editor's current state. You can then call any change methods you want, and the new state will be applied to the editor.
+The `editor.change()` method will create a new [`Change`](../reference/slate/change.md) object for you, based on the editor's current value. You can then call any change methods you want, and the new value will be applied to the editor.
### 3. From Schema Rules
@@ -143,17 +143,17 @@ When a rule's validation fails, Slate passes a [`Change`](../reference/slate/cha
This is the fourth place you might want to make changes, and also the most dangerous. You should know that any changes you make outside of the Slate editor might not be seen by your plugins, might interact with the history in weird ways, and may not work with collaborative editing implements.
-That said, if that's okay with you, you can make changes manually by using the `change()` method on a Slate [`State`](../reference/slate/state.md). For example:
+That said, if that's okay with you, you can make changes manually by using the `change()` method on a Slate [`Value`](../reference/slate/value.md). For example:
```js
-const change = state.change()
+const change = value.change()
.selectAll()
.delete()
-const newState = change.state
+const newValue = change.value
```
-Note that you'll need to then grab the new state value by accessing the `change.state` property directly.
+Note that you'll need to then grab the new value by accessing the `change.value` property directly.
## Reusing Changes
diff --git a/docs/guides/data-model.md b/docs/guides/data-model.md
index f462f6149..c2ab891fb 100644
--- a/docs/guides/data-model.md
+++ b/docs/guides/data-model.md
@@ -33,13 +33,13 @@ Collections of Slate objects are represented as immutable `Lists`, `Sets`, `Stac
If you haven't used Immutable.js before, there is definitely a learning curve. Before you give into Slate, you should check out the [Immutable.js docs](https://facebook.github.io/immutable-js/docs/#/). Once you get the hang of it won't slow you down at all, but it will take a few days to get used to, and you might write things a little "un-performantly" to start.
-## The "State"
+## The "Value"
-The top-level object in Slate—the object encapsulates the entire value of an Slate editor—is called a [`State`](../reference/slate/state.md).
+The top-level object in Slate—the object encapsulates the entire value of an Slate editor—is called a [`Value`](../reference/slate/value.md).
It is made up of a document filled with content, and a selection representing the user's current cursor selection. It also has a history, to keep track of changes, and a few other more advanced properties like `decorations` and `data`.
-> 📋 For more info, check out the [`State` reference](../reference/slate/state.md).
+> 📋 For more info, check out the [`Value` reference](../reference/slate/value.md).
## Documents and Nodes
@@ -60,7 +60,7 @@ Unlike the DOM though, Slate enforces a few more restrictions on its documents,
- **Blocks and inlines must always contain at least one text node.** This is to ensure that the user's cursor can always "enter" the nodes, and to make sure that ranges can be created referencing them.
-Slate enforces all of these restrictions for you automatically. Any time you [perform changes](./changes.md) to the document, Slate will check if the document is invalid, and if so it will return it to a "normalized" state.
+Slate enforces all of these restrictions for you automatically. Any time you [perform changes](./changes.md) to the document, Slate will check if the document is invalid, and if so it will return it to a "normalized" value.
> 🙃 Fun fact: normalizing is actually based on the DOM's [`Node.normalize()`](https://developer.mozilla.org/en-US/docs/Web/API/Node/normalize)!
diff --git a/docs/guides/plugins.md b/docs/guides/plugins.md
index 5ba8a7b62..261849286 100644
--- a/docs/guides/plugins.md
+++ b/docs/guides/plugins.md
@@ -22,7 +22,7 @@ Here's a really simple plugin:
}
},
onClick(event, change, editor) {
- if (change.state.isBlurred) {
+ if (change.value.isBlurred) {
change.selectAll().focus()
}
}
diff --git a/docs/reference/slate-html-serializer/index.md b/docs/reference/slate-html-serializer/index.md
index 907aacb8b..bbf8405aa 100644
--- a/docs/reference/slate-html-serializer/index.md
+++ b/docs/reference/slate-html-serializer/index.md
@@ -49,16 +49,16 @@ This parse function should return the `
` node of the DOM.
## Methods
### `Html.deserialize`
-`Html.deserialize(html: String, [options: Object]) => State`
+`Html.deserialize(html: String, [options: Object]) => Value`
-Deserialize an HTML `string` into a [`State`](../slate/state.md). How the string is deserialized will be determined by the rules that the HTML serializer was constructed with.
+Deserialize an HTML `string` into a [`Value`](../slate/value.md). How the string is deserialized will be determined by the rules that the HTML serializer was constructed with.
-If you pass `toJSON: true` as an option, the return value will be a JSON object instead of a [`State`](../slate/state.md) object.
+If you pass `toJSON: true` as an option, the return value will be a JSON object instead of a [`Value`](../slate/value.md) object.
### `Html.serialize`
-`Html.serialize(state: State, [options: Object]) => String || Array`
+`Html.serialize(value: Value, [options: Object]) => String || Array`
-Serialize a `state` into an HTML string. How the string is serialized will be determined by the rules that the HTML serializer was constructed with.
+Serialize a `value` into an HTML string. How the string is serialized will be determined by the rules that the HTML serializer was constructed with.
If you pass `render: false` as an option, the return value will instead be an iterable list of the top-level React elements, to be rendered as children in your own React component.
@@ -80,7 +80,7 @@ Each rule must define two properties:
### `rule.deserialize`
`rule.deserialize(el: Element, next: Function) => Object || Void`
-The `deserialize` function receives a DOM element and should return a plain Javascript object representing the deserialized state, or nothing if the rule in question doesn't know how to deserialize the object, in which case the next rule in the stack will be attempted.
+The `deserialize` function receives a DOM element and should return a plain Javascript object representing the deserialized value, or nothing if the rule in question doesn't know how to deserialize the object, in which case the next rule in the stack will be attempted.
The object should be one of:
diff --git a/docs/reference/slate-hyperscript/index.md b/docs/reference/slate-hyperscript/index.md
index 8bbd48619..da012bfa6 100644
--- a/docs/reference/slate-hyperscript/index.md
+++ b/docs/reference/slate-hyperscript/index.md
@@ -16,15 +16,15 @@ A hyperscript helper for writing Slate documents with JSX!
import h from 'slate-hyperscript'
-const state = (
-
+const value = (
+
A string of bold in a Slate editor!
-
+
)
```
@@ -49,15 +49,15 @@ const h = createHyperscript({
},
})
-const state = (
-
+const value = (
+
A string of bold in a Slate editor!
-
+
)
```
diff --git a/docs/reference/slate-plain-serializer/index.md b/docs/reference/slate-plain-serializer/index.md
index 7b0976975..8de8a6ffc 100644
--- a/docs/reference/slate-plain-serializer/index.md
+++ b/docs/reference/slate-plain-serializer/index.md
@@ -5,7 +5,7 @@
import Plain from 'slate-plain-serializer'
```
-A serializer that converts a Slate [`State`](../slate/state.md) to and from a plain text string.
+A serializer that converts a Slate [`Value`](../slate/value.md) to and from a plain text string.
## Example
@@ -20,13 +20,13 @@ Check out http://slatejs.org for examples!
## Methods
### `Plain.deserialize`
-`Plain.deserialize(string: String, [options: Object]) => State`
+`Plain.deserialize(string: String, [options: Object]) => Value`
-Deserialize a plain text `string` into a [`State`](../slate/state.md). A series of blocks will be created by splitting the input string on `\n` characters. Each block is given a type of `'line'`.
+Deserialize a plain text `string` into a [`Value`](../slate/value.md). A series of blocks will be created by splitting the input string on `\n` characters. Each block is given a type of `'line'`.
-If you pass `toJSON: true` as an option, the return value will be a JSON object instead of a [`State`](../slate/state.md) object.
+If you pass `toJSON: true` as an option, the return value will be a JSON object instead of a [`Value`](../slate/value.md) object.
### `Plain.serialize`
-`Plain.serialize(state: State) => String`
+`Plain.serialize(value: Value) => String`
-Serialize a `state` into a plain text string. Each direct child block of the document will be separated by a `\n` character.
+Serialize a `value` into a plain text string. Each direct child block of the document will be separated by a `\n` character.
diff --git a/docs/reference/slate-prop-types/index.md b/docs/reference/slate-prop-types/index.md
index d240278ab..f69f33687 100644
--- a/docs/reference/slate-prop-types/index.md
+++ b/docs/reference/slate-prop-types/index.md
@@ -19,7 +19,7 @@ class Toolbar extends React.Component {
propTypes = {
block: Types.block,
schema: Types.schema.isRequired,
- state: Types.state.isRequired,
+ value: Types.value.isRequired,
}
...
@@ -110,10 +110,6 @@ Ensure that a value is a Slate `Schema`.
Ensure that a value is a Slate `Stack`.
-### `state`
-
-Ensure that a value is a Slate `State`.
-
### `text`
Ensure that a value is a Slate [`Text`](../slate/text.md).
@@ -121,3 +117,7 @@ Ensure that a value is a Slate [`Text`](../slate/text.md).
### `texts`
Ensure that a value is an immutable `List` of Slate [`Text`](../slate/text.md) objects.
+
+### `value`
+
+Ensure that a value is a Slate `Value`.
diff --git a/docs/reference/slate-react/core-plugins.md b/docs/reference/slate-react/core-plugins.md
index 5eeb6850b..64ab7f094 100644
--- a/docs/reference/slate-react/core-plugins.md
+++ b/docs/reference/slate-react/core-plugins.md
@@ -34,7 +34,7 @@ When the user drops content into the editor, the core plugin handles drops of ty
### `onKeyDown`
-When a key is pressed, the core plugin handles performing some of the "native" behavior that `contenteditable` elements must do. For example it splits blocks on `enter`, removes characters `backspace`, triggers an undo state from the history on `cmd-z`, etc.
+When a key is pressed, the core plugin handles performing some of the "native" behavior that `contenteditable` elements must do. For example it splits blocks on `enter`, removes characters `backspace`, triggers an undo from the history on `cmd-z`, etc.
### `onPaste`
@@ -64,10 +64,10 @@ However, sometimes you might want to disable the logic of the core plugin withou
A noop `onBeforeInput` handler looks like:
```js
-function onBeforeInput(event, state) {
+function onBeforeInput(event, change, editor) {
event.preventDefault()
- return state
+ return false
}
```
-Notice that is calls `event.preventDefault()` to prevent the default browser behavior, and it returns the current `state` to prevent the editor from continuing to resolve its plugins stack.
+Notice that is calls `event.preventDefault()` to prevent the default browser behavior, and it returns `false` to prevent the editor from continuing to resolve its plugins stack.
diff --git a/docs/reference/slate-react/custom-nodes.md b/docs/reference/slate-react/custom-nodes.md
index 3a93e1f6e..de5f117c8 100644
--- a/docs/reference/slate-react/custom-nodes.md
+++ b/docs/reference/slate-react/custom-nodes.md
@@ -4,7 +4,7 @@
Slate will render custom nodes for [`Block`](../slate/block.md) and [`Inline`](../slate/inline.md) models, based on what you pass in as your schema. This allows you to completely customize the rendering behavior of your Slate editor.
-## Properties
+## Props
```js
<{Custom}
@@ -15,7 +15,6 @@ Slate will render custom nodes for [`Block`](../slate/block.md) and [`Inline`](.
node={Node}
parent={Node}
readOnly={Boolean}
- state={State}
/>
```
@@ -53,10 +52,10 @@ return (
### `editor`
`Editor`
-A reference to the Slate [``](./editor.md) instance. This allows you to retrieve the current `state` of the editor, or perform a `change` on the state. For example:
+A reference to the Slate [``](./editor.md) instance. This allows you to retrieve the current `value` of the editor, or perform a `change` on the value. For example:
```js
-const state = editor.getState()
+const value = editor.value
```
```js
editor.change((change) => {
@@ -84,11 +83,6 @@ A reference to the parent of the current [`Node`](../slate/node.md) being render
Whether the editor is in "read-only" mode, where all of the rendering is the same, but the user is prevented from editing the editor's content.
-### `state`
-`State`
-
-A reference to the current [`State`](../slate/state.md) of the editor.
-
## `shouldNodeComponentUpdate`
By default, Slate implements a `shouldComponentUpdate` preventing useless re-renders for node components. While the default implementation covers most use cases, you can customize the logic to fit your needs. For example:
diff --git a/docs/reference/slate-react/editor.md b/docs/reference/slate-react/editor.md
index 21ed18d86..f3d52cbe5 100644
--- a/docs/reference/slate-react/editor.md
+++ b/docs/reference/slate-react/editor.md
@@ -8,7 +8,7 @@ import { Editor } from 'slate-react'
The top-level React component that renders the Slate editor itself.
-## Properties
+## Props
```js
@@ -44,7 +44,7 @@ An optional class name to apply to the content editable element.
### `onChange`
`Function onChange(change: Change)`
-A change handler that will be called with the `change` that applied the change. You should usually pass the newly changed `change.state` back into the editor through its `state` property. This hook allows you to add persistence logic to your editor.
+A change handler that will be called with the `change` that applied the change. You should usually pass the newly changed `change.value` back into the editor through its `value` property. This hook allows you to add persistence logic to your editor.
### `plugins`
`Array`
@@ -66,10 +66,10 @@ Whether spellcheck is turned on for the editor.
ARIA property to define the role of the editor, it defaults to `textbox` when editable.
-### `state`
-`State`
+### `value`
+`Value`
-A [`State`](../slate/state.md) object representing the current state of the editor.
+A [`Value`](../slate/value.md) object representing the current value of the editor.
### `style`
`Object`
@@ -81,13 +81,11 @@ An optional dictionary of styles to apply to the content editable element.
Indicates if it should participate to [sequential keyboard navigation](https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/tabindex).
-## Placeholder Properties
+## Placeholder Props
```js
```
@@ -96,18 +94,8 @@ Indicates if it should participate to [sequential keyboard navigation](https://d
A placeholder string (or React element) that will be rendered as the default block type's placeholder.
-### `placeholderClassName`
-`String`
-An optional class name to apply to the default block type's placeholder.
-
-### `placeholderStyle`
-`Object`
-
-An optional dictionary of styles to apply to the default block type's placeholder. If `placeholder` is a string, and no class name or style dictionary is passed, this property will default to `{ opacity: '0.333' }`.
-
-
-## Plugin-like Properties
+## Plugin-like Props
In addition to its own properties, the editor allows passing any of the properties that a [plugin](./plugins.md) defines as well.
@@ -123,7 +111,7 @@ const plugins = [
```
@@ -139,7 +127,7 @@ const plugins = [
```
@@ -158,29 +146,40 @@ const plugins = [
To see how these properties behave, check out the [Plugins reference](./plugins.md).
-## Methods
+## Instance Methods
### `blur`
`blur() => Void`
Programmatically blur the editor.
+### `change`
+`change(fn) => Void`
+`change(fn, ...args) => Void`
+
+Programmatically invoke a change `fn` on the editor. The function will be invokved with a new `change` object representing the editor's current value.
+
+If extra `...args` are passed in, the change `fn` will be invoked with `(change, ...args)`, so you can use this as a shorthand for performing single-function changes.
+
### `focus`
`focus() => Void`
Programmatically focus the editor.
-### `getSchema`
-`getSchema() => Schema`
-Return the editor's current schema.
+## Instance Properties
-### `getState`
-`getState() => State`
+### `schema`
+`Schema`
-Return the editor's current state.
+The editor's current schema.
-### `onChange`
-`onChange(change: Change) => Void`
+### `stack`
+`Stack`
-Invoking this method will update the state of the editor with the `change`, running it through all of it's plugins, and passing it the parent component, before it cycles back down as the new `state` property of the editor.
+The editor's current stack.
+
+### `value`
+`Value`
+
+The editor's current value.
diff --git a/docs/reference/slate-react/plugins.md b/docs/reference/slate-react/plugins.md
index 457266f92..9aead6aa9 100644
--- a/docs/reference/slate-react/plugins.md
+++ b/docs/reference/slate-react/plugins.md
@@ -40,7 +40,7 @@ export default function MySlatePlugin(options) {
All of the event handler properties are passed the same React `event` object you are used to from React's event handlers. They are also passed a `change` object representing any changes that have resulted from the event, and the `editor` instance itself.
-Each event handler can choose to call methods on the `change` object, in which case the editor's state will be updated.
+Each event handler can choose to call methods on the `change` object, in which case the editor's value will be updated.
If the return value of a plugin handler is `null`, the editor will simply continue resolving the plugin stack. However, if you return a non-null value, the editor will break out of the loop.
@@ -74,7 +74,7 @@ This handler is equivalent to the `onCopy` handler.
### `onDrop`
`Function onDrop(event: Event, change: Change, editor: Editor) => Change || Void`
-This handler is called when the user drops content into the `contenteditable` element. The event is already prevented by default, so you must define a state change to have any affect occur.
+This handler is called when the user drops content into the `contenteditable` element. The event is already prevented by default, so you must define a value change to have any affect occur.
### `onKeyDown`
`Function onKeyDown(event: Event, change: Change, editor: Editor) => Change || Void`
@@ -91,7 +91,7 @@ This handler is called when any key is released in the `contenteditable` element
### `onPaste`
`Function onPaste(event: Event, change: Change, editor: Editor) => Change || Void`
-This handler is called when the user pastes content into the `contenteditable` element. The event is already prevented by default, so you must define a state change to have any affect occur.
+This handler is called when the user pastes content into the `contenteditable` element. The event is already prevented by default, so you must define a value change to have any affect occur.
### `onSelect`
`Function onSelect(event: Event, change: Change, editor: Editor) => Change || Void`
@@ -112,17 +112,12 @@ _Note: This is **not** Slate's internal selection representation (although it mi
### `onChange`
`Function onChange(change: Change) => Any || Void`
-The `onChange` handler isn't a native browser event handler. Instead, it is invoked whenever the editor state changes. This allows plugins to augment a change however they want.
+The `onChange` handler isn't a native browser event handler. Instead, it is invoked whenever the editor value changes. This allows plugins to augment a change however they want.
-### `onBeforeChange`
-`Function onBeforeChange(change: Change) => Change || Void`
+### `renderEditor`
+`Function renderEditor(props: Object, editor: Editor) => Object || Void`
-The `onBeforeChange` handler isn't a native browser event handler. Instead, it is invoked whenever the editor receives a new state and before propagating a new change to `onChange`.
-
-### `render`
-`Function render(props: Object, state: State, editor: Editor) => Object || Void`
-
-The `render` property allows you to define higher-order-component-like behavior. It is passed all of the properties of the editor, including `props.children`. You can then choose to wrap the existing `children` in any custom elements or proxy the properties however you choose. This can be useful for rendering toolbars, styling the editor, rendering validation, etc. Remember that the `render` function has to render `props.children` for editor's children to render.
+The `renderEditor` property allows you to define higher-order-component-like behavior. It is passed all of the properties of the editor, including `props.children`. You can then choose to wrap the existing `children` in any custom elements or proxy the properties however you choose. This can be useful for rendering toolbars, styling the editor, rendering validation, etc. Remember that the `renderEditor` function has to render `props.children` for editor's children to render.
### `schema`
`Object`
diff --git a/docs/reference/slate-react/utils.md b/docs/reference/slate-react/utils.md
index a3e2efdae..fe5369eb0 100644
--- a/docs/reference/slate-react/utils.md
+++ b/docs/reference/slate-react/utils.md
@@ -38,16 +38,16 @@ Find the DOM range from a Slate [`Range`](../slate/range.md).
```js
function onChange(change) {
- const { state } = change
- const range = findDOMRange(state.selection)
+ const { value } = change
+ const range = findDOMRange(value.selection)
// Do something with the DOM `range`...
}
```
### `findNode`
-`findNode(element: DOMElement, state: State) => Node`
+`findNode(element: DOMElement, value: Value) => Node`
-Find the Slate node from a DOM `element` and Slate `state`.
+Find the Slate node from a DOM `element` and Slate `value`.
```js
function onSomeNativeEvent(event) {
@@ -57,27 +57,27 @@ function onSomeNativeEvent(event) {
```
### `findRange`
-`findRange(selection: DOMSelection, state: State) => Range`
-`findRange(range: DOMRange, state: State) => Range`
+`findRange(selection: DOMSelection, value: Value) => Range`
+`findRange(range: DOMRange, value: Value) => Range`
-Find the Slate range from a DOM `range` or `selection` and a Slate `state`.
+Find the Slate range from a DOM `range` or `selection` and a Slate `value`.
```js
function onSomeNativeEvent() {
// You can find a range from a native DOM selection...
const nativeSelection = window.getSelection()
- const range = findRange(nativeSelection, state)
+ const range = findRange(nativeSelection, value)
// ...or from a native DOM range...
const nativeRange = nativeSelection.getRangeAt(0)
- const range = findRange(nativeRange, state)
+ const range = findRange(nativeRange, value)
}
```
### `getEventRange`
-`getEventRange(event: DOMEvent|ReactEvent, state: State) => Range`
+`getEventRange(event: DOMEvent|ReactEvent, value: Value) => Range`
-Get the affected Slate range from a DOM `event` and Slate `state`.
+Get the affected Slate range from a DOM `event` and Slate `value`.
```js
function onDrop(event, change, editor) {
@@ -89,7 +89,7 @@ function onDrop(event, change, editor) {
### `getEventTransfer`
`getEventTransfer(event: DOMEvent|ReactEvent) => Object`
-Get the Slate-related data from a DOM `event` and Slate `state`.
+Get the Slate-related data from a DOM `event` and Slate `value`.
```js
function onDrop(event, change, editor) {
@@ -109,8 +109,8 @@ Sets the Slate-related `data` with `type` on an `event`. The `type` must be one
```js
function onDragStart(event, change, editor) {
- const { state } = change
- const { startNode } = state
+ const { value } = change
+ const { startNode } = value
setEventTransfer(event, 'node', startNode)
}
```
diff --git a/docs/reference/slate-simulator/index.md b/docs/reference/slate-simulator/index.md
index 3fdc4f2c6..958891e4d 100644
--- a/docs/reference/slate-simulator/index.md
+++ b/docs/reference/slate-simulator/index.md
@@ -13,9 +13,9 @@ A simulator to help writing tests for Slate editors and plugins.
```js
import Simulator from 'slate-simulator'
-const state = ...
+const value = ...
const plugins = [ ... ]
-const simulator = new Simulator({ state, plugins })
+const simulator = new Simulator({ value, plugins })
simulator
.focus()
@@ -27,7 +27,7 @@ simulator
.beforeInput({ data: '!' })
.keyDown({ key: 'Enter' })
-const nextState = simulator.state
+const newValue = simulator.value
```
diff --git a/docs/reference/slate/change.md b/docs/reference/slate/change.md
index 09fb93f48..8385cd008 100644
--- a/docs/reference/slate/change.md
+++ b/docs/reference/slate/change.md
@@ -5,16 +5,16 @@
import { Change } from 'slate'
```
-A change allows you to define a series of changes you'd like to make to the current [`State`](./state.md).
+A change allows you to define a series of changes you'd like to make to the current [`Value`](./value.md).
All changes are performed through `Change` objects, so that a history of changes can be preserved for use in undo/redo operations, and to make collaborative editing possible.
## Properties
-### `state`
+### `value`
-A [`State`](./state.md) with the change's current operations applied. Each time you run a new change function this property will be updated.
+A [`Value`](./value.md) with the change's current operations applied. Each time you run a new change function this property will be updated.
## Methods
@@ -46,7 +46,7 @@ function onSomeEvent(event, change) {
```
-## Current State Changes
+## Current Value Changes
These changes act on the `document` based on the current `selection`. They are equivalent to calling the [Document Changes](#document-changes) with the current selection as the `range` argument, but they are there for convenience, since you often want to act with the current selection, as a user would.
diff --git a/docs/reference/slate/document.md b/docs/reference/slate/document.md
index aea2276d0..5a00aca06 100644
--- a/docs/reference/slate/document.md
+++ b/docs/reference/slate/document.md
@@ -9,7 +9,7 @@ The top-level node in Slate's document model.
Documents are made up of block nodes, inline nodes, and text nodes—just like in the DOM. Note that direct descendants of a document node have to be block nodes.
-In some places, you'll see mention of "fragments", which are also `Document` objects, just that aren't attached to the main `State`. For example, when cutting-and-pasting a selection of content, that content will be referred to as a document "fragment".
+In some places, you'll see mention of "fragments", which are also `Document` objects, just that aren't attached to the main `Value`. For example, when cutting-and-pasting a selection of content, that content will be referred to as a document "fragment".
## Properties
diff --git a/docs/reference/slate/operation.md b/docs/reference/slate/operation.md
index 48bfad211..6c0631f17 100644
--- a/docs/reference/slate/operation.md
+++ b/docs/reference/slate/operation.md
@@ -1,9 +1,9 @@
# Operation
-An operation is the lowest-level description of a specific change to a part of Slate's state. They are designed to be collaborative-editing friendly.
+An operation is the lowest-level description of a specific change to a part of Slate's value. They are designed to be collaborative-editing friendly.
-All of the [`Change`](./change.md) methods result in operations being created and applied to a [`State`](./state.md) They're accessible via the `change.operations` property.
+All of the [`Change`](./change.md) methods result in operations being created and applied to a [`Value`](./value.md) They're accessible via the `change.operations` property.
There are a handful of Slate operation types. The goal is to have the fewest possible types, while still maintaining the necessary semantics for collaborative editing to work.
@@ -160,7 +160,7 @@ Set new `properties` on the node at `path`.
Split the node at `path` at `position`. The `position` refers to either the index in the child nodes in the case of [`Block`](./block.md) or [`Inline`](./inline.md) nodes, and the index in the characters in the case of [`Text`](./text.md) nodes. In the case of nested splits, `target` refers to the target path of the child split operation.
-## State Operations
+## Value Operations
### `set_selection`
@@ -172,27 +172,27 @@ Split the node at `path` at `position`. The `position` refers to either the inde
}
```
-Set new `properties` on the state's selection.
+Set new `properties` on the selection.
-### `set_state`
+### `set_value`
```js
{
- type: 'set_state',
+ type: 'set_value',
properties: Object,
- state: Object,
+ value: Object,
}
```
-Set new `properties` on a state. Properties can contain `data` and `decorations`.
+Set new `properties` on a value. Properties can contain `data` and `decorations`.
## Helpers
### `apply`
-`apply(state: State, operation: Object) => State`
+`apply(value: Value, operation: Object) => Value`
-Applies an `operation` to a `state` object.
+Applies an `operation` to a `value` object.
### `invert`
`invert(operation: Object) => Object`
diff --git a/docs/reference/slate/state.md b/docs/reference/slate/value.md
similarity index 76%
rename from docs/reference/slate/state.md
rename to docs/reference/slate/value.md
index 096937fdd..40cd231cf 100644
--- a/docs/reference/slate/state.md
+++ b/docs/reference/slate/value.md
@@ -1,21 +1,21 @@
-# `State`
+# `Value`
```js
-import { State } from 'slate'
+import { Value } from 'slate'
```
-A `State` is the top-level representation of data in Slate, containing both a [`Document`](./document.md) and a selection [`Range`](./range.md). It's what you need to pass into the Slate [``](../slate-react/editor.md) to render something onto the page.
+A `Value` is the top-level representation of data in Slate, containing both a [`Document`](./document.md) and a selection [`Range`](./range.md). It's what you need to pass into the Slate [``](../slate-react/editor.md) to render something onto the page.
-All changes to the document and selection are also performed through the state object, so that they can stay in sync, and be propagated to its internal history of undo/redo state.
+All changes to the document and selection are also performed through the value object, so that they can stay in sync, and be propagated to its internal history of undo/redo value.
-For convenience, in addition to changes, many of the selection and document properties are exposed as proxies on the `State` object.
+For convenience, in addition to changes, many of the selection and document properties are exposed as proxies on the `Value` object.
## Properties
```js
-State({
+Value({
document: Document,
selection: Range,
history: History,
@@ -28,7 +28,7 @@ State({
### `data`
`Data`
-An object containing arbitrary data for the state.
+An object containing arbitrary data for the value.
### `decorations`
`List|Null`
@@ -38,7 +38,7 @@ A list of ranges in the document with marks that aren't part of the content itse
### `document`
`Document`
-The current document of the state.
+The current document of the value.
### `history`
`History`
@@ -48,17 +48,17 @@ An object that stores the history of changes.
### `schema`
`Schema`
-An object representing the schema of the state's document.
+An object representing the schema of the value's document.
### `selection`
`Range`
-The current selection of the state.
+The current selection of the value.
## Computed Properties
-These properties aren't supplied when creating a `State`, but are instead computed based on the current `document` and `selection`.
+These properties aren't supplied when creating a `Value`, but are instead computed based on the current `document` and `selection`.
### `{edge}Text`
`Text`
@@ -167,20 +167,20 @@ Whether the current selection is empty.
## Static Methods
-### `State.create`
-`State.create(properties: Object) => State`
+### `Value.create`
+`Value.create(properties: Object) => Value`
-Create a new `State` instance with `properties`.
+Create a new `Value` instance with `properties`.
-### `State.fromJSON`
-`State.fromJSON(object: Object) => State`
+### `Value.fromJSON`
+`Value.fromJSON(object: Object) => Value`
-Create a state from a JSON `object`.
+Create a value from a JSON `object`.
-### `State.isState`
-`State.isState(maybeState: Any) => Boolean`
+### `Value.isValue`
+`Value.isValue(any: Any) => Boolean`
-Returns a boolean if the passed in argument is a `State`.
+Returns a boolean if the passed in argument is a `Value`.
## Instance Methods
@@ -188,9 +188,9 @@ Returns a boolean if the passed in argument is a `State`.
### `change`
`change() => Change`
-Create a new [`Change`](./change.md) that acts on the current state.
+Create a new [`Change`](./change.md) that acts on the current value.
### `toJSON`
`toJSON() => Object`
-Returns a JSON representation of the state.
+Returns a JSON representation of the value.
diff --git a/docs/walkthroughs/adding-event-handlers.md b/docs/walkthroughs/adding-event-handlers.md
index 94848e5ec..2f47e2d7a 100644
--- a/docs/walkthroughs/adding-event-handlers.md
+++ b/docs/walkthroughs/adding-event-handlers.md
@@ -7,7 +7,7 @@
Okay, so you've got Slate installed and rendered on the page, and when you type in it, you can see the changes reflected. But you want to do more than just type a plaintext string.
-What makes Slate great is how easy it is to customize. Just like other React components you're used to, Slate allows you to pass in handlers that are triggered on certain events. You've already seen on the `onChange` handler can be used to store the changed editor state, but let's try add something more...
+What makes Slate great is how easy it is to customize. Just like other React components you're used to, Slate allows you to pass in handlers that are triggered on certain events. You've already seen on the `onChange` handler can be used to store the changed editor value, but let's try add something more...
We'll show you how to use the `onKeyDown` handler to change the editor's content when the user presses a button.
@@ -17,17 +17,17 @@ So we start with our app from earlier:
class App extends React.Component {
state = {
- state: initialState
+ value: initialValue
}
- onChange = ({ state }) => {
- this.setState({ state })
+ onChange = ({ value }) => {
+ this.setState({ value })
}
render() {
return (
)
@@ -42,11 +42,11 @@ And now we'll add an `onKeyDown` handler:
class App extends React.Component {
state = {
- state: initialState
+ value: initialValue
}
- onChange = ({ state }) => {
- this.setState({ state })
+ onChange = ({ value }) => {
+ this.setState({ value })
}
// Define a new handler which prints the key that was pressed.
@@ -57,7 +57,7 @@ class App extends React.Component {
render() {
return (
@@ -77,11 +77,11 @@ Our `onKeyDown` handler might look like this:
class App extends React.Component {
state = {
- state: initialState
+ value: initialValue
}
- onChange = ({ state }) => {
- this.setState({ state })
+ onChange = ({ value }) => {
+ this.setState({ value })
}
onKeyDown = (event, change) => {
@@ -91,7 +91,7 @@ class App extends React.Component {
// Prevent the ampersand character from being inserted.
event.preventDefault()
- // Change the state by inserting "and" at the cursor's position.
+ // Change the value by inserting "and" at the cursor's position.
change.insertText('and')
return true
}
@@ -99,7 +99,7 @@ class App extends React.Component {
render() {
return (
@@ -111,7 +111,7 @@ class App extends React.Component {
With that added, try typing `&`, and you should see it automatically become `and` instead!
-That gives you a sense for what you can do with Slate's event handlers. Each one will be called with the `event` object, and the current `state` of the editor. And if you return a new `state`, the editor will be updated. Simple!
+That gives you a sense for what you can do with Slate's event handlers. Each one will be called with the `event` object, and a `change` object that lets you perform changes to the editor's value. Simple!
Next: Defining Custom Block Nodes
diff --git a/docs/walkthroughs/applying-custom-formatting.md b/docs/walkthroughs/applying-custom-formatting.md
index a47a38c61..79044b896 100644
--- a/docs/walkthroughs/applying-custom-formatting.md
+++ b/docs/walkthroughs/applying-custom-formatting.md
@@ -15,17 +15,17 @@ So we start with our app from earlier:
class App extends React.Component {
state = {
- state: initialState,
+ value: initialValue,
}
- onChange = ({ state }) => {
- this.setState({ state })
+ onChange = ({ value }) => {
+ this.setState({ value })
}
onKeyDown = (event, change) => {
if (event.key != '`' || !event.metaKey) return
event.preventDefault()
- const isCode = change.state.blocks.some(block => block.type == 'code')
+ const isCode = change.value.blocks.some(block => block.type == 'code')
change.setBlock(isCode ? 'paragraph' : 'code')
return true
@@ -34,7 +34,7 @@ class App extends React.Component {
render() {
return (
{
- this.setState({ state })
+ onChange = ({ value }) => {
+ this.setState({ value })
}
onKeyDown = (event, change) => {
@@ -77,7 +77,7 @@ class App extends React.Component {
}
// When "`" is pressed, keep our existing code block logic.
case '`': {
- const isCode = change.state.blocks.some(block => block.type == 'code')
+ const isCode = change.value.blocks.some(block => block.type == 'code')
event.preventDefault()
change.setBlock(isCode ? 'paragraph' : 'code')
return true
@@ -88,7 +88,7 @@ class App extends React.Component {
render() {
return (
{
- this.setState({ state })
+ onChange = ({ value }) => {
+ this.setState({ value })
}
onKeyDown = (event, change) => {
@@ -145,9 +145,9 @@ class App extends React.Component {
return true
}
case '`': {
- const isCode = change.state.blocks.some(block => block.type == 'code')
+ const isCode = change.value.blocks.some(block => block.type == 'code')
event.preventDefault()
- state.setBlock(isCode ? 'paragraph' : 'code')
+ value.setBlock(isCode ? 'paragraph' : 'code')
return true
}
}
@@ -156,7 +156,7 @@ class App extends React.Component {
render() {
return (
{
- this.setState({ state })
+ onChange = ({ value }) => {
+ this.setState({ value })
}
onKeyDown = (event, change) => {
@@ -32,7 +32,7 @@ class App extends React.Component {
render() {
return (
@@ -71,11 +71,11 @@ function CodeNode(props) {
class App extends React.Component {
state = {
- state: initialState,
+ value: initialValue,
}
- onChange = ({ state }) => {
- this.setState({ state })
+ onChange = ({ value }) => {
+ this.setState({ value })
}
onKeyDown = (event, change) => {
@@ -89,7 +89,7 @@ class App extends React.Component {
return (
// Pass in the `renderNode` prop...
{
- this.setState({ state })
+ onChange = ({ value }) => {
+ this.setState({ value })
}
onKeyDown = (event, change) => {
@@ -139,7 +139,7 @@ class App extends React.Component {
render() {
return (
{
- this.setState({ state })
+ onChange = ({ value }) => {
+ this.setState({ value })
}
onKeyDown = (event, change) => {
@@ -181,7 +181,7 @@ class App extends React.Component {
event.preventDefault()
// Determine whether any of the currently selected blocks are code blocks.
- const isCode = change.state.blocks.some(block => block.type == 'code')
+ const isCode = change.value.blocks.some(block => block.type == 'code')
// Toggle the block type depending on `isCode`.
change.setBlock(isCode ? 'paragraph' : 'code')
@@ -191,7 +191,7 @@ class App extends React.Component {
render() {
return (
{
- this.setState({ state })
+ // On change, update the app's React state with the new editor value.
+ onChange = ({ value }) => {
+ this.setState({ value })
}
// Render the editor.
render() {
return (
)
@@ -109,7 +109,7 @@ class App extends React.Component {
}
```
-You'll notice that the `onChange` handler passed into the `Editor` component just updates the app's state with the newest changed state. That way, when it re-renders the editor, the new state is reflected with your changes.
+You'll notice that the `onChange` handler passed into the `Editor` component just updates the app's state with the newest changed value. That way, when it re-renders the editor, the new value is reflected with your changes.
And that's it!
diff --git a/docs/walkthroughs/saving-and-loading-html-content.md b/docs/walkthroughs/saving-and-loading-html-content.md
index d93f5e69f..476ddccfa 100644
--- a/docs/walkthroughs/saving-and-loading-html-content.md
+++ b/docs/walkthroughs/saving-and-loading-html-content.md
@@ -15,17 +15,17 @@ import { Editor } from 'slate-react'
class App extends React.Component {
state = {
- state: Plain.deserialize('')
+ value: Plain.deserialize('')
}
- onChange({ state }) {
- this.setState({ state })
+ onChange({ value }) {
+ this.setState({ value })
}
render() {
return (
)
@@ -209,8 +209,8 @@ const html = new Html({ rules })
And finally, now that we have our serializer initialized, we can update our app to use it to save and load content, like so:
```js
-// Load the initial state from Local Storage or a default.
-const initialState = (
+// Load the initial value from Local Storage or a default.
+const initialValue = (
localStorage.getItem('content') ||
'
'
)
@@ -218,23 +218,23 @@ const initialState = (
class App extends React.Component {
state = {
- state: html.deserialize(initialState),
+ value: html.deserialize(initialValue),
}
- onChange = ({ state }) => {
+ onChange = ({ value }) => {
// When the document changes, save the serialized HTML to Local Storage.
- if (state.document != this.state.state.document) {
- const string = html.serialize(state)
+ if (value.document != this.state.value.document) {
+ const string = html.serialize(value)
localStorage.setItem('content', string)
}
- this.setState({ state })
+ this.setState({ value })
}
render() {
return (
{
- this.setState({ state })
+ onChange = ({ value }) => {
+ this.setState({ value })
}
render() {
return (
)
@@ -58,14 +58,14 @@ class App extends React.Component {
}
```
-That will render a basic Slate editor on your page, and when you type things will change. But if you refresh the page, everything will be reverted back to its original state—nothing saves!
+That will render a basic Slate editor on your page, and when you type things will change. But if you refresh the page, everything will be reverted back to its original value—nothing saves!
What we need to do is save the changes you make somewhere. For this example, we'll just be using [Local Storage](https://developer.mozilla.org/en-US/docs/Web/API/Window/localStorage), but it will give you an idea for where you'd need to add your own database hooks.
-So, in our `onChange` handler, we need to save the `state`. But the `state` argument that `onChange` receives is an immutable object, so we can't just save it as-is. We need to serialize it to a format we understand first, like JSON!
+So, in our `onChange` handler, we need to save the `value`. But the `value` argument that `onChange` receives is an immutable object, so we can't just save it as-is. We need to serialize it to a format we understand first, like JSON!
```js
-const initialState = State.fromJSON({
+const initialValue = Value.fromJSON({
document: {
nodes: [
{
@@ -89,21 +89,21 @@ const initialState = State.fromJSON({
class App extends React.Component {
state = {
- state: initialState
+ value: initialValue
}
- onChange = ({ state }) => {
- // Save the state to Local Storage.
- const content = JSON.stringify(state.toJSON())
+ onChange = ({ value }) => {
+ // Save the value to Local Storage.
+ const content = JSON.stringify(value.toJSON())
localStorage.setItem('content', content)
- this.setState({ state })
+ this.setState({ value })
}
render() {
return (
)
@@ -114,12 +114,12 @@ class App extends React.Component {
Now whenever you edit the page, if you look in Local Storage, you should see the `content` value changing.
-But... if you refresh the page, everything is still reset. That's because we need to make sure the initial state is pulled from that same Local Storage location, like so:
+But... if you refresh the page, everything is still reset. That's because we need to make sure the initial value is pulled from that same Local Storage location, like so:
```js
// Update the initial content to be pulled from Local Storage if it exists.
-const existingState = JSON.parse(localStorage.getItem('content'))
-const initialState = State.fromJSON(existingState || {
+const existingValue = JSON.parse(localStorage.getItem('content'))
+const initialValue = Value.fromJSON(existingValue || {
document: {
nodes: [
{
@@ -143,20 +143,20 @@ const initialState = State.fromJSON(existingState || {
class App extends React.Component {
state = {
- state: initialState
+ value: initialValue
}
- onChange = ({ state }) => {
- const content = JSON.stringify(state.toJSON())
+ onChange = ({ value }) => {
+ const content = JSON.stringify(value.toJSON())
localStorage.setItem('content', content)
- this.setState({ state })
+ this.setState({ value })
}
render() {
return (
)
@@ -170,8 +170,8 @@ Now you should be able to save changes across refreshes!
However, if you inspect the change handler, you'll notice that it's actually saving the Local Storage value on _every_ change to the editor, even when only the selection changes! This is because `onChange` is called for _every_ change. For Local Storage this doesn't really matter, but if you're saving things to a database via HTTP request this would result in a lot of unnecessary requests. You can fix this by checking against the previous `document` value.
```js
-const existingState = JSON.parse(localStorage.getItem('content'))
-const initialState = State.fromJSON(existingState || {
+const existingValue = JSON.parse(localStorage.getItem('content'))
+const initialValue = Value.fromJSON(existingValue || {
document: {
nodes: [
{
@@ -195,23 +195,23 @@ const initialState = State.fromJSON(existingState || {
class App extends React.Component {
state = {
- state: initialState
+ value: initialValue
}
- onChange = ({ state }) => {
+ onChange = ({ value }) => {
// Check to see if the document has changed before saving.
- if (state.document != this.state.state.document) {
- const content = JSON.stringify(state.toJSON())
+ if (value.document != this.state.value.document) {
+ const content = JSON.stringify(value.toJSON())
localStorage.setItem('content', content)
}
- this.setState({ state })
+ this.setState({ value })
}
render() {
return (
)
@@ -224,35 +224,35 @@ Now you're content will be saved only when the content itself changes!
Success—you've got JSON in your database.
-But what if you want something other than JSON? Well, you'd need to serialize your state differently. For example, if you want to save your content as plain text instead of JSON, you can use the `Plain` serializer that ships with Slate, like so:
+But what if you want something other than JSON? Well, you'd need to serialize your value differently. For example, if you want to save your content as plain text instead of JSON, you can use the `Plain` serializer that ships with Slate, like so:
```js
// Switch to using the Plain serializer.
import { Editor } from 'slate-react'
import Plain from 'slate-plain-serializer'
-const existingState = localStorage.getItem('content')
-const initialState = Plain.deserialize(existingState || 'A string of plain text.')
+const existingValue = localStorage.getItem('content')
+const initialValue = Plain.deserialize(existingValue || 'A string of plain text.')
class App extends React.Component {
state = {
- state: initialState
+ value: initialValue
}
- onChange = ({ state }) => {
- if (state.document != this.state.state.document) {
- const content = Plain.serialize(state)
+ onChange = ({ value }) => {
+ if (value.document != this.state.value.document) {
+ const content = Plain.serialize(value)
localStorage.setItem('content', content)
}
- this.setState({ state })
+ this.setState({ value })
}
render() {
return (
)
diff --git a/docs/walkthroughs/using-plugins.md b/docs/walkthroughs/using-plugins.md
index 8dc5d0abb..e30213106 100644
--- a/docs/walkthroughs/using-plugins.md
+++ b/docs/walkthroughs/using-plugins.md
@@ -17,11 +17,11 @@ Starting with our app from earlier:
class App extends React.Component {
state = {
- state: initialState,
+ value: initialValue,
}
- onChange = ({ state }) => {
- this.setState({ state })
+ onChange = ({ value }) => {
+ this.setState({ value })
}
onKeyDown = (event, change) => {
@@ -34,7 +34,7 @@ class App extends React.Component {
render() {
return (
{
- this.setState({ state })
+ onChange = ({ value }) => {
+ this.setState({ value })
}
render() {
@@ -118,7 +118,7 @@ class App extends React.Component {
// Add the `plugins` property to the editor, and remove `onKeyDown`.
@@ -151,18 +151,18 @@ const plugins = [
class App extends React.Component {
state = {
- state: initialState,
+ value: initialValue,
}
- onChange = ({ state }) => {
- this.setState({ state })
+ onChange = ({ value }) => {
+ this.setState({ value })
}
render() {
return (
diff --git a/examples/check-lists/index.js b/examples/check-lists/index.js
index fa8e16721..348ad2dcc 100644
--- a/examples/check-lists/index.js
+++ b/examples/check-lists/index.js
@@ -1,9 +1,9 @@
import { Editor } from 'slate-react'
-import { State } from 'slate'
+import { Value } from 'slate'
import React from 'react'
-import initialState from './state.json'
+import initialValue from './value.json'
/**
* Check list item.
@@ -66,23 +66,23 @@ class CheckListItem extends React.Component {
class CheckLists extends React.Component {
/**
- * Deserialize the initial editor state.
+ * Deserialize the initial editor value.
*
* @type {Object}
*/
state = {
- state: State.fromJSON(initialState)
+ value: Value.fromJSON(initialValue)
}
/**
- * On change, save the new state.
+ * On change, save the new value.
*
* @param {Change} change
*/
- onChange = ({ state }) => {
- this.setState({ state })
+ onChange = ({ value }) => {
+ this.setState({ value })
}
/**
@@ -96,15 +96,15 @@ class CheckLists extends React.Component {
*
* @param {Event} event
* @param {Change} change
- * @return {State|Void}
+ * @return {Value|Void}
*/
onKeyDown = (event, change) => {
- const { state } = change
+ const { value } = change
if (
event.key == 'Enter' &&
- state.startBlock.type == 'check-list-item'
+ value.startBlock.type == 'check-list-item'
) {
change.splitBlock().setBlock({ data: { checked: false }})
return true
@@ -112,9 +112,9 @@ class CheckLists extends React.Component {
if (
event.key == 'Backspace' &&
- state.isCollapsed &&
- state.startBlock.type == 'check-list-item' &&
- state.selection.startOffset == 0
+ value.isCollapsed &&
+ value.startBlock.type == 'check-list-item' &&
+ value.selection.startOffset == 0
) {
change.setBlock('paragraph')
return true
@@ -134,7 +134,7 @@ class CheckLists extends React.Component {
{
- this.setState({ state })
+ onChange = ({ value }) => {
+ this.setState({ value })
}
/**
@@ -83,11 +83,11 @@ class CodeHighlighting extends React.Component {
*/
onKeyDown = (event, change) => {
- const { state } = change
- const { startBlock } = state
+ const { value } = change
+ const { startBlock } = value
if (event.key != 'Enter') return
if (startBlock.type != 'code') return
- if (state.isExpanded) change.delete()
+ if (value.isExpanded) change.delete()
change.insertText('\n')
return true
}
@@ -103,7 +103,7 @@ class CodeHighlighting extends React.Component {
{
- this.setState({ state })
+ onChange = ({ value }) => {
+ this.setState({ value })
}
/**
@@ -45,7 +45,7 @@ class Embeds extends React.Component {
diff --git a/examples/embeds/state.json b/examples/embeds/value.json
similarity index 100%
rename from examples/embeds/state.json
rename to examples/embeds/value.json
diff --git a/examples/emojis/index.js b/examples/emojis/index.js
index b6e6d39de..fb16efbc5 100644
--- a/examples/emojis/index.js
+++ b/examples/emojis/index.js
@@ -1,9 +1,9 @@
import { Editor } from 'slate-react'
-import { State } from 'slate'
+import { Value } from 'slate'
import React from 'react'
-import initialState from './state.json'
+import initialValue from './value.json'
/**
* Emojis.
@@ -26,13 +26,13 @@ const EMOJIS = [
class Emojis extends React.Component {
/**
- * Deserialize the raw initial state.
+ * Deserialize the raw initial value.
*
* @type {Object}
*/
state = {
- state: State.fromJSON(initialState)
+ value: Value.fromJSON(initialValue)
}
/**
@@ -41,8 +41,8 @@ class Emojis extends React.Component {
* @param {Change} change
*/
- onChange = ({ state }) => {
- this.setState({ state })
+ onChange = ({ value }) => {
+ this.setState({ value })
}
/**
@@ -53,8 +53,8 @@ class Emojis extends React.Component {
onClickEmoji = (e, code) => {
e.preventDefault()
- const { state } = this.state
- const change = state.change()
+ const { value } = this.state
+ const change = value.change()
change.insertInline({
type: 'emoji',
@@ -112,7 +112,7 @@ class Emojis extends React.Component {
diff --git a/examples/emojis/state.json b/examples/emojis/value.json
similarity index 100%
rename from examples/emojis/state.json
rename to examples/emojis/value.json
diff --git a/examples/forced-layout/index.js b/examples/forced-layout/index.js
index 198c541ca..37d1d9bb9 100644
--- a/examples/forced-layout/index.js
+++ b/examples/forced-layout/index.js
@@ -1,9 +1,9 @@
import { Editor } from 'slate-react'
-import { Block, State } from 'slate'
+import { Block, Value } from 'slate'
import React from 'react'
-import initialState from './state.json'
+import initialValue from './value.json'
/**
* A simple schema to enforce the nodes in the Slate document.
@@ -40,13 +40,13 @@ const schema = {
class ForcedLayout extends React.Component {
/**
- * Deserialize the initial editor state.
+ * Deserialize the initial editor value.
*
* @type {Object}
*/
state = {
- state: State.fromJSON(initialState),
+ value: Value.fromJSON(initialValue),
}
/**
@@ -55,8 +55,8 @@ class ForcedLayout extends React.Component {
* @param {Change} change
*/
- onChange = ({ state }) => {
- this.setState({ state })
+ onChange = ({ value }) => {
+ this.setState({ value })
}
/**
@@ -70,7 +70,7 @@ class ForcedLayout extends React.Component {
mark.type == type)
+ const { value } = this.props
+ return value.activeMarks.some(mark => mark.type == type)
}
/**
@@ -36,9 +36,9 @@ class Menu extends React.Component {
*/
onClickMark(event, type) {
- const { state, onChange } = this.props
+ const { value, onChange } = this.props
event.preventDefault()
- const change = state.change().toggleMark(type)
+ const change = value.change().toggleMark(type)
onChange(change)
}
@@ -93,13 +93,13 @@ class Menu extends React.Component {
class HoveringMenu extends React.Component {
/**
- * Deserialize the raw initial state.
+ * Deserialize the raw initial value.
*
* @type {Object}
*/
state = {
- state: State.fromJSON(initialState)
+ value: Value.fromJSON(initialValue)
}
/**
@@ -119,11 +119,11 @@ class HoveringMenu extends React.Component {
*/
updateMenu = () => {
- const { state } = this.state
+ const { value } = this.state
const menu = this.menu
if (!menu) return
- if (state.isBlurred || state.isEmpty) {
+ if (value.isBlurred || value.isEmpty) {
menu.removeAttribute('style')
return
}
@@ -142,8 +142,8 @@ class HoveringMenu extends React.Component {
* @param {Change} change
*/
- onChange = ({ state }) => {
- this.setState({ state })
+ onChange = ({ value }) => {
+ this.setState({ value })
}
/**
@@ -167,13 +167,13 @@ class HoveringMenu extends React.Component {
diff --git a/examples/hovering-menu/state.json b/examples/hovering-menu/value.json
similarity index 100%
rename from examples/hovering-menu/state.json
rename to examples/hovering-menu/value.json
diff --git a/examples/huge-document/index.js b/examples/huge-document/index.js
index 458bb8da1..76739208c 100644
--- a/examples/huge-document/index.js
+++ b/examples/huge-document/index.js
@@ -1,7 +1,7 @@
/* eslint-disable no-console */
import { Editor } from 'slate-react'
-import { State } from 'slate'
+import { Value } from 'slate'
import React from 'react'
import faker from 'faker'
@@ -44,7 +44,7 @@ for (let h = 0; h < HEADINGS; h++) {
class HugeDocument extends React.Component {
/**
- * Deserialize the initial editor state.
+ * Deserialize the initial editor value.
*
* @type {Object}
*/
@@ -52,7 +52,7 @@ class HugeDocument extends React.Component {
constructor() {
super()
console.time('deserializeHugeDocument')
- this.state = { state: State.fromJSON(json, { normalize: false }) }
+ this.state = { value: Value.fromJSON(json, { normalize: false }) }
console.timeEnd('deserializeHugeDocument')
}
@@ -62,8 +62,8 @@ class HugeDocument extends React.Component {
* @param {Change} change
*/
- onChange = ({ state }) => {
- this.setState({ state })
+ onChange = ({ value }) => {
+ this.setState({ value })
}
/**
@@ -78,7 +78,7 @@ class HugeDocument extends React.Component {
{
- this.setState({ state })
+ onChange = ({ value }) => {
+ this.setState({ value })
}
/**
@@ -158,7 +158,7 @@ class Images extends React.Component {
const src = window.prompt('Enter the URL of the image:')
if (!src) return
- const change = this.state.state
+ const change = this.state.value
.change()
.call(insertImage, src)
diff --git a/examples/images/state.json b/examples/images/value.json
similarity index 100%
rename from examples/images/state.json
rename to examples/images/value.json
diff --git a/examples/links/index.js b/examples/links/index.js
index 1dc322196..8a05cad9e 100644
--- a/examples/links/index.js
+++ b/examples/links/index.js
@@ -1,9 +1,9 @@
import { Editor, getEventTransfer } from 'slate-react'
-import { State } from 'slate'
+import { Value } from 'slate'
import React from 'react'
-import initialState from './state.json'
+import initialValue from './value.json'
import isUrl from 'is-url'
/**
@@ -41,13 +41,13 @@ function unwrapLink(change) {
class Links extends React.Component {
/**
- * Deserialize the raw initial state.
+ * Deserialize the raw initial value.
*
* @type {Object}
*/
state = {
- state: State.fromJSON(initialState)
+ value: Value.fromJSON(initialValue)
}
/**
@@ -57,8 +57,8 @@ class Links extends React.Component {
*/
hasLinks = () => {
- const { state } = this.state
- return state.inlines.some(inline => inline.type == 'link')
+ const { value } = this.state
+ return value.inlines.some(inline => inline.type == 'link')
}
/**
@@ -67,8 +67,8 @@ class Links extends React.Component {
* @param {Change} change
*/
- onChange = ({ state }) => {
- this.setState({ state })
+ onChange = ({ value }) => {
+ this.setState({ value })
}
/**
@@ -80,15 +80,15 @@ class Links extends React.Component {
onClickLink = (event) => {
event.preventDefault()
- const { state } = this.state
+ const { value } = this.state
const hasLinks = this.hasLinks()
- const change = state.change()
+ const change = value.change()
if (hasLinks) {
change.call(unwrapLink)
}
- else if (state.isExpanded) {
+ else if (value.isExpanded) {
const href = window.prompt('Enter the URL of the link:')
change.call(wrapLink, href)
}
@@ -113,7 +113,7 @@ class Links extends React.Component {
*/
onPaste = (event, change) => {
- if (change.state.isCollapsed) return
+ if (change.value.isCollapsed) return
const transfer = getEventTransfer(event)
const { type, text } = transfer
@@ -171,7 +171,7 @@ class Links extends React.Component {
{
- this.setState({ state })
+ onChange = ({ value }) => {
+ this.setState({ value })
}
/**
@@ -52,7 +52,7 @@ class MarkdownPreview extends React.Component {
{
- this.setState({ state })
+ onChange = ({ value }) => {
+ this.setState({ value })
}
/**
@@ -119,15 +119,14 @@ class MarkdownShortcuts extends React.Component {
* node into the shortcut's corresponding type.
*
* @param {Event} event
- * @param {State} change
- * @return {State or Null} state
+ * @param {Change} change
*/
onSpace = (event, change) => {
- const { state } = change
- if (state.isExpanded) return
+ const { value } = change
+ if (value.isExpanded) return
- const { startBlock, startOffset } = state
+ const { startBlock, startOffset } = value
const chars = startBlock.text.slice(0, startOffset).replace(/\s*/g, '')
const type = this.getType(chars)
@@ -150,16 +149,15 @@ class MarkdownShortcuts extends React.Component {
* paragraph node.
*
* @param {Event} event
- * @param {State} change
- * @return {State or Null} state
+ * @param {Change} change
*/
onBackspace = (event, change) => {
- const { state } = change
- if (state.isExpanded) return
- if (state.startOffset != 0) return
+ const { value } = change
+ if (value.isExpanded) return
+ if (value.startOffset != 0) return
- const { startBlock } = state
+ const { startBlock } = value
if (startBlock.type == 'paragraph') return
event.preventDefault()
@@ -177,15 +175,14 @@ class MarkdownShortcuts extends React.Component {
* create a new paragraph below it.
*
* @param {Event} event
- * @param {State} change
- * @return {State or Null} state
+ * @param {Change} change
*/
onEnter = (event, change) => {
- const { state } = change
- if (state.isExpanded) return
+ const { value } = change
+ if (value.isExpanded) return
- const { startBlock, startOffset, endOffset } = state
+ const { startBlock, startOffset, endOffset } = value
if (startOffset == 0 && startBlock.text.length == 0) return this.onBackspace(event, change)
if (endOffset != startBlock.text.length) return
diff --git a/examples/markdown-shortcuts/state.json b/examples/markdown-shortcuts/value.json
similarity index 100%
rename from examples/markdown-shortcuts/state.json
rename to examples/markdown-shortcuts/value.json
diff --git a/examples/paste-html/index.js b/examples/paste-html/index.js
index f846e99b9..2317b0700 100644
--- a/examples/paste-html/index.js
+++ b/examples/paste-html/index.js
@@ -1,10 +1,10 @@
import Html from 'slate-html-serializer'
import { Editor, getEventTransfer } from 'slate-react'
-import { State } from 'slate'
+import { Value } from 'slate'
import React from 'react'
-import initialState from './state.json'
+import initialValue from './value.json'
/**
* Tags to blocks.
@@ -119,23 +119,23 @@ const serializer = new Html({ rules: RULES })
class PasteHtml extends React.Component {
/**
- * Deserialize the raw initial state.
+ * Deserialize the raw initial value.
*
* @type {Object}
*/
state = {
- state: State.fromJSON(initialState)
+ value: Value.fromJSON(initialValue)
}
/**
- * On change, save the new state.
+ * On change, save the new value.
*
* @param {Change} change
*/
- onChange = ({ state }) => {
- this.setState({ state })
+ onChange = ({ value }) => {
+ this.setState({ value })
}
/**
@@ -164,7 +164,7 @@ class PasteHtml extends React.Component {
!')
+ value: Plain.deserialize('This is editable plain text, just like a
diff --git a/examples/read-only/index.js b/examples/read-only/index.js
index 9d6f4c0b8..da79a86df 100644
--- a/examples/read-only/index.js
+++ b/examples/read-only/index.js
@@ -13,13 +13,13 @@ import React from 'react'
class ReadOnly extends React.Component {
/**
- * Deserialize the initial editor state.
+ * Deserialize the initial editor value.
*
* @type {Object}
*/
state = {
- state: Plain.deserialize('This is read-only text. You should not be able to edit it, which is useful for scenarios where you want to render via Slate, without giving the user editing permissions.')
+ value: Plain.deserialize('This is read-only text. You should not be able to edit it, which is useful for scenarios where you want to render via Slate, without giving the user editing permissions.')
}
/**
@@ -28,8 +28,8 @@ class ReadOnly extends React.Component {
* @param {Change} change
*/
- onChange = ({ state }) => {
- this.setState({ state })
+ onChange = ({ value }) => {
+ this.setState({ value })
}
/**
@@ -44,7 +44,7 @@ class ReadOnly extends React.Component {
diff --git a/examples/rich-text/index.js b/examples/rich-text/index.js
index 5ab49e4d5..902036904 100644
--- a/examples/rich-text/index.js
+++ b/examples/rich-text/index.js
@@ -1,9 +1,9 @@
import { Editor } from 'slate-react'
-import { State } from 'slate'
+import { Value } from 'slate'
import React from 'react'
-import initialState from './state.json'
+import initialValue from './value.json'
import { isKeyHotkey } from 'is-hotkey'
/**
@@ -34,13 +34,13 @@ const isCodeHotkey = isKeyHotkey('mod+`')
class RichTextExample extends React.Component {
/**
- * Deserialize the initial editor state.
+ * Deserialize the initial editor value.
*
* @type {Object}
*/
state = {
- state: State.fromJSON(initialState),
+ value: Value.fromJSON(initialValue),
}
/**
@@ -51,8 +51,8 @@ class RichTextExample extends React.Component {
*/
hasMark = (type) => {
- const { state } = this.state
- return state.activeMarks.some(mark => mark.type == type)
+ const { value } = this.state
+ return value.activeMarks.some(mark => mark.type == type)
}
/**
@@ -63,18 +63,18 @@ class RichTextExample extends React.Component {
*/
hasBlock = (type) => {
- const { state } = this.state
- return state.blocks.some(node => node.type == type)
+ const { value } = this.state
+ return value.blocks.some(node => node.type == type)
}
/**
- * On change, save the new `state`.
+ * On change, save the new `value`.
*
* @param {Change} change
*/
- onChange = ({ state }) => {
- this.setState({ state })
+ onChange = ({ value }) => {
+ this.setState({ value })
}
/**
@@ -114,8 +114,8 @@ class RichTextExample extends React.Component {
onClickMark = (event, type) => {
event.preventDefault()
- const { state } = this.state
- const change = state.change().toggleMark(type)
+ const { value } = this.state
+ const change = value.change().toggleMark(type)
this.onChange(change)
}
@@ -128,9 +128,9 @@ class RichTextExample extends React.Component {
onClickBlock = (event, type) => {
event.preventDefault()
- const { state } = this.state
- const change = state.change()
- const { document } = state
+ const { value } = this.state
+ const change = value.change()
+ const { document } = value
// Handle everything but list buttons.
if (type != 'bulleted-list' && type != 'numbered-list') {
@@ -153,7 +153,7 @@ class RichTextExample extends React.Component {
// Handle the extra wrapping required for list buttons.
else {
const isList = this.hasBlock('list-item')
- const isType = state.blocks.some((block) => {
+ const isType = value.blocks.some((block) => {
return !!document.getClosest(block.key, parent => parent.type == type)
})
@@ -262,7 +262,7 @@ class RichTextExample extends React.Component {
{
- this.setState({ state })
+ onChange = ({ value }) => {
+ this.setState({ value })
}
/**
@@ -59,7 +59,7 @@ class RTL extends React.Component {
{
- this.setState({ state })
+ onChange = ({ value }) => {
+ this.setState({ value })
}
/**
@@ -40,9 +40,9 @@ class SearchHighlighting extends React.Component {
*/
onInputChange = (event) => {
- const { state } = this.state
+ const { value } = this.state
const string = event.target.value
- const texts = state.document.getTexts()
+ const texts = value.document.getTexts()
const decorations = []
texts.forEach((node) => {
@@ -65,7 +65,7 @@ class SearchHighlighting extends React.Component {
})
})
- const change = state.change().setState({ decorations })
+ const change = value.change().setValue({ decorations })
this.onChange(change)
}
@@ -117,7 +117,7 @@ class SearchHighlighting extends React.Component {
{
- const { state } = this.state
- const change = state.change().applyOperations(operations)
+ const { value } = this.state
+ const change = value.change().applyOperations(operations)
this.onChange(change, { remote: true })
}
@@ -56,12 +56,12 @@ class SyncingEditor extends React.Component {
*/
hasMark = (type) => {
- const { state } = this.state
- return state.activeMarks.some(mark => mark.type == type)
+ const { value } = this.state
+ return value.activeMarks.some(mark => mark.type == type)
}
/**
- * On change, save the new `state`. And if it's a local change, call the
+ * On change, save the new `value`. And if it's a local change, call the
* passed-in `onChange` handler.
*
* @param {Change} change
@@ -69,7 +69,7 @@ class SyncingEditor extends React.Component {
*/
onChange = (change, options = {}) => {
- this.setState({ state: change.state })
+ this.setState({ value: change.value })
if (!options.remote) {
this.props.onChange(change)
@@ -113,8 +113,8 @@ class SyncingEditor extends React.Component {
onClickMark = (event, type) => {
event.preventDefault()
- const { state } = this.state
- const change = state.change().toggleMark(type)
+ const { value } = this.state
+ const change = value.change().toggleMark(type)
this.onChange(change)
}
@@ -180,7 +180,7 @@ class SyncingEditor extends React.Component {
{
- const ops = change.operations.filter(o => o.type != 'set_selection' && o.type != 'set_state')
+ const ops = change.operations.filter(o => o.type != 'set_selection' && o.type != 'set_value')
this.two.applyOperations(ops)
}
@@ -255,7 +255,7 @@ class SyncingOperationsExample extends React.Component {
*/
onTwoChange = (change) => {
- const ops = change.operations.filter(o => o.type != 'set_selection' && o.type != 'set_state')
+ const ops = change.operations.filter(o => o.type != 'set_selection' && o.type != 'set_value')
this.one.applyOperations(ops)
}
diff --git a/examples/syncing-operations/state.json b/examples/syncing-operations/value.json
similarity index 100%
rename from examples/syncing-operations/state.json
rename to examples/syncing-operations/value.json
diff --git a/examples/tables/index.js b/examples/tables/index.js
index c673cf864..b31f511a0 100644
--- a/examples/tables/index.js
+++ b/examples/tables/index.js
@@ -1,9 +1,9 @@
import { Editor } from 'slate-react'
-import { State } from 'slate'
+import { Value } from 'slate'
import React from 'react'
-import initialState from './state.json'
+import initialValue from './value.json'
/**
* The tables example.
@@ -14,13 +14,13 @@ import initialState from './state.json'
class Tables extends React.Component {
/**
- * Deserialize the raw initial state.
+ * Deserialize the raw initial value.
*
* @type {Object}
*/
state = {
- state: State.fromJSON(initialState)
+ value: Value.fromJSON(initialValue)
}
/**
@@ -31,8 +31,8 @@ class Tables extends React.Component {
*/
onBackspace = (event, change) => {
- const { state } = change
- if (state.startOffset != 0) return
+ const { value } = change
+ if (value.startOffset != 0) return
event.preventDefault()
return true
}
@@ -43,8 +43,8 @@ class Tables extends React.Component {
* @param {Change} change
*/
- onChange = ({ state }) => {
- this.setState({ state })
+ onChange = ({ value }) => {
+ this.setState({ value })
}
/**
@@ -55,8 +55,8 @@ class Tables extends React.Component {
*/
onDelete = (event, change) => {
- const { state } = change
- if (state.endOffset != state.startText.text.length) return
+ const { value } = change
+ if (value.endOffset != value.startText.text.length) return
event.preventDefault()
return true
}
@@ -81,8 +81,8 @@ class Tables extends React.Component {
*/
onKeyDown = (event, change) => {
- const { state } = change
- const { document, selection } = state
+ const { value } = change
+ const { document, selection } = value
const { startKey } = selection
const startNode = document.getDescendant(startKey)
@@ -96,7 +96,7 @@ class Tables extends React.Component {
}
}
- if (state.startBlock.type != 'table-cell') {
+ if (value.startBlock.type != 'table-cell') {
return
}
@@ -118,7 +118,7 @@ class Tables extends React.Component {
{
@@ -187,7 +187,7 @@ class Html {
}
const json = {
- kind: 'state',
+ kind: 'value',
document: {
kind: 'document',
data: {},
@@ -195,7 +195,7 @@ class Html {
}
}
- const ret = toJSON ? json : State.fromJSON(json)
+ const ret = toJSON ? json : Value.fromJSON(json)
return ret
}
@@ -320,16 +320,16 @@ class Html {
}
/**
- * Serialize a `state` object into an HTML string.
+ * Serialize a `value` object into an HTML string.
*
- * @param {State} state
+ * @param {Value} value
* @param {Object} options
* @property {Boolean} render
* @return {String|Array}
*/
- serialize = (state, options = {}) => {
- const { document } = state
+ serialize = (value, options = {}) => {
+ const { document } = value
const elements = document.nodes.map(this.serializeNode)
if (options.render === false) return elements
diff --git a/packages/slate-html-serializer/test/deserialize/block-nested.js b/packages/slate-html-serializer/test/deserialize/block-nested.js
index 763f1af8e..49f885ae6 100644
--- a/packages/slate-html-serializer/test/deserialize/block-nested.js
+++ b/packages/slate-html-serializer/test/deserialize/block-nested.js
@@ -33,7 +33,7 @@ export const input = `
`.trim()
export const output = (
-
+
@@ -41,5 +41,5 @@ export const output = (
-
+
)
diff --git a/packages/slate-html-serializer/test/deserialize/block-no-children.js b/packages/slate-html-serializer/test/deserialize/block-no-children.js
index dae3c7b4b..3aa1591e1 100644
--- a/packages/slate-html-serializer/test/deserialize/block-no-children.js
+++ b/packages/slate-html-serializer/test/deserialize/block-no-children.js
@@ -26,9 +26,9 @@ export const input = `
`.trim()
export const output = (
-
+
-
+
)
diff --git a/packages/slate-html-serializer/test/deserialize/block-with-data.js b/packages/slate-html-serializer/test/deserialize/block-with-data.js
index 674ff3f45..80293c056 100644
--- a/packages/slate-html-serializer/test/deserialize/block-with-data.js
+++ b/packages/slate-html-serializer/test/deserialize/block-with-data.js
@@ -27,11 +27,11 @@ export const input = `
`.trim()
export const output = (
-
+
one
-
+
)
diff --git a/packages/slate-html-serializer/test/deserialize/block-with-is-void.js b/packages/slate-html-serializer/test/deserialize/block-with-is-void.js
index 05f642d1b..47038db7a 100644
--- a/packages/slate-html-serializer/test/deserialize/block-with-is-void.js
+++ b/packages/slate-html-serializer/test/deserialize/block-with-is-void.js
@@ -26,9 +26,9 @@ export const input = `
`.trim()
export const output = (
-
+
-
+
)
diff --git a/packages/slate-html-serializer/test/deserialize/block.js b/packages/slate-html-serializer/test/deserialize/block.js
index f7abb6374..9fd4998a8 100644
--- a/packages/slate-html-serializer/test/deserialize/block.js
+++ b/packages/slate-html-serializer/test/deserialize/block.js
@@ -26,11 +26,11 @@ export const input = `
`.trim()
export const output = (
-
+
one
-
+
)
diff --git a/packages/slate-html-serializer/test/deserialize/default-block.js b/packages/slate-html-serializer/test/deserialize/default-block.js
index 75ee10a42..94aad88fd 100644
--- a/packages/slate-html-serializer/test/deserialize/default-block.js
+++ b/packages/slate-html-serializer/test/deserialize/default-block.js
@@ -33,7 +33,7 @@ export const input = `
`.trim()
export const output = (
-
+
one
@@ -42,5 +42,5 @@ export const output = (
two
-
+
)
diff --git a/packages/slate-html-serializer/test/deserialize/empty-string.js b/packages/slate-html-serializer/test/deserialize/empty-string.js
index 247e02978..e4ed2558c 100644
--- a/packages/slate-html-serializer/test/deserialize/empty-string.js
+++ b/packages/slate-html-serializer/test/deserialize/empty-string.js
@@ -8,9 +8,9 @@ export const config = {}
export const input = ''
export const output = (
-
+
-
+
)
diff --git a/packages/slate-html-serializer/test/deserialize/html-comment.js b/packages/slate-html-serializer/test/deserialize/html-comment.js
index 573e1b0f0..5a1e782eb 100644
--- a/packages/slate-html-serializer/test/deserialize/html-comment.js
+++ b/packages/slate-html-serializer/test/deserialize/html-comment.js
@@ -27,11 +27,11 @@ export const input = `
`.trim()
export const output = (
-
+
one
-
+
)
diff --git a/packages/slate-html-serializer/test/deserialize/inline-nested.js b/packages/slate-html-serializer/test/deserialize/inline-nested.js
index 8e8193923..89f191d08 100644
--- a/packages/slate-html-serializer/test/deserialize/inline-nested.js
+++ b/packages/slate-html-serializer/test/deserialize/inline-nested.js
@@ -40,7 +40,7 @@ export const input = `
`.trim()
export const output = (
-
+
@@ -50,5 +50,5 @@ export const output = (
-
+
)
diff --git a/packages/slate-html-serializer/test/deserialize/inline-no-children.js b/packages/slate-html-serializer/test/deserialize/inline-no-children.js
index ab9cd27bf..df5a26b3a 100644
--- a/packages/slate-html-serializer/test/deserialize/inline-no-children.js
+++ b/packages/slate-html-serializer/test/deserialize/inline-no-children.js
@@ -33,11 +33,11 @@ export const input = `
`.trim()
export const output = (
-
+
-
+
)
diff --git a/packages/slate-html-serializer/test/deserialize/inline-with-data.js b/packages/slate-html-serializer/test/deserialize/inline-with-data.js
index 848a86091..7b09767f4 100644
--- a/packages/slate-html-serializer/test/deserialize/inline-with-data.js
+++ b/packages/slate-html-serializer/test/deserialize/inline-with-data.js
@@ -34,7 +34,7 @@ export const input = `
`.trim()
export const output = (
-
+
@@ -42,5 +42,5 @@ export const output = (
-
+
)
diff --git a/packages/slate-html-serializer/test/deserialize/inline-with-is-void.js b/packages/slate-html-serializer/test/deserialize/inline-with-is-void.js
index 4b9a5e0fa..8b71cf711 100644
--- a/packages/slate-html-serializer/test/deserialize/inline-with-is-void.js
+++ b/packages/slate-html-serializer/test/deserialize/inline-with-is-void.js
@@ -34,11 +34,11 @@ export const input = `
`.trim()
export const output = (
-
+
-
+
)
diff --git a/packages/slate-html-serializer/test/deserialize/inline.js b/packages/slate-html-serializer/test/deserialize/inline.js
index fdc632b42..1903cda63 100644
--- a/packages/slate-html-serializer/test/deserialize/inline.js
+++ b/packages/slate-html-serializer/test/deserialize/inline.js
@@ -33,7 +33,7 @@ export const input = `
`.trim()
export const output = (
-
+
@@ -41,5 +41,5 @@ export const output = (
-
+
)
diff --git a/packages/slate-html-serializer/test/deserialize/mark-adjacent.js b/packages/slate-html-serializer/test/deserialize/mark-adjacent.js
index 5de72b9ca..bc8ae75ed 100644
--- a/packages/slate-html-serializer/test/deserialize/mark-adjacent.js
+++ b/packages/slate-html-serializer/test/deserialize/mark-adjacent.js
@@ -40,11 +40,11 @@ export const input = `
`.trim()
export const output = (
-
+
one
-
+
)
diff --git a/packages/slate-html-serializer/test/deserialize/mark-nested.js b/packages/slate-html-serializer/test/deserialize/mark-nested.js
index 494c17929..27e94b029 100644
--- a/packages/slate-html-serializer/test/deserialize/mark-nested.js
+++ b/packages/slate-html-serializer/test/deserialize/mark-nested.js
@@ -40,11 +40,11 @@ export const input = `
`.trim()
export const output = (
-
+
one
-
+
)
diff --git a/packages/slate-html-serializer/test/deserialize/mark-with-data.js b/packages/slate-html-serializer/test/deserialize/mark-with-data.js
index 15e20b60e..5a6076e60 100644
--- a/packages/slate-html-serializer/test/deserialize/mark-with-data.js
+++ b/packages/slate-html-serializer/test/deserialize/mark-with-data.js
@@ -34,11 +34,11 @@ export const input = `
`.trim()
export const output = (
-
+
one
-
+
)
diff --git a/packages/slate-html-serializer/test/deserialize/mark.js b/packages/slate-html-serializer/test/deserialize/mark.js
index e219f9c86..c81be7b4f 100644
--- a/packages/slate-html-serializer/test/deserialize/mark.js
+++ b/packages/slate-html-serializer/test/deserialize/mark.js
@@ -33,11 +33,11 @@ export const input = `
`.trim()
export const output = (
-
+
one
-
+
)
diff --git a/packages/slate-html-serializer/test/deserialize/multiple-matching-rules.js b/packages/slate-html-serializer/test/deserialize/multiple-matching-rules.js
index 1ae342e58..5e15324b7 100644
--- a/packages/slate-html-serializer/test/deserialize/multiple-matching-rules.js
+++ b/packages/slate-html-serializer/test/deserialize/multiple-matching-rules.js
@@ -29,9 +29,9 @@ export const input = `
`.trim()
export const output = (
-
+
-
+
)
diff --git a/packages/slate-html-serializer/test/deserialize/no-next.js b/packages/slate-html-serializer/test/deserialize/no-next.js
index 7ff06562e..7791b9cb6 100644
--- a/packages/slate-html-serializer/test/deserialize/no-next.js
+++ b/packages/slate-html-serializer/test/deserialize/no-next.js
@@ -26,9 +26,9 @@ export const input = `
`.trim()
export const output = (
-
+
-
+
)
diff --git a/packages/slate-html-serializer/test/deserialize/skip-element.js b/packages/slate-html-serializer/test/deserialize/skip-element.js
index 0fc040861..3821d3ee8 100644
--- a/packages/slate-html-serializer/test/deserialize/skip-element.js
+++ b/packages/slate-html-serializer/test/deserialize/skip-element.js
@@ -37,11 +37,11 @@ export const input = `
`.trim()
export const output = (
-
+
-
+
)
diff --git a/packages/slate-html-serializer/test/deserialize/to-json.js b/packages/slate-html-serializer/test/deserialize/to-json.js
index dfec1f0c1..c1cd05721 100644
--- a/packages/slate-html-serializer/test/deserialize/to-json.js
+++ b/packages/slate-html-serializer/test/deserialize/to-json.js
@@ -22,7 +22,7 @@ export const input = `
`.trim()
export const output = {
- kind: 'state',
+ kind: 'value',
document: {
kind: 'document',
data: {},
diff --git a/packages/slate-html-serializer/test/index.js b/packages/slate-html-serializer/test/index.js
index cd200af8f..c1a17f198 100644
--- a/packages/slate-html-serializer/test/index.js
+++ b/packages/slate-html-serializer/test/index.js
@@ -13,11 +13,11 @@ import Html from '..'
import assert from 'assert'
import fs from 'fs'
import parse5 from 'parse5' // eslint-disable-line import/no-extraneous-dependencies
-import { State, resetKeyGenerator } from 'slate'
+import { Value, resetKeyGenerator } from 'slate'
import { basename, extname, resolve } from 'path'
/**
- * Reset Slate's internal state before each text.
+ * Reset Slate's internal key generator state before each text.
*/
beforeEach(() => {
@@ -38,9 +38,9 @@ describe('slate-html-serializer', () => {
const module = require(resolve(dir, test))
const { input, output, config, options } = module
const html = new Html({ parseHtml: parse5.parseFragment, ...config })
- const state = html.deserialize(input, options)
- const actual = State.isState(state) ? state.toJSON() : state
- const expected = State.isState(output) ? output.toJSON() : output
+ const value = html.deserialize(input, options)
+ const actual = Value.isValue(value) ? value.toJSON() : value
+ const expected = Value.isValue(output) ? output.toJSON() : output
assert.deepEqual(actual, expected)
})
}
diff --git a/packages/slate-html-serializer/test/serialize/block-nested.js b/packages/slate-html-serializer/test/serialize/block-nested.js
index 790d25ebb..f8086eea9 100644
--- a/packages/slate-html-serializer/test/serialize/block-nested.js
+++ b/packages/slate-html-serializer/test/serialize/block-nested.js
@@ -17,7 +17,7 @@ export const rules = [
]
export const input = (
-
+
@@ -25,7 +25,7 @@ export const input = (
-
+
)
export const output = `
diff --git a/packages/slate-html-serializer/test/serialize/block-with-data.js b/packages/slate-html-serializer/test/serialize/block-with-data.js
index 6c9e257d5..e2659582f 100644
--- a/packages/slate-html-serializer/test/serialize/block-with-data.js
+++ b/packages/slate-html-serializer/test/serialize/block-with-data.js
@@ -15,13 +15,13 @@ export const rules = [
]
export const input = (
-
+
one
-
+
)
export const output = `
diff --git a/packages/slate-html-serializer/test/serialize/block-with-is-void.js b/packages/slate-html-serializer/test/serialize/block-with-is-void.js
index 392a01b4b..09816ad71 100644
--- a/packages/slate-html-serializer/test/serialize/block-with-is-void.js
+++ b/packages/slate-html-serializer/test/serialize/block-with-is-void.js
@@ -15,11 +15,11 @@ export const rules = [
]
export const input = (
-
+
-
+
)
export const output = `
diff --git a/packages/slate-html-serializer/test/serialize/block-with-mark.js b/packages/slate-html-serializer/test/serialize/block-with-mark.js
index 4a252bb28..8db81b998 100644
--- a/packages/slate-html-serializer/test/serialize/block-with-mark.js
+++ b/packages/slate-html-serializer/test/serialize/block-with-mark.js
@@ -19,13 +19,13 @@ export const rules = [
]
export const input = (
-
+
one
-
+
)
export const output = `
diff --git a/packages/slate-html-serializer/test/serialize/block.js b/packages/slate-html-serializer/test/serialize/block.js
index eda964f81..6e027d779 100644
--- a/packages/slate-html-serializer/test/serialize/block.js
+++ b/packages/slate-html-serializer/test/serialize/block.js
@@ -15,13 +15,13 @@ export const rules = [
]
export const input = (
-
+
one
-
+
)
export const output = `
diff --git a/packages/slate-html-serializer/test/serialize/inline-nested.js b/packages/slate-html-serializer/test/serialize/inline-nested.js
index bec861205..491e58da0 100644
--- a/packages/slate-html-serializer/test/serialize/inline-nested.js
+++ b/packages/slate-html-serializer/test/serialize/inline-nested.js
@@ -23,7 +23,7 @@ export const rules = [
]
export const input = (
-
+
@@ -33,7 +33,7 @@ export const input = (
-
+
)
export const output = `
diff --git a/packages/slate-html-serializer/test/serialize/inline-with-data.js b/packages/slate-html-serializer/test/serialize/inline-with-data.js
index 479bbb758..b56df68d0 100644
--- a/packages/slate-html-serializer/test/serialize/inline-with-data.js
+++ b/packages/slate-html-serializer/test/serialize/inline-with-data.js
@@ -19,7 +19,7 @@ export const rules = [
]
export const input = (
-
+
@@ -27,7 +27,7 @@ export const input = (
-
+
)
export const output = `
diff --git a/packages/slate-html-serializer/test/serialize/inline-with-is-void.js b/packages/slate-html-serializer/test/serialize/inline-with-is-void.js
index ee77b94b9..9ccf75aaa 100644
--- a/packages/slate-html-serializer/test/serialize/inline-with-is-void.js
+++ b/packages/slate-html-serializer/test/serialize/inline-with-is-void.js
@@ -19,13 +19,13 @@ export const rules = [
]
export const input = (
-
+
-
+
)
export const output = `
diff --git a/packages/slate-html-serializer/test/serialize/inline-with-mark.js b/packages/slate-html-serializer/test/serialize/inline-with-mark.js
index 2b71352d7..964e125fd 100644
--- a/packages/slate-html-serializer/test/serialize/inline-with-mark.js
+++ b/packages/slate-html-serializer/test/serialize/inline-with-mark.js
@@ -23,7 +23,7 @@ export const rules = [
]
export const input = (
-
+
@@ -31,7 +31,7 @@ export const input = (
-
+
)
export const output = `
diff --git a/packages/slate-html-serializer/test/serialize/inline.js b/packages/slate-html-serializer/test/serialize/inline.js
index f2c586673..09f87e9a6 100644
--- a/packages/slate-html-serializer/test/serialize/inline.js
+++ b/packages/slate-html-serializer/test/serialize/inline.js
@@ -19,7 +19,7 @@ export const rules = [
]
export const input = (
-
+
@@ -27,7 +27,7 @@ export const input = (
-
+
)
export const output = `
diff --git a/packages/slate-html-serializer/test/serialize/multiple-rules.js b/packages/slate-html-serializer/test/serialize/multiple-rules.js
index ba102e050..9884d2b34 100644
--- a/packages/slate-html-serializer/test/serialize/multiple-rules.js
+++ b/packages/slate-html-serializer/test/serialize/multiple-rules.js
@@ -19,13 +19,13 @@ export const rules = [
]
export const input = (
-
+
one
-
+
)
export const output = `
diff --git a/packages/slate-hyperscript/package.json b/packages/slate-hyperscript/package.json
index 77e9b1443..7f20a2db5 100644
--- a/packages/slate-hyperscript/package.json
+++ b/packages/slate-hyperscript/package.json
@@ -7,7 +7,8 @@
"main": "./lib/index.js",
"dependencies": {
"is-empty": "^1.0.0",
- "is-plain-object": "^2.0.4"
+ "is-plain-object": "^2.0.4",
+ "slate-dev-logger": "^0.1.23"
},
"peerDependencies": {
"slate": "^0.28.2"
diff --git a/packages/slate-hyperscript/src/index.js b/packages/slate-hyperscript/src/index.js
index 988e52286..bf0983132 100644
--- a/packages/slate-hyperscript/src/index.js
+++ b/packages/slate-hyperscript/src/index.js
@@ -1,6 +1,7 @@
import isEmpty from 'is-empty'
import isPlainObject from 'is-plain-object'
+import logger from 'slate-dev-logger'
import {
Block,
@@ -9,8 +10,8 @@ import {
Mark,
Node,
Range,
- State,
- Text
+ Text,
+ Value,
} from 'slate'
/**
@@ -74,7 +75,12 @@ const CREATORS = {
return Range.create(attributes)
},
- state(tagName, attributes, children) {
+ state(...args) {
+ logger.deprecate('slate-hyperscript@0.3.0', 'The `` tag has been renamed to ``.')
+ return CREATORS.value(...args)
+ },
+
+ value(tagName, attributes, children) {
const { data } = attributes
const document = children.find(Document.isDocument)
let selection = children.find(Range.isRange) || Range.create()
@@ -110,8 +116,8 @@ const CREATORS = {
selection = selection.merge(props).normalize(document)
}
- const state = State.create({ data, document, selection })
- return state
+ const value = Value.create({ data, document, selection })
+ return value
},
text(tagName, attributes, children) {
diff --git a/packages/slate-plain-serializer/src/index.js b/packages/slate-plain-serializer/src/index.js
index b75c7fe09..0451ce334 100644
--- a/packages/slate-plain-serializer/src/index.js
+++ b/packages/slate-plain-serializer/src/index.js
@@ -1,17 +1,17 @@
import logger from 'slate-dev-logger'
-import { Block, Mark, Node, State } from 'slate'
+import { Block, Mark, Node, Value } from 'slate'
import { Set } from 'immutable'
/**
- * Deserialize a plain text `string` to a state.
+ * Deserialize a plain text `string` to a Slate value.
*
* @param {String} string
* @param {Object} options
* @property {Boolean} toJSON
* @property {String|Object|Block} defaultBlock
* @property {Array|Set} defaultMarks
- * @return {State}
+ * @return {Value}
*/
function deserialize(string, options = {}) {
@@ -34,7 +34,7 @@ function deserialize(string, options = {}) {
defaultMarks = defaultMarks.map(Mark.createProperties)
const json = {
- kind: 'state',
+ kind: 'value',
document: {
kind: 'document',
data: {},
@@ -61,19 +61,19 @@ function deserialize(string, options = {}) {
}
}
- const ret = toJSON ? json : State.fromJSON(json)
+ const ret = toJSON ? json : Value.fromJSON(json)
return ret
}
/**
- * Serialize a `state` to plain text.
+ * Serialize a Slate `value` to a plain text string.
*
- * @param {State} state
+ * @param {Value} value
* @return {String}
*/
-function serialize(state) {
- return serializeNode(state.document)
+function serialize(value) {
+ return serializeNode(value.document)
}
/**
diff --git a/packages/slate-plain-serializer/test/deserialize/line-multiple.js b/packages/slate-plain-serializer/test/deserialize/line-multiple.js
index 3681114ea..f3dcb1b50 100644
--- a/packages/slate-plain-serializer/test/deserialize/line-multiple.js
+++ b/packages/slate-plain-serializer/test/deserialize/line-multiple.js
@@ -8,7 +8,7 @@ two
`.trim()
export const output = (
-
+
one
@@ -17,5 +17,5 @@ export const output = (
two
-
+
)
diff --git a/packages/slate-plain-serializer/test/deserialize/line.js b/packages/slate-plain-serializer/test/deserialize/line.js
index f69ccec03..f2725840c 100644
--- a/packages/slate-plain-serializer/test/deserialize/line.js
+++ b/packages/slate-plain-serializer/test/deserialize/line.js
@@ -7,11 +7,11 @@ one
`.trim()
export const output = (
-
+
one
-
+
)
diff --git a/packages/slate-plain-serializer/test/deserialize/to-json.js b/packages/slate-plain-serializer/test/deserialize/to-json.js
index 7c9633046..cee2acd23 100644
--- a/packages/slate-plain-serializer/test/deserialize/to-json.js
+++ b/packages/slate-plain-serializer/test/deserialize/to-json.js
@@ -4,7 +4,7 @@ one
`.trim()
export const output = {
- kind: 'state',
+ kind: 'value',
document: {
kind: 'document',
data: {},
diff --git a/packages/slate-plain-serializer/test/index.js b/packages/slate-plain-serializer/test/index.js
index f20488588..11218f84f 100644
--- a/packages/slate-plain-serializer/test/index.js
+++ b/packages/slate-plain-serializer/test/index.js
@@ -12,11 +12,11 @@ import 'babel-polyfill' // eslint-disable-line import/no-extraneous-dependencies
import Plain from '..'
import assert from 'assert'
import fs from 'fs'
-import { State, resetKeyGenerator } from 'slate'
+import { Value, resetKeyGenerator } from 'slate'
import { basename, extname, resolve } from 'path'
/**
- * Reset Slate's internal state before each text.
+ * Reset Slate's internal key generator state before each text.
*/
beforeEach(() => {
@@ -36,9 +36,9 @@ describe('slate-plain-serializer', () => {
it(test, async () => {
const module = require(resolve(dir, test))
const { input, output, options } = module
- const state = Plain.deserialize(input, options)
- const actual = State.isState(state) ? state.toJSON() : state
- const expected = State.isState(output) ? output.toJSON() : output
+ const value = Plain.deserialize(input, options)
+ const actual = Value.isValue(value) ? value.toJSON() : value
+ const expected = Value.isValue(output) ? output.toJSON() : output
assert.deepEqual(actual, expected)
})
}
diff --git a/packages/slate-plain-serializer/test/serialize/block-multiple-empty.js b/packages/slate-plain-serializer/test/serialize/block-multiple-empty.js
index 38f07b1d9..0f23d451c 100644
--- a/packages/slate-plain-serializer/test/serialize/block-multiple-empty.js
+++ b/packages/slate-plain-serializer/test/serialize/block-multiple-empty.js
@@ -3,7 +3,7 @@
import h from '../helpers/h'
export const input = (
-
+
one
@@ -13,7 +13,7 @@ export const input = (
three
-
+
)
export const output = `
diff --git a/packages/slate-plain-serializer/test/serialize/block-multiple.js b/packages/slate-plain-serializer/test/serialize/block-multiple.js
index e4db8746d..522929757 100644
--- a/packages/slate-plain-serializer/test/serialize/block-multiple.js
+++ b/packages/slate-plain-serializer/test/serialize/block-multiple.js
@@ -3,7 +3,7 @@
import h from '../helpers/h'
export const input = (
-
+
one
@@ -15,7 +15,7 @@ export const input = (
three
-
+
)
export const output = `
diff --git a/packages/slate-plain-serializer/test/serialize/block-nested-multiple-empty.js b/packages/slate-plain-serializer/test/serialize/block-nested-multiple-empty.js
index efdf6a7f1..2bd9ff1c0 100644
--- a/packages/slate-plain-serializer/test/serialize/block-nested-multiple-empty.js
+++ b/packages/slate-plain-serializer/test/serialize/block-nested-multiple-empty.js
@@ -3,7 +3,7 @@
import h from '../helpers/h'
export const input = (
-
+
@@ -20,7 +20,7 @@ export const input = (
-
+
)
export const output = `
diff --git a/packages/slate-plain-serializer/test/serialize/block-nested-multiple.js b/packages/slate-plain-serializer/test/serialize/block-nested-multiple.js
index 2eacd53f2..fa22641a8 100644
--- a/packages/slate-plain-serializer/test/serialize/block-nested-multiple.js
+++ b/packages/slate-plain-serializer/test/serialize/block-nested-multiple.js
@@ -3,7 +3,7 @@
import h from '../helpers/h'
export const input = (
-
+
@@ -22,7 +22,7 @@ export const input = (
-
+
)
export const output = `
diff --git a/packages/slate-plain-serializer/test/serialize/block-nested-nested-multiple.js b/packages/slate-plain-serializer/test/serialize/block-nested-nested-multiple.js
index fc1d93e21..717d5edfd 100644
--- a/packages/slate-plain-serializer/test/serialize/block-nested-nested-multiple.js
+++ b/packages/slate-plain-serializer/test/serialize/block-nested-nested-multiple.js
@@ -3,7 +3,7 @@
import h from '../helpers/h'
export const input = (
-
+
@@ -24,7 +24,7 @@ export const input = (
-
+
)
export const output = `
diff --git a/packages/slate-plain-serializer/test/serialize/block-nested-with-inline-nested.js b/packages/slate-plain-serializer/test/serialize/block-nested-with-inline-nested.js
index dac5b0116..8efeda4eb 100644
--- a/packages/slate-plain-serializer/test/serialize/block-nested-with-inline-nested.js
+++ b/packages/slate-plain-serializer/test/serialize/block-nested-with-inline-nested.js
@@ -3,7 +3,7 @@
import h from '../helpers/h'
export const input = (
-
+
@@ -18,7 +18,7 @@ export const input = (
-
+
)
export const output = `
diff --git a/packages/slate-plain-serializer/test/serialize/block-nested-with-inlines.js b/packages/slate-plain-serializer/test/serialize/block-nested-with-inlines.js
index 7e319ae4d..48a8c85d0 100644
--- a/packages/slate-plain-serializer/test/serialize/block-nested-with-inlines.js
+++ b/packages/slate-plain-serializer/test/serialize/block-nested-with-inlines.js
@@ -3,7 +3,7 @@
import h from '../helpers/h'
export const input = (
-
+
@@ -18,7 +18,7 @@ export const input = (
-
+
)
export const output = `
diff --git a/packages/slate-plain-serializer/test/serialize/block-with-data.js b/packages/slate-plain-serializer/test/serialize/block-with-data.js
index e7f9d65fe..09b7e3e23 100644
--- a/packages/slate-plain-serializer/test/serialize/block-with-data.js
+++ b/packages/slate-plain-serializer/test/serialize/block-with-data.js
@@ -3,13 +3,13 @@
import h from '../helpers/h'
export const input = (
-
+
one
-
+
)
export const output = `
diff --git a/packages/slate-plain-serializer/test/serialize/block-with-is-void.js b/packages/slate-plain-serializer/test/serialize/block-with-is-void.js
index 58d5290bc..0b4e46734 100644
--- a/packages/slate-plain-serializer/test/serialize/block-with-is-void.js
+++ b/packages/slate-plain-serializer/test/serialize/block-with-is-void.js
@@ -3,11 +3,11 @@
import h from '../helpers/h'
export const input = (
-
+
-
+
)
export const output = ' '
diff --git a/packages/slate-plain-serializer/test/serialize/block-with-mark.js b/packages/slate-plain-serializer/test/serialize/block-with-mark.js
index 0c8aef602..36292cb56 100644
--- a/packages/slate-plain-serializer/test/serialize/block-with-mark.js
+++ b/packages/slate-plain-serializer/test/serialize/block-with-mark.js
@@ -3,13 +3,13 @@
import h from '../helpers/h'
export const input = (
-
+
one
-
+
)
export const output = `
diff --git a/packages/slate-plain-serializer/test/serialize/block.js b/packages/slate-plain-serializer/test/serialize/block.js
index 6b9618386..597b389eb 100644
--- a/packages/slate-plain-serializer/test/serialize/block.js
+++ b/packages/slate-plain-serializer/test/serialize/block.js
@@ -3,13 +3,13 @@
import h from '../helpers/h'
export const input = (
-
+
one
-
+
)
export const output = `
diff --git a/packages/slate-plain-serializer/test/serialize/inline-nested.js b/packages/slate-plain-serializer/test/serialize/inline-nested.js
index 70720be41..37eb1f17b 100644
--- a/packages/slate-plain-serializer/test/serialize/inline-nested.js
+++ b/packages/slate-plain-serializer/test/serialize/inline-nested.js
@@ -3,7 +3,7 @@
import h from '../helpers/h'
export const input = (
-
+
@@ -13,7 +13,7 @@ export const input = (
-
+
)
export const output = `
diff --git a/packages/slate-plain-serializer/test/serialize/inline-with-data.js b/packages/slate-plain-serializer/test/serialize/inline-with-data.js
index c9535360b..1a04679cb 100644
--- a/packages/slate-plain-serializer/test/serialize/inline-with-data.js
+++ b/packages/slate-plain-serializer/test/serialize/inline-with-data.js
@@ -3,7 +3,7 @@
import h from '../helpers/h'
export const input = (
-
+
@@ -11,7 +11,7 @@ export const input = (
-
+
)
export const output = `
diff --git a/packages/slate-plain-serializer/test/serialize/inline-with-is-void.js b/packages/slate-plain-serializer/test/serialize/inline-with-is-void.js
index 246e8c39f..258673c34 100644
--- a/packages/slate-plain-serializer/test/serialize/inline-with-is-void.js
+++ b/packages/slate-plain-serializer/test/serialize/inline-with-is-void.js
@@ -3,13 +3,13 @@
import h from '../helpers/h'
export const input = (
-
+
-
+
)
export const output = ' '
diff --git a/packages/slate-plain-serializer/test/serialize/inline-with-mark.js b/packages/slate-plain-serializer/test/serialize/inline-with-mark.js
index ad2814bf0..1cb9f82c5 100644
--- a/packages/slate-plain-serializer/test/serialize/inline-with-mark.js
+++ b/packages/slate-plain-serializer/test/serialize/inline-with-mark.js
@@ -3,7 +3,7 @@
import h from '../helpers/h'
export const input = (
-
+
@@ -11,7 +11,7 @@ export const input = (
-
+
)
export const output = `
diff --git a/packages/slate-plain-serializer/test/serialize/inline.js b/packages/slate-plain-serializer/test/serialize/inline.js
index 28b3f36c4..9ff2292e2 100644
--- a/packages/slate-plain-serializer/test/serialize/inline.js
+++ b/packages/slate-plain-serializer/test/serialize/inline.js
@@ -3,7 +3,7 @@
import h from '../helpers/h'
export const input = (
-
+
@@ -11,7 +11,7 @@ export const input = (
-
+
)
export const output = `
diff --git a/packages/slate-prop-types/src/index.js b/packages/slate-prop-types/src/index.js
index 82533c984..3af9d4ddb 100644
--- a/packages/slate-prop-types/src/index.js
+++ b/packages/slate-prop-types/src/index.js
@@ -1,4 +1,6 @@
+import logger from 'slate-dev-logger'
+
import {
Block,
Change,
@@ -13,7 +15,7 @@ import {
Range,
Schema,
Stack,
- State,
+ Value,
Text,
} from 'slate'
@@ -72,9 +74,14 @@ const Types = {
ranges: create('List', v => Range.isRangeList(v)),
schema: create('Schema', v => Schema.isSchema(v)),
stack: create('Stack', v => Stack.isStack(v)),
- state: create('State', v => State.isState(v)),
+ value: create('Value', v => Value.isValue(v)),
text: create('Text', v => Text.isText(v)),
texts: create('List', v => Text.isTextList(v)),
+
+ state: create('State', (v) => {
+ logger.deprecate('slate-prop-types@0.3.0', 'The `state` prop type has been renamed to `value`.')
+ return Value.isValue(v)
+ })
}
/**
diff --git a/packages/slate-react/src/components/Readme.md b/packages/slate-react/src/components/Readme.md
deleted file mode 100644
index 2a3a44bc9..000000000
--- a/packages/slate-react/src/components/Readme.md
+++ /dev/null
@@ -1,49 +0,0 @@
-
-This directory contains the React components that Slate renders. Here's what they all do:
-
-- [Content](#content)
-- [Editor](#editor)
-- [Leaf](#leaf)
-- [Placeholder](#placeholder)
-- [Text](#text)
-- [Void](#void)
-
-
-#### Content
-
-`Content` is rendered by the [`Editor`](#editor). Its goal is to encapsulate all of the `contenteditable` logic, so that the [`Editor`](#editor) doesn't have to be aware of it.
-
-`Content` handles things attaching event listeners to the DOM and triggering updates based on events. However, it does not have any awareness of "plugins" as a concept, bubbling all of that logic up to the [`Editor`](#editor) itself.
-
-You'll notice there are **no** `Block` or `Inline` components. That's because those rendering components are provided by the user, and rendered directly by the `Content` component. You can find the default renderers in the [`Core`](../plugins/core.js) plugin's logic.
-
-
-#### Editor
-
-The `Editor` is the highest-level component that you render from inside your application. Its goal is to present a very clean API for the user, and to encapsulate all of the plugin-level logic.
-
-Many of the properties passed into the editor are combined to create a plugin of its own, that is given the highest priority. This makes overriding core logic super simple, without having to write a separate plugin.
-
-
-#### Leaf
-
-The `Leaf` component is the lowest-level component in the React tree. Its goal is to encapsulate the logic that works at the lowest level, on the actual strings of text in the DOM.
-
-One `Leaf` component is rendered for each range of text with a unique set of [`Marks`](../models#mark). It handles both applying the mark styles to the text, and translating the current [`Selection`](../models#selection) into a real DOM selection, since it knows about the string offsets.
-
-
-#### Placeholder
-
-A `Placeholder` component is just a convenience for rendering placeholders on top of empty nodes. It's used in the core plugin's default block renderer, but is also exposed to provide the convenient API for custom blocks as well.
-
-
-#### Text
-
-A `Text` component is rendered for each [`Text`](../models#text) model in the document tree. This component handles grouping the characters of the text node into leaves that have the same set of [`Marks`](../models#mark), and then delegates rendering each leaf to...
-
-
-#### Void
-
-The `Void` component is a wrapper that gets rendered around [`Block`](../models#block) and [`Inline`](../models#inline) nodes that have `isVoid: true`. Its goal is to encapsule the logic needed to ensure that void nodes function as expected.
-
-To achieve this, `Void` renders a few extra elements that are required to keep selections and keyboard shortcuts on void nodes functioning like you'd expect them two. It also ensures that everything inside the void node is not editable, so that it doesn't get the editor into an unknown state.
diff --git a/packages/slate-react/src/components/content.js b/packages/slate-react/src/components/content.js
index 67f149235..73bfaa446 100644
--- a/packages/slate-react/src/components/content.js
+++ b/packages/slate-react/src/components/content.js
@@ -1,7 +1,6 @@
import Debug from 'debug'
import React from 'react'
-import SlateTypes from 'slate-prop-types'
import Types from 'prop-types'
import getWindow from 'get-window'
import logger from 'slate-dev-logger'
@@ -43,9 +42,7 @@ class Content extends React.Component {
editor: Types.object.isRequired,
readOnly: Types.bool.isRequired,
role: Types.string,
- schema: SlateTypes.schema.isRequired,
spellCheck: Types.bool.isRequired,
- state: SlateTypes.state.isRequired,
style: Types.object,
tabIndex: Types.number,
tagName: Types.string,
@@ -124,8 +121,9 @@ class Content extends React.Component {
*/
updateSelection = () => {
- const { state } = this.props
- const { selection } = state
+ const { editor } = this.props
+ const { value } = editor
+ const { selection } = value
const window = getWindow(this.element)
const native = window.getSelection()
const { rangeCount } = native
@@ -246,11 +244,12 @@ class Content extends React.Component {
// already up to date, but we do want to update the native selection again
// to make sure it is in sync. (2017/10/16)
if (handler == 'onSelect') {
- const { state } = this.props
- const { selection } = state
+ const { editor } = this.props
+ const { value } = editor
+ const { selection } = value
const window = getWindow(event.target)
const native = window.getSelection()
- const range = findRange(native, state)
+ const range = findRange(native, value)
if (range && range.equals(selection)) {
this.updateSelection()
@@ -323,16 +322,17 @@ class Content extends React.Component {
event.preventDefault()
- const { editor, state } = this.props
- const { selection } = state
- const range = findRange(targetRange, state)
+ const { editor } = this.props
+ const { value } = editor
+ const { selection } = value
+ const range = findRange(targetRange, value)
editor.change((change) => {
change.insertTextAtRange(range, text, selection.marks)
// If the text was successfully inserted, and the selection had marks on it,
// unset the selection's marks.
- if (selection.marks && state.document != change.state.document) {
+ if (selection.marks && value.document != change.value.document) {
change.select({ marks: null })
}
})
@@ -346,9 +346,10 @@ class Content extends React.Component {
render() {
const { props } = this
- const { className, readOnly, state, tabIndex, role, tagName } = props
+ const { className, readOnly, editor, tabIndex, role, tagName } = props
+ const { value } = editor
const Container = tagName
- const { document, selection } = state
+ const { document, selection } = value
const indexes = document.getSelectionIndexes(selection, selection.isFocused)
const children = document.nodes.toArray().map((child, i) => {
const isSelected = !!indexes && indexes.start <= i && i < indexes.end
@@ -368,7 +369,7 @@ class Content extends React.Component {
// Allow words to break if they are too long.
wordWrap: 'break-word',
// COMPAT: In iOS, a formatting menu with bold, italic and underline
- // buttons is shown which causes our internal state to get out of sync in
+ // buttons is shown which causes our internal value to get out of sync in
// weird ways. This hides that. (2016/06/21)
...(readOnly ? {} : { WebkitUserModify: 'read-write-plaintext-only' }),
// Allow for passed-in styles to override anything.
@@ -377,7 +378,7 @@ class Content extends React.Component {
// COMPAT: In Firefox, spellchecking can remove entire wrapping elements
// including inline ones like ``, which is jarring for the user but also
- // causes the DOM to get into an irreconcilable state. (2016/09/01)
+ // causes the DOM to get into an irreconcilable value. (2016/09/01)
const spellCheck = IS_FIREFOX ? false : props.spellCheck
debug('render', { props })
@@ -432,9 +433,10 @@ class Content extends React.Component {
*/
renderNode = (child, isSelected) => {
- const { editor, readOnly, schema, state } = this.props
- const { document, decorations } = state
- const stack = editor.getStack()
+ const { editor, readOnly } = this.props
+ const { value } = editor
+ const { document, decorations } = value
+ const { stack } = editor
let decs = document.getDecorations(stack)
if (decorations) decs = decorations.concat(decs)
return (
@@ -447,8 +449,6 @@ class Content extends React.Component {
node={child}
parent={document}
readOnly={readOnly}
- schema={schema}
- state={state}
/>
)
}
diff --git a/packages/slate-react/src/components/editor.js b/packages/slate-react/src/components/editor.js
index c10cd18c9..839d5ed3c 100644
--- a/packages/slate-react/src/components/editor.js
+++ b/packages/slate-react/src/components/editor.js
@@ -5,7 +5,7 @@ import React from 'react'
import SlateTypes from 'slate-prop-types'
import Types from 'prop-types'
import logger from 'slate-dev-logger'
-import { Schema, Stack, State } from 'slate'
+import { Schema, Stack, Value } from 'slate'
import EVENT_HANDLERS from '../constants/event-handlers'
import PLUGINS_PROPS from '../constants/plugin-props'
@@ -48,9 +48,9 @@ class Editor extends React.Component {
role: Types.string,
schema: Types.object,
spellCheck: Types.bool,
- state: SlateTypes.state.isRequired,
style: Types.object,
tabIndex: Types.number,
+ value: SlateTypes.value.isRequired,
}
/**
@@ -82,6 +82,13 @@ class Editor extends React.Component {
this.tmp.updates = 0
this.tmp.resolves = 0
+ let { value } = props
+
+ if (!value && props.state) {
+ logger.deprecate('slate-react@0.9.0', 'The `props.state` prop has been renamed to `props.value`.')
+ value = props.state
+ }
+
// Resolve the plugins and create a stack and schema from them.
const plugins = this.resolvePlugins(props.plugins, props.schema)
const stack = Stack.create({ plugins })
@@ -89,14 +96,13 @@ class Editor extends React.Component {
this.state.schema = schema
this.state.stack = stack
- // Run `onChange` on the passed-in state because we need to ensure that it
+ // Run `onChange` on the passed-in value because we need to ensure that it
// is normalized, and queue the resulting change.
- const change = props.state.change()
+ const change = value.change()
stack.run('onChange', change, this)
- const { state } = change
this.queueChange(change)
- this.cacheState(state)
- this.state.state = state
+ this.cacheValue(change.value)
+ this.state.value = change.value
// Create a bound event handler for each event.
EVENT_HANDLERS.forEach((handler) => {
@@ -116,15 +122,20 @@ class Editor extends React.Component {
/**
* When the `props` are updated, create a new `Stack` if necessary and run
- * `onChange` to ensure the state is normalized.
+ * `onChange` to ensure the value is normalized.
*
* @param {Object} props
*/
componentWillReceiveProps = (props) => {
- let { state } = props
+ let { value } = props
let { schema, stack } = this.state
+ if (!value && props.state) {
+ logger.deprecate('slate-react@0.9.0', 'The `props.state` prop has been renamed to `props.value`.')
+ value = props.state
+ }
+
// Increment the updates counter as a baseline.
this.tmp.updates++
@@ -146,14 +157,13 @@ class Editor extends React.Component {
}
}
- // Run `onChange` on the passed-in state because we need to ensure that it
+ // Run `onChange` on the passed-in value because we need to ensure that it
// is normalized, and queue the resulting change.
- const change = state.change()
+ const change = value.change()
stack.run('onChange', change, this)
- state = change.state
this.queueChange(change)
- this.cacheState(state)
- this.setState({ state })
+ this.cacheValue(change.value)
+ this.setState({ value: change.value })
}
/**
@@ -173,19 +183,19 @@ class Editor extends React.Component {
}
/**
- * Cache a `state` object to be able to compare against it later.
+ * Cache a `value` object to be able to compare against it later.
*
- * @param {State} state
+ * @param {Value} value
*/
- cacheState = (state) => {
- this.tmp.document = state.document
- this.tmp.selection = state.selection
+ cacheValue = (value) => {
+ this.tmp.document = value.document
+ this.tmp.selection = value.selection
}
/**
* Queue a `change` object, to be able to flush it later. This is required for
- * when a change needs to be applied to the state, but because of the React
+ * when a change needs to be applied to the value, but because of the React
* lifecycle we can't apply that change immediately. So we cache it here and
* later can call `this.flushChange()` to flush it.
*
@@ -216,6 +226,17 @@ class Editor extends React.Component {
}
}
+ /**
+ * Perform a change on the editor, passing `...args` to `change.call`.
+ *
+ * @param {Mixed} ...args
+ */
+
+ change = (...args) => {
+ const change = this.value.change().call(...args)
+ this.onChange(change)
+ }
+
/**
* Programmatically blur the editor.
*/
@@ -232,6 +253,22 @@ class Editor extends React.Component {
this.change(c => c.focus())
}
+ /**
+ * Getters for exposing public properties of the editor's state.
+ */
+
+ get schema() {
+ return this.state.schema
+ }
+
+ get stack() {
+ return this.state.stack
+ }
+
+ get value() {
+ return this.state.value
+ }
+
/**
* Get the editor's current schema.
*
@@ -239,7 +276,8 @@ class Editor extends React.Component {
*/
getSchema = () => {
- return this.state.schema
+ logger.deprecate('slate-react@0.9.0', 'The `editor.getSchema()` method has been deprecated, use the `editor.schema` property getter instead.')
+ return this.schema
}
/**
@@ -249,29 +287,19 @@ class Editor extends React.Component {
*/
getStack = () => {
- return this.state.stack
+ logger.deprecate('slate-react@0.9.0', 'The `editor.getStack()` method has been deprecated, use the `editor.stack` property getter instead.')
+ return this.stack
}
/**
- * Get the editor's current state.
+ * Get the editor's current value.
*
- * @return {State}
+ * @return {Value}
*/
getState = () => {
- return this.state.state
- }
-
- /**
- * Perform a change on the editor, passing `...args` to `change.call`.
- *
- * @param {Mixed} ...args
- */
-
- change = (...args) => {
- const { state } = this.state
- const change = state.change().call(...args)
- this.onChange(change)
+ logger.deprecate('slate-react@0.9.0', 'The `editor.getState()` method has been deprecated, use the `editor.value` property getter instead.')
+ return this.value
}
/**
@@ -282,10 +310,9 @@ class Editor extends React.Component {
*/
onEvent = (handler, event) => {
- const { stack, state } = this.state
- const change = state.change()
- stack.run(handler, event, change, this)
- this.onChange(change)
+ this.change((change) => {
+ this.stack.run(handler, event, change, this)
+ })
}
/**
@@ -297,20 +324,20 @@ class Editor extends React.Component {
onChange = (change) => {
debug('onChange', { change })
- if (State.isState(change)) {
- throw new Error('As of slate@0.22.0 the `editor.onChange` method must be passed a `Change` object not a `State` object.')
+ if (Value.isValue(change)) {
+ throw new Error('As of slate@0.22.0 the `editor.onChange` method must be passed a `Change` object not a `Value` object.')
}
- const { stack } = this.state
- stack.run('onChange', change, this)
- const { state } = change
+ this.stack.run('onChange', change, this)
+
+ const { value } = change
const { document, selection } = this.tmp
const { onChange, onDocumentChange, onSelectionChange } = this.props
+ if (value == this.value) return
- if (state == this.state.state) return
onChange(change)
- if (onDocumentChange && state.document != document) onDocumentChange(state.document, change)
- if (onSelectionChange && state.selection != selection) onSelectionChange(state.selection, change)
+ if (onDocumentChange && value.document != document) onDocumentChange(value.document, change)
+ if (onSelectionChange && value.selection != selection) onSelectionChange(value.selection, change)
}
/**
@@ -322,13 +349,12 @@ class Editor extends React.Component {
render() {
debug('render', this)
- const { stack, state } = this.state
- const children = stack
- .map('renderPortal', state, this)
+ const children = this.stack
+ .map('renderPortal', this.value, this)
.map((child, i) => {child} )
const props = { ...this.props, children }
- const tree = stack.render('renderEditor', props, state, this)
+ const tree = this.stack.render('renderEditor', props, this)
return tree
}
diff --git a/packages/slate-react/src/components/leaf.js b/packages/slate-react/src/components/leaf.js
index d25c647e6..a5de819cb 100644
--- a/packages/slate-react/src/components/leaf.js
+++ b/packages/slate-react/src/components/leaf.js
@@ -37,8 +37,6 @@ class Leaf extends React.Component {
node: SlateTypes.node.isRequired,
offset: Types.number.isRequired,
parent: SlateTypes.node.isRequired,
- schema: SlateTypes.schema.isRequired,
- state: SlateTypes.state.isRequired,
text: Types.string.isRequired,
}
@@ -65,7 +63,6 @@ class Leaf extends React.Component {
if (
props.index != this.props.index ||
props.marks != this.props.marks ||
- props.schema != this.props.schema ||
props.text != this.props.text ||
props.parent != this.props.parent
) {
@@ -105,12 +102,12 @@ class Leaf extends React.Component {
*/
renderMarks() {
- const { marks, schema, node, offset, text, state, editor } = this.props
- const stack = editor.getStack()
+ const { marks, node, offset, text, editor } = this.props
+ const { stack } = editor
const leaf = this.renderText()
return marks.reduce((children, mark) => {
- const props = { editor, mark, marks, node, offset, schema, state, text, children }
+ const props = { editor, mark, marks, node, offset, text, children }
const element = stack.find('renderMark', props)
return element || children
}, leaf)
diff --git a/packages/slate-react/src/components/node.js b/packages/slate-react/src/components/node.js
index e1bd41d7b..275b1fc6a 100644
--- a/packages/slate-react/src/components/node.js
+++ b/packages/slate-react/src/components/node.js
@@ -39,8 +39,6 @@ class Node extends React.Component {
node: SlateTypes.node.isRequired,
parent: SlateTypes.node.isRequired,
readOnly: Types.bool.isRequired,
- schema: SlateTypes.schema.isRequired,
- state: SlateTypes.state.isRequired,
}
/**
@@ -60,13 +58,13 @@ class Node extends React.Component {
* Should the node update?
*
* @param {Object} nextProps
- * @param {Object} state
+ * @param {Object} value
* @return {Boolean}
*/
shouldComponentUpdate = (nextProps) => {
const { props } = this
- const stack = props.editor.getStack()
+ const { stack } = props.editor
const shouldUpdate = stack.find('shouldNodeComponentUpdate', props, nextProps)
const n = nextProps
const p = props
@@ -94,10 +92,10 @@ class Node extends React.Component {
// for simplicity we just let them through.
if (n.node != p.node) return true
- // If the selection state of the node or of some of its children has changed,
+ // If the selection value of the node or of some of its children has changed,
// re-render in case there is any user-land logic depends on it to render.
// if the node is selected update it, even if it was already selected: the
- // selection state of some of its children could have been changed and they
+ // selection value of some of its children could have been changed and they
// need to be rendered again.
if (n.isSelected || p.isSelected) return true
@@ -117,9 +115,10 @@ class Node extends React.Component {
render() {
this.debug('render', this)
- const { editor, isSelected, node, parent, readOnly, state } = this.props
- const { selection } = state
- const stack = editor.getStack()
+ const { editor, isSelected, node, parent, readOnly } = this.props
+ const { value } = editor
+ const { selection } = value
+ const { stack } = editor
const indexes = node.getSelectionIndexes(selection, isSelected)
let children = node.nodes.toArray().map((child, i) => {
const isChildSelected = !!indexes && indexes.start <= i && i < indexes.end
@@ -144,7 +143,6 @@ class Node extends React.Component {
node,
parent,
readOnly,
- state
}
let placeholder = stack.find('renderPlaceholder', props)
@@ -170,9 +168,9 @@ class Node extends React.Component {
*/
renderNode = (child, isSelected) => {
- const { block, decorations, editor, node, readOnly, schema, state } = this.props
+ const { block, decorations, editor, node, readOnly } = this.props
+ const { stack } = editor
const Component = child.kind == 'text' ? Text : Node
- const stack = editor.getStack()
const decs = decorations.concat(node.getDecorations(stack))
return (
)
}
diff --git a/packages/slate-react/src/components/text.js b/packages/slate-react/src/components/text.js
index 4a1e30236..2baf93f17 100644
--- a/packages/slate-react/src/components/text.js
+++ b/packages/slate-react/src/components/text.js
@@ -35,8 +35,6 @@ class Text extends React.Component {
editor: Types.object.isRequired,
node: SlateTypes.node.isRequired,
parent: SlateTypes.node.isRequired,
- schema: SlateTypes.schema.isRequired,
- state: SlateTypes.state.isRequired,
style: Types.object,
}
@@ -67,7 +65,7 @@ class Text extends React.Component {
* Should the node update?
*
* @param {Object} nextProps
- * @param {Object} state
+ * @param {Object} value
* @return {Boolean}
*/
@@ -104,11 +102,11 @@ class Text extends React.Component {
*/
render() {
- const { props } = this
- this.debug('render', { props })
+ this.debug('render', this)
- const { decorations, node, state, style } = props
- const { document } = state
+ const { decorations, editor, node, style } = this.props
+ const { value } = editor
+ const { document } = value
const { key } = node
const decs = decorations.filter((d) => {
@@ -146,7 +144,7 @@ class Text extends React.Component {
*/
renderLeaf = (leaves, leaf, index, offset) => {
- const { block, node, parent, schema, state, editor } = this.props
+ const { block, node, parent, editor } = this.props
const { text, marks } = leaf
return (
@@ -160,8 +158,6 @@ class Text extends React.Component {
offset={offset}
parent={parent}
leaves={leaves}
- schema={schema}
- state={state}
text={text}
/>
)
diff --git a/packages/slate-react/src/components/void.js b/packages/slate-react/src/components/void.js
index 2743e5201..079f79ce9 100644
--- a/packages/slate-react/src/components/void.js
+++ b/packages/slate-react/src/components/void.js
@@ -35,8 +35,6 @@ class Void extends React.Component {
node: SlateTypes.node.isRequired,
parent: SlateTypes.node.isRequired,
readOnly: Types.bool.isRequired,
- schema: SlateTypes.schema.isRequired,
- state: SlateTypes.state.isRequired,
}
/**
@@ -112,7 +110,7 @@ class Void extends React.Component {
*/
renderText = () => {
- const { block, decorations, isSelected, node, readOnly, schema, state, editor } = this.props
+ const { block, decorations, isSelected, node, readOnly, editor } = this.props
const child = node.getFirstText()
return (
)
}
diff --git a/packages/slate-react/src/plugins/Readme.md b/packages/slate-react/src/plugins/Readme.md
deleted file mode 100644
index cf6d8b2f0..000000000
--- a/packages/slate-react/src/plugins/Readme.md
+++ /dev/null
@@ -1,2 +0,0 @@
-
-This directory contains the only plugin that ships with Slate by default, which controls all of the "core" logic. For example, it handles splitting apart paragraphs when `enter` is pressed, or inserting plain text content from the clipboard on paste.
diff --git a/packages/slate-react/src/plugins/after.js b/packages/slate-react/src/plugins/after.js
index 7b9ad9227..80520c558 100644
--- a/packages/slate-react/src/plugins/after.js
+++ b/packages/slate-react/src/plugins/after.js
@@ -75,9 +75,9 @@ function AfterPlugin() {
function onClick(event, change, editor) {
if (editor.props.readOnly) return true
- const { state } = change
- const { document } = state
- const node = findNode(event.target, state)
+ const { value } = change
+ const { document } = value
+ const node = findNode(event.target, value)
const isVoid = node && (node.isVoid || document.hasVoidParent(node.key))
if (isVoid) {
@@ -137,8 +137,8 @@ function AfterPlugin() {
function onCutOrCopy(event, change, editor) {
const window = getWindow(event.target)
const native = window.getSelection()
- const { state } = change
- const { startKey, endKey, startText, endBlock, endInline } = state
+ const { value } = change
+ const { startKey, endKey, startText, endBlock, endInline } = value
const isVoidBlock = endBlock && endBlock.isVoid
const isVoidInline = endInline && endInline.isVoid
const isVoid = isVoidBlock || isVoidInline
@@ -148,7 +148,7 @@ function AfterPlugin() {
// Create a fake selection so that we can add a Base64-encoded copy of the
// fragment to the HTML, to decode on future pastes.
- const { fragment } = state
+ const { fragment } = value
const encoded = Base64.serializeNode(fragment)
const range = native.getRangeAt(0)
let contents = range.cloneContents()
@@ -172,7 +172,7 @@ function AfterPlugin() {
// startText node
if ((IS_CHROME || IS_SAFARI) && !isVoid && startKey === endKey) {
const hasMarks = startText.characters
- .slice(state.selection.anchorOffset, state.selection.focusOffset)
+ .slice(value.selection.anchorOffset, value.selection.focusOffset)
.filter(char => char.marks.size !== 0)
.size !== 0
if (hasMarks) {
@@ -279,16 +279,16 @@ function AfterPlugin() {
isDraggingInternally = true
- const { state } = change
- const { document } = state
- const node = findNode(event.target, state)
+ const { value } = change
+ const { document } = value
+ const node = findNode(event.target, value)
const isVoid = node && (node.isVoid || document.hasVoidParent(node.key))
if (isVoid) {
const encoded = Base64.serializeNode(node, { preserveKeys: true })
setEventTransfer(event, 'node', encoded)
} else {
- const { fragment } = state
+ const { fragment } = value
const encoded = Base64.serializeNode(fragment)
setEventTransfer(event, 'fragment', encoded)
}
@@ -305,9 +305,9 @@ function AfterPlugin() {
function onDrop(event, change, editor) {
debug('onDrop', { event })
- const { state } = change
- const { document, selection } = state
- let target = getEventRange(event, state)
+ const { value } = change
+ const { document, selection } = value
+ let target = getEventRange(event, value)
if (!target) return
const transfer = getEventTransfer(event)
@@ -395,16 +395,16 @@ function AfterPlugin() {
debug('onInput', { event })
const window = getWindow(event.target)
- const { state } = change
+ const { value } = change
// Get the selection point.
const native = window.getSelection()
const { anchorNode, anchorOffset } = native
- const point = findPoint(anchorNode, anchorOffset, state)
+ const point = findPoint(anchorNode, anchorOffset, value)
if (!point) return
// Get the text node and leaf in question.
- const { document, selection } = state
+ const { document, selection } = value
const node = document.getDescendant(point.key)
const leaves = node.getLeaves()
let start = 0
@@ -441,7 +441,7 @@ function AfterPlugin() {
const corrected = selection.collapseToEnd().move(delta)
const entire = selection.moveAnchorTo(point.key, start).moveFocusTo(point.key, end)
- // Change the current state to have the leaf's text replaced.
+ // Change the current value to have the leaf's text replaced.
change
.select(entire)
.delete()
@@ -460,10 +460,10 @@ function AfterPlugin() {
function onKeyDown(event, change, editor) {
debug('onKeyDown', { event })
- const { state } = change
+ const { value } = change
if (HOTKEYS.SPLIT_BLOCK(event)) {
- return state.isInVoid
+ return value.isInVoid
? change.collapseToStartOfNextText()
: change.splitBlock()
}
@@ -527,7 +527,7 @@ function AfterPlugin() {
// an inline is selected, we need to handle these hotkeys manually because
// browsers won't know what to do.
if (HOTKEYS.COLLAPSE_CHAR_BACKWARD(event)) {
- const { document, isInVoid, previousText, startText } = state
+ const { document, isInVoid, previousText, startText } = value
const isPreviousInVoid = previousText && document.hasVoidParent(previousText.key)
if (isInVoid || isPreviousInVoid || startText.text == '') {
event.preventDefault()
@@ -536,7 +536,7 @@ function AfterPlugin() {
}
if (HOTKEYS.COLLAPSE_CHAR_FORWARD(event)) {
- const { document, isInVoid, nextText, startText } = state
+ const { document, isInVoid, nextText, startText } = value
const isNextInVoid = nextText && document.hasVoidParent(nextText.key)
if (isInVoid || isNextInVoid || startText.text == '') {
event.preventDefault()
@@ -545,7 +545,7 @@ function AfterPlugin() {
}
if (HOTKEYS.EXTEND_CHAR_BACKWARD(event)) {
- const { document, isInVoid, previousText, startText } = state
+ const { document, isInVoid, previousText, startText } = value
const isPreviousInVoid = previousText && document.hasVoidParent(previousText.key)
if (isInVoid || isPreviousInVoid || startText.text == '') {
event.preventDefault()
@@ -554,7 +554,7 @@ function AfterPlugin() {
}
if (HOTKEYS.EXTEND_CHAR_FORWARD(event)) {
- const { document, isInVoid, nextText, startText } = state
+ const { document, isInVoid, nextText, startText } = value
const isNextInVoid = nextText && document.hasVoidParent(nextText.key)
if (isInVoid || isNextInVoid || startText.text == '') {
event.preventDefault()
@@ -582,8 +582,8 @@ function AfterPlugin() {
}
if (type == 'text' || type == 'html') {
- const { state } = change
- const { document, selection, startBlock } = state
+ const { value } = change
+ const { document, selection, startBlock } = value
if (startBlock.isVoid) return
const defaultBlock = startBlock
@@ -605,8 +605,8 @@ function AfterPlugin() {
debug('onSelect', { event })
const window = getWindow(event.target)
- const { state } = change
- const { document } = state
+ const { value } = change
+ const { document } = value
const native = window.getSelection()
// If there are no ranges, the editor was blurred natively.
@@ -616,7 +616,7 @@ function AfterPlugin() {
}
// Otherwise, determine the Slate selection from the native one.
- let range = findRange(native, state)
+ let range = findRange(native, value)
if (!range) return
const { anchorKey, anchorOffset, focusKey, focusOffset } = range
@@ -676,12 +676,11 @@ function AfterPlugin() {
* Render editor.
*
* @param {Object} props
- * @param {State} state
* @param {Editor} editor
* @return {Object}
*/
- function renderEditor(props, state, editor) {
+ function renderEditor(props, editor) {
const handlers = EVENT_HANDLERS.reduce((obj, handler) => {
obj[handler] = editor[handler]
return obj
@@ -697,9 +696,7 @@ function AfterPlugin() {
editor={editor}
readOnly={props.readOnly}
role={props.role}
- schema={editor.getSchema()}
spellCheck={props.spellCheck}
- state={state}
style={props.style}
tabIndex={props.tabIndex}
tagName={props.tagName}
@@ -730,11 +727,11 @@ function AfterPlugin() {
*/
function renderPlaceholder(props) {
- const { editor, node, state } = props
+ const { editor, node } = props
if (node.kind != 'block') return
if (!Text.isTextList(node.nodes)) return
if (node.text != '') return
- if (state.document.getBlocks().size > 1) return
+ if (editor.value.document.getBlocks().size > 1) return
const style = {
pointerEvents: 'none',
diff --git a/packages/slate-react/src/plugins/before.js b/packages/slate-react/src/plugins/before.js
index b264ece03..adf08c789 100644
--- a/packages/slate-react/src/plugins/before.js
+++ b/packages/slate-react/src/plugins/before.js
@@ -61,7 +61,7 @@ function BeforePlugin() {
if (isCopying) return true
if (editor.props.readOnly) return true
- const { state } = change
+ const { value } = change
const focusTarget = event.relatedTarget
// If focusTarget is null, the blur event is due to the window itself being
@@ -82,7 +82,7 @@ function BeforePlugin() {
// (eg. a list item of the check list example).
if (
el.contains(focusTarget) &&
- !findNode(focusTarget, state).isVoid
+ !findNode(focusTarget, value).isVoid
) {
return true
}
@@ -98,13 +98,13 @@ function BeforePlugin() {
*/
function onChange(change, editor) {
- const { state } = change
- const schema = editor.getSchema()
+ const { value } = change
- // If the state's schema isn't the editor's schema, update it.
- if (state.schema != schema) {
+ // If the value's schema isn't the editor's schema, update it. This can
+ // happen on the initialization of the editor, or if the schema changes.
+ if (value.schema != editor.schema) {
change
- .setState({ schema })
+ .setValue({ schema: editor.schema })
.normalize()
}
@@ -282,7 +282,7 @@ function BeforePlugin() {
// Nothing happens in read-only mode.
if (editor.props.readOnly) return true
- // Prevent default so the DOM's state isn't corrupted.
+ // Prevent default so the DOM's value isn't corrupted.
event.preventDefault()
debug('onDrop', { event })
@@ -323,7 +323,7 @@ function BeforePlugin() {
function onInput(event, change, editor) {
if (isComposing) return true
- if (change.state.isBlurred) return true
+ if (change.value.isBlurred) return true
debug('onInput', { event })
}
@@ -348,7 +348,7 @@ function BeforePlugin() {
}
// Certain hotkeys have native behavior in contenteditable elements which
- // will cause our state to be out of sync, so prevent them.
+ // will cause our value to be out of sync, so prevent them.
if (HOTKEYS.CONTENTEDITABLE(event)) {
event.preventDefault()
}
diff --git a/packages/slate-react/src/utils/find-node.js b/packages/slate-react/src/utils/find-node.js
index 9c72aca67..a69764f16 100644
--- a/packages/slate-react/src/utils/find-node.js
+++ b/packages/slate-react/src/utils/find-node.js
@@ -3,17 +3,18 @@
* Find a Slate node from a DOM `element`.
*
* @param {Element} element
+ * @param {Value} value
* @return {Node|Null}
*/
-function findNode(element, state) {
+function findNode(element, value) {
const closest = element.closest('[data-key]')
if (!closest) return null
const key = closest.getAttribute('data-key')
if (!key) return null
- const node = state.document.getNode(key)
+ const node = value.document.getNode(key)
return node || null
}
diff --git a/packages/slate-react/src/utils/find-point.js b/packages/slate-react/src/utils/find-point.js
index e2b239715..3b7053c9b 100644
--- a/packages/slate-react/src/utils/find-point.js
+++ b/packages/slate-react/src/utils/find-point.js
@@ -19,11 +19,11 @@ const VOID_SELECTOR = '[data-slate-void]'
*
* @param {Element} nativeNode
* @param {Number} nativeOffset
- * @param {State} state
+ * @param {Value} value
* @return {Object}
*/
-function findPoint(nativeNode, nativeOffset, state) {
+function findPoint(nativeNode, nativeOffset, value) {
const {
node: nearestNode,
offset: nearestOffset,
@@ -71,7 +71,7 @@ function findPoint(nativeNode, nativeOffset, state) {
// COMPAT: If someone is clicking from one Slate editor into another, the
// select event fires twice, once for the old editor's `element` first, and
// then afterwards for the correct `element`. (2017/03/03)
- if (!state.document.hasDescendant(key)) return null
+ if (!value.document.hasDescendant(key)) return null
return {
key,
diff --git a/packages/slate-react/src/utils/find-range.js b/packages/slate-react/src/utils/find-range.js
index 6ec544e14..a59ef4dbf 100644
--- a/packages/slate-react/src/utils/find-range.js
+++ b/packages/slate-react/src/utils/find-range.js
@@ -9,11 +9,11 @@ import findPoint from './find-point'
* Find a Slate range from a DOM `native` selection.
*
* @param {Selection} native
- * @param {State} state
+ * @param {Value} value
* @return {Range}
*/
-function findRange(native, state) {
+function findRange(native, value) {
const el = native.anchorNode || native.startContainer
if (!el) return null
@@ -31,8 +31,8 @@ function findRange(native, state) {
}
const { anchorNode, anchorOffset, focusNode, focusOffset, isCollapsed } = native
- const anchor = findPoint(anchorNode, anchorOffset, state)
- const focus = isCollapsed ? anchor : findPoint(focusNode, focusOffset, state)
+ const anchor = findPoint(anchorNode, anchorOffset, value)
+ const focus = isCollapsed ? anchor : findPoint(focusNode, focusOffset, value)
if (!anchor || !focus) return null
const range = Range.create({
diff --git a/packages/slate-react/src/utils/get-event-range.js b/packages/slate-react/src/utils/get-event-range.js
index 0c74953d6..676880721 100644
--- a/packages/slate-react/src/utils/get-event-range.js
+++ b/packages/slate-react/src/utils/get-event-range.js
@@ -8,11 +8,11 @@ import findRange from './find-range'
* Get the target range from a DOM `event`.
*
* @param {Event} event
- * @param {State} state
+ * @param {Value} value
* @return {Range}
*/
-function getEventRange(event, state) {
+function getEventRange(event, value) {
if (event.nativeEvent) {
event = event.nativeEvent
}
@@ -35,10 +35,10 @@ function getEventRange(event, state) {
}
// Resolve a Slate range from the DOM range.
- let range = findRange(r, state)
+ let range = findRange(r, value)
if (!range) return null
- const { document } = state
+ const { document } = value
const node = document.getNode(range.anchorKey)
const parent = document.getParent(node.key)
const el = findDOMNode(parent)
diff --git a/packages/slate-react/test/plugins/core/on-blur/blur-selection.js b/packages/slate-react/test/plugins/core/on-blur/blur-selection.js
index 4af4f8ecd..71d453b13 100644
--- a/packages/slate-react/test/plugins/core/on-blur/blur-selection.js
+++ b/packages/slate-react/test/plugins/core/on-blur/blur-selection.js
@@ -7,19 +7,19 @@ export default function (simulator) {
}
export const input = (
-
+
-
+
)
export const output = (
-
+
-
+
)
diff --git a/packages/slate-react/test/plugins/core/on-key-down/split-empty-block.js b/packages/slate-react/test/plugins/core/on-key-down/split-empty-block.js
index dd3aee93f..4c99b3c3d 100644
--- a/packages/slate-react/test/plugins/core/on-key-down/split-empty-block.js
+++ b/packages/slate-react/test/plugins/core/on-key-down/split-empty-block.js
@@ -7,22 +7,22 @@ export default function (simulator) {
}
export const input = (
-
+
-
+
)
export const output = (
-
+
-
+
)
diff --git a/packages/slate-react/test/plugins/core/on-select/move-selection.js b/packages/slate-react/test/plugins/core/on-select/move-selection.js
index 6872d18ad..7a409a62e 100644
--- a/packages/slate-react/test/plugins/core/on-select/move-selection.js
+++ b/packages/slate-react/test/plugins/core/on-select/move-selection.js
@@ -4,28 +4,28 @@ import h from '../../../helpers/h'
import { Range } from 'slate'
export default function (simulator) {
- const { state } = simulator
- const text = state.document.getTexts().first()
+ const { value } = simulator
+ const text = value.document.getTexts().first()
const selection = Range.create().collapseToStartOf(text).move(1).focus()
simulator.select(null, { selection })
}
export const input = (
-
+
word
-
+
)
export const output = (
-
+
w ord
-
+
)
diff --git a/packages/slate-react/test/plugins/index.js b/packages/slate-react/test/plugins/index.js
index 1aee8db23..c66ce3146 100644
--- a/packages/slate-react/test/plugins/index.js
+++ b/packages/slate-react/test/plugins/index.js
@@ -27,10 +27,10 @@ describe('plugins', () => {
const { input, output, props = {}} = module
const fn = module.default
const plugins = [BeforePlugin(props), AfterPlugin(props)]
- const simulator = new Simulator({ plugins, state: input })
+ const simulator = new Simulator({ plugins, value: input })
fn(simulator)
- const actual = simulator.state.toJSON({ preserveSelection: true })
+ const actual = simulator.value.toJSON({ preserveSelection: true })
const expected = output.toJSON({ preserveSelection: true })
assert.deepEqual(actual, expected)
})
diff --git a/packages/slate-react/test/rendering/fixtures/custom-block-multiple.js b/packages/slate-react/test/rendering/fixtures/custom-block-multiple.js
index df8415738..2cc2cfdfb 100644
--- a/packages/slate-react/test/rendering/fixtures/custom-block-multiple.js
+++ b/packages/slate-react/test/rendering/fixtures/custom-block-multiple.js
@@ -21,8 +21,8 @@ export const props = {
renderNode,
}
-export const state = (
-
+export const value = (
+
word
@@ -34,7 +34,7 @@ export const state = (
word
-
+
)
export const output = `
diff --git a/packages/slate-react/test/rendering/fixtures/custom-block-void.js b/packages/slate-react/test/rendering/fixtures/custom-block-void.js
index 5ef58a18b..a70ef97e9 100644
--- a/packages/slate-react/test/rendering/fixtures/custom-block-void.js
+++ b/packages/slate-react/test/rendering/fixtures/custom-block-void.js
@@ -19,12 +19,12 @@ export const props = {
renderNode,
}
-export const state = (
-
+export const value = (
+
-
+
)
export const output = `
diff --git a/packages/slate-react/test/rendering/fixtures/custom-block.js b/packages/slate-react/test/rendering/fixtures/custom-block.js
index d5260cdab..9050cf5ee 100644
--- a/packages/slate-react/test/rendering/fixtures/custom-block.js
+++ b/packages/slate-react/test/rendering/fixtures/custom-block.js
@@ -19,14 +19,14 @@ export const props = {
}
}
-export const state = (
-
+export const value = (
+
word
-
+
)
export const output = `
diff --git a/packages/slate-react/test/rendering/fixtures/custom-decorator.js b/packages/slate-react/test/rendering/fixtures/custom-decorator.js
index 1b244d702..ab57834fb 100644
--- a/packages/slate-react/test/rendering/fixtures/custom-decorator.js
+++ b/packages/slate-react/test/rendering/fixtures/custom-decorator.js
@@ -29,14 +29,14 @@ export const props = {
renderMark,
}
-export const state = (
-
+export const value = (
+
one
-
+
)
export const output = `
diff --git a/packages/slate-react/test/rendering/fixtures/custom-inline-multiple.js b/packages/slate-react/test/rendering/fixtures/custom-inline-multiple.js
index 8a49c7d1e..898a8e122 100644
--- a/packages/slate-react/test/rendering/fixtures/custom-inline-multiple.js
+++ b/packages/slate-react/test/rendering/fixtures/custom-inline-multiple.js
@@ -19,8 +19,8 @@ export const props = {
renderNode,
}
-export const state = (
-
+export const value = (
+
@@ -34,7 +34,7 @@ export const state = (
-
+
)
export const output = `
diff --git a/packages/slate-react/test/rendering/fixtures/custom-inline-void.js b/packages/slate-react/test/rendering/fixtures/custom-inline-void.js
index 81c44e735..5501dec2d 100644
--- a/packages/slate-react/test/rendering/fixtures/custom-inline-void.js
+++ b/packages/slate-react/test/rendering/fixtures/custom-inline-void.js
@@ -19,14 +19,14 @@ export const props = {
renderNode,
}
-export const state = (
-
+export const value = (
+
-
+
)
export const output = `
diff --git a/packages/slate-react/test/rendering/fixtures/custom-inline.js b/packages/slate-react/test/rendering/fixtures/custom-inline.js
index 4195c8103..cf63155b0 100644
--- a/packages/slate-react/test/rendering/fixtures/custom-inline.js
+++ b/packages/slate-react/test/rendering/fixtures/custom-inline.js
@@ -19,8 +19,8 @@ export const props = {
renderNode,
}
-export const state = (
-
+export const value = (
+
@@ -28,7 +28,7 @@ export const state = (
-
+
)
export const output = `
diff --git a/packages/slate-react/test/rendering/fixtures/custom-mark.js b/packages/slate-react/test/rendering/fixtures/custom-mark.js
index f46bdc23d..393b6d5ac 100644
--- a/packages/slate-react/test/rendering/fixtures/custom-mark.js
+++ b/packages/slate-react/test/rendering/fixtures/custom-mark.js
@@ -17,14 +17,14 @@ export const props = {
renderMark,
}
-export const state = (
-
+export const value = (
+
onetwo three
-
+
)
export const output = `
diff --git a/packages/slate-react/test/rendering/fixtures/default-block-with-inline.js b/packages/slate-react/test/rendering/fixtures/default-block-with-inline.js
index 5fff9851f..41b305f7c 100644
--- a/packages/slate-react/test/rendering/fixtures/default-block-with-inline.js
+++ b/packages/slate-react/test/rendering/fixtures/default-block-with-inline.js
@@ -4,8 +4,8 @@ import h from '../../helpers/h'
export const props = {}
-export const state = (
-
+export const value = (
+
@@ -13,7 +13,7 @@ export const state = (
-
+
)
export const output = `
diff --git a/packages/slate-react/test/rendering/fixtures/default-block.js b/packages/slate-react/test/rendering/fixtures/default-block.js
index d672d7391..a475aec3d 100644
--- a/packages/slate-react/test/rendering/fixtures/default-block.js
+++ b/packages/slate-react/test/rendering/fixtures/default-block.js
@@ -4,14 +4,14 @@ import h from '../../helpers/h'
export const props = {}
-export const state = (
-
+export const value = (
+
word
-
+
)
export const output = `
diff --git a/packages/slate-react/test/rendering/fixtures/empty-block-with-inline.js b/packages/slate-react/test/rendering/fixtures/empty-block-with-inline.js
index ce996f858..e0c3c6d8f 100644
--- a/packages/slate-react/test/rendering/fixtures/empty-block-with-inline.js
+++ b/packages/slate-react/test/rendering/fixtures/empty-block-with-inline.js
@@ -4,14 +4,14 @@ import h from '../../helpers/h'
export const props = {}
-export const state = (
-
+export const value = (
+
-
+
)
export const output = `
diff --git a/packages/slate-react/test/rendering/fixtures/empty-block.js b/packages/slate-react/test/rendering/fixtures/empty-block.js
index 4541c4097..d5cf008a0 100644
--- a/packages/slate-react/test/rendering/fixtures/empty-block.js
+++ b/packages/slate-react/test/rendering/fixtures/empty-block.js
@@ -4,12 +4,12 @@ import h from '../../helpers/h'
export const props = {}
-export const state = (
-
+export const value = (
+
-
+
)
export const output = `
diff --git a/packages/slate-react/test/rendering/fixtures/nested-text-direction.js b/packages/slate-react/test/rendering/fixtures/nested-text-direction.js
index d3e363036..3d49eca19 100644
--- a/packages/slate-react/test/rendering/fixtures/nested-text-direction.js
+++ b/packages/slate-react/test/rendering/fixtures/nested-text-direction.js
@@ -4,8 +4,8 @@ import h from '../../helpers/h'
export const props = {}
-export const state = (
-
+export const value = (
+
@@ -16,7 +16,7 @@ export const state = (
-
+
)
export const output = `
diff --git a/packages/slate-react/test/rendering/fixtures/readonly-custom-block-void.js b/packages/slate-react/test/rendering/fixtures/readonly-custom-block-void.js
index 4d7c845a8..aab9478a4 100644
--- a/packages/slate-react/test/rendering/fixtures/readonly-custom-block-void.js
+++ b/packages/slate-react/test/rendering/fixtures/readonly-custom-block-void.js
@@ -18,12 +18,12 @@ export const props = {
renderNode,
}
-export const state = (
-
+export const value = (
+
-
+
)
export const output = `
diff --git a/packages/slate-react/test/rendering/fixtures/readonly-custom-inline-void.js b/packages/slate-react/test/rendering/fixtures/readonly-custom-inline-void.js
index e9b1217f9..f798b1221 100644
--- a/packages/slate-react/test/rendering/fixtures/readonly-custom-inline-void.js
+++ b/packages/slate-react/test/rendering/fixtures/readonly-custom-inline-void.js
@@ -20,14 +20,14 @@ export const props = {
renderNode,
}
-export const state = (
-
+export const value = (
+
-
+
)
export const output = `
diff --git a/packages/slate-react/test/rendering/fixtures/text-direction.js b/packages/slate-react/test/rendering/fixtures/text-direction.js
index a64b56220..1a3e8ae07 100644
--- a/packages/slate-react/test/rendering/fixtures/text-direction.js
+++ b/packages/slate-react/test/rendering/fixtures/text-direction.js
@@ -4,8 +4,8 @@ import h from '../../helpers/h'
export const props = {}
-export const state = (
-
+export const value = (
+
Hello, world!
@@ -17,7 +17,7 @@ export const state = (
שלום עולם
-
+
)
export const output = `
diff --git a/packages/slate-react/test/rendering/index.js b/packages/slate-react/test/rendering/index.js
index 19f475982..a17fbece0 100644
--- a/packages/slate-react/test/rendering/index.js
+++ b/packages/slate-react/test/rendering/index.js
@@ -19,9 +19,9 @@ describe('rendering', () => {
for (const test of tests) {
it(test, async () => {
const module = require(resolve(dir, test))
- const { state, output, props } = module
+ const { value, output, props } = module
const p = {
- state,
+ value,
onChange() {},
...(props || {}),
}
diff --git a/packages/slate-simulator/package.json b/packages/slate-simulator/package.json
index 66dfdb498..13f1e53f4 100644
--- a/packages/slate-simulator/package.json
+++ b/packages/slate-simulator/package.json
@@ -6,7 +6,8 @@
"repository": "git://github.com/ianstormtaylor/slate.git",
"main": "./lib/index.js",
"peerDependencies": {
- "slate": "^0.28.2"
+ "slate": "^0.28.2",
+ "slate-dev-logger": "^0.1.23"
},
"devDependencies": {
"babel-cli": "^6.10.1",
diff --git a/packages/slate-simulator/src/index.js b/packages/slate-simulator/src/index.js
index 5b4d05905..d24101d59 100644
--- a/packages/slate-simulator/src/index.js
+++ b/packages/slate-simulator/src/index.js
@@ -1,3 +1,5 @@
+
+import logger from 'slate-dev-logger'
import { Stack } from 'slate'
/**
@@ -27,17 +29,29 @@ const EVENT_HANDLERS = [
class Simulator {
/**
- * Create a new `Simulator` with `plugins` and an initial `state`.
+ * Create a new `Simulator` with `plugins` and an initial `value`.
*
* @param {Object} attrs
*/
constructor(props) {
- const { plugins, state } = props
+ const { plugins, value } = props
const stack = new Stack({ plugins })
this.props = props
this.stack = stack
- this.state = state
+ this.value = value
+
+ Object.defineProperty(this, 'state', {
+ get() {
+ logger.deprecate('slate-simulator@0.3.0', 'The `simulator.state` property has been renamed to `simulator.value`.')
+ return this.value
+ }
+ })
+
+ if (props.state) {
+ logger.deprecate('slate-simulator@0.3.0', 'The `state` prop has been renamed to `value`.')
+ this.value = props.state
+ }
}
}
@@ -52,15 +66,15 @@ EVENT_HANDLERS.forEach((handler) => {
Simulator.prototype[method] = function (e) {
if (e == null) e = {}
- const { stack, state } = this
+ const { stack, value } = this
const editor = createEditor(this)
const event = createEvent(e)
- const change = state.change()
+ const change = value.change()
stack.run(handler, change, editor, event)
stack.run('onChange', change, editor)
- this.state = change.state
+ this.value = change.value
return this
}
})
@@ -77,16 +91,16 @@ function getMethodName(handler) {
}
/**
- * Create a fake editor from a `stack` and `state`.
+ * Create a fake editor from a `stack` and `value`.
*
* @param {Stack} stack
- * @param {State} state
+ * @param {Value} value
*/
-function createEditor({ stack, state, props }) {
+function createEditor({ stack, value, props }) {
const editor = {
getSchema: () => stack.schema,
- getState: () => state,
+ getState: () => value,
props: {
autoCorrect: true,
autoFocus: false,
diff --git a/packages/slate/src/changes/Readme.md b/packages/slate/src/changes/Readme.md
deleted file mode 100644
index a8b99830e..000000000
--- a/packages/slate/src/changes/Readme.md
+++ /dev/null
@@ -1,2 +0,0 @@
-
-This directory contains all of the core change functions that ship with Slate by default. For example, changes like `insertText` or `addMarkAtRange`.
diff --git a/packages/slate/src/changes/at-current-range.js b/packages/slate/src/changes/at-current-range.js
index 9a110d9d1..ea606ed62 100644
--- a/packages/slate/src/changes/at-current-range.js
+++ b/packages/slate/src/changes/at-current-range.js
@@ -36,8 +36,8 @@ const PROXY_TRANSFORMS = [
PROXY_TRANSFORMS.forEach((method) => {
Changes[method] = (change, ...args) => {
- const { state } = change
- const { selection } = state
+ const { value } = change
+ const { selection } = value
const methodAtRange = `${method}AtRange`
change[methodAtRange](selection, ...args)
}
@@ -52,8 +52,8 @@ PROXY_TRANSFORMS.forEach((method) => {
Changes.addMark = (change, mark) => {
mark = Mark.create(mark)
- const { state } = change
- const { document, selection } = state
+ const { value } = change
+ const { document, selection } = value
if (selection.isExpanded) {
change.addMarkAtRange(selection, mark)
@@ -79,8 +79,8 @@ Changes.addMark = (change, mark) => {
*/
Changes.delete = (change) => {
- const { state } = change
- const { selection } = state
+ const { value } = change
+ const { selection } = value
change.deleteAtRange(selection)
// Ensure that the selection is collapsed to the start, because in certain
@@ -98,12 +98,12 @@ Changes.delete = (change) => {
Changes.insertBlock = (change, block) => {
block = Block.create(block)
- const { state } = change
- const { selection } = state
+ const { value } = change
+ const { selection } = value
change.insertBlockAtRange(selection, block)
// If the node was successfully inserted, update the selection.
- const node = change.state.document.getNode(block.key)
+ const node = change.value.document.getNode(block.key)
if (node) change.collapseToEndOf(node)
}
@@ -117,9 +117,9 @@ Changes.insertBlock = (change, block) => {
Changes.insertFragment = (change, fragment) => {
if (!fragment.nodes.size) return
- let { state } = change
- let { document, selection } = state
- const { startText, endText, startInline } = state
+ let { value } = change
+ let { document, selection } = value
+ const { startText, endText, startInline } = value
const lastText = fragment.getLastText()
const lastInline = fragment.getClosestInline(lastText.key)
const keys = document.getTexts().map(text => text.key)
@@ -130,8 +130,8 @@ Changes.insertFragment = (change, fragment) => {
)
change.insertFragmentAtRange(selection, fragment)
- state = change.state
- document = state.document
+ value = change.value
+ document = value.document
const newTexts = document.getTexts().filter(n => !keys.includes(n.key))
const newText = isAppending ? newTexts.last() : newTexts.takeLast(2).first()
@@ -158,12 +158,12 @@ Changes.insertFragment = (change, fragment) => {
Changes.insertInline = (change, inline) => {
inline = Inline.create(inline)
- const { state } = change
- const { selection } = state
+ const { value } = change
+ const { selection } = value
change.insertInlineAtRange(selection, inline)
// If the node was successfully inserted, update the selection.
- const node = change.state.document.getNode(inline.key)
+ const node = change.value.document.getNode(inline.key)
if (node) change.collapseToEndOf(node)
}
@@ -176,14 +176,14 @@ Changes.insertInline = (change, inline) => {
*/
Changes.insertText = (change, text, marks) => {
- const { state } = change
- const { document, selection } = state
+ const { value } = change
+ const { document, selection } = value
marks = marks || selection.marks
change.insertTextAtRange(selection, text, marks)
// If the text was successfully inserted, and the selection had marks on it,
// unset the selection's marks.
- if (selection.marks && document != change.state.document) {
+ if (selection.marks && document != change.value.document) {
change.select({ marks: null })
}
}
@@ -196,8 +196,8 @@ Changes.insertText = (change, text, marks) => {
*/
Changes.splitBlock = (change, depth = 1) => {
- const { state } = change
- const { selection } = state
+ const { value } = change
+ const { selection } = value
change
.splitBlockAtRange(selection, depth)
.collapseToEnd()
@@ -212,8 +212,8 @@ Changes.splitBlock = (change, depth = 1) => {
Changes.removeMark = (change, mark) => {
mark = Mark.create(mark)
- const { state } = change
- const { document, selection } = state
+ const { value } = change
+ const { document, selection } = value
if (selection.isExpanded) {
change.removeMarkAtRange(selection, mark)
@@ -242,8 +242,8 @@ Changes.removeMark = (change, mark) => {
Changes.toggleMark = (change, mark) => {
mark = Mark.create(mark)
- const { state } = change
- const exists = state.activeMarks.has(mark)
+ const { value } = change
+ const exists = value.activeMarks.has(mark)
if (exists) {
change.removeMark(mark)
@@ -261,8 +261,8 @@ Changes.toggleMark = (change, mark) => {
*/
Changes.wrapText = (change, prefix, suffix = prefix) => {
- const { state } = change
- const { selection } = state
+ const { value } = change
+ const { selection } = value
change.wrapTextAtRange(selection, prefix, suffix)
// If the selection was collapsed, it will have moved the start offset too.
@@ -276,7 +276,7 @@ Changes.wrapText = (change, prefix, suffix = prefix) => {
// There's a chance that the selection points moved "through" each other,
// resulting in a now-incorrect selection direction.
- if (selection.isForward != change.state.selection.isForward) {
+ if (selection.isForward != change.value.selection.isForward) {
change.flip()
}
}
diff --git a/packages/slate/src/changes/at-range.js b/packages/slate/src/changes/at-range.js
index cbfffa758..391561c1c 100644
--- a/packages/slate/src/changes/at-range.js
+++ b/packages/slate/src/changes/at-range.js
@@ -29,8 +29,8 @@ Changes.addMarkAtRange = (change, range, mark, options = {}) => {
if (range.isCollapsed) return
const { normalize = true } = options
- const { state } = change
- const { document } = state
+ const { value } = change
+ const { document } = value
const { startKey, startOffset, endKey, endOffset } = range
const texts = document.getTextsAtRange(range)
@@ -64,9 +64,9 @@ Changes.deleteAtRange = (change, range, options = {}) => {
change.snapshotSelection()
const { normalize = true } = options
- const { state } = change
+ const { value } = change
let { startKey, startOffset, endKey, endOffset } = range
- let { document } = state
+ let { document } = value
let isStartVoid = document.hasVoidParent(startKey)
let isEndVoid = document.hasVoidParent(endKey)
let startBlock = document.getClosestBlock(startKey)
@@ -106,7 +106,7 @@ Changes.deleteAtRange = (change, range, options = {}) => {
if (!nextText) return
// Continue...
- document = change.state.document
+ document = change.value.document
startKey = nextText.key
startOffset = 0
isStartVoid = document.hasVoidParent(startKey)
@@ -121,7 +121,7 @@ Changes.deleteAtRange = (change, range, options = {}) => {
change.removeNodeByKey(endVoid.key, { normalize: false })
// Continue...
- document = change.state.document
+ document = change.value.document
endKey = prevText.key
endOffset = prevText.text.length
isEndVoid = document.hasVoidParent(endKey)
@@ -217,7 +217,7 @@ Changes.deleteAtRange = (change, range, options = {}) => {
// If the start and end blocks aren't the same, move and merge the end block
// into the start block.
if (startBlock.key != endBlock.key) {
- document = change.state.document
+ document = change.value.document
const lonely = document.getFurthestOnlyChildAncestor(endBlock.key)
// Move the end block to be right after the start block.
@@ -256,8 +256,8 @@ Changes.deleteAtRange = (change, range, options = {}) => {
*/
Changes.deleteCharBackwardAtRange = (change, range, options) => {
- const { state } = change
- const { document } = state
+ const { value } = change
+ const { document } = value
const { startKey, startOffset } = range
const startBlock = document.getClosestBlock(startKey)
const offset = startBlock.getOffset(startKey)
@@ -277,8 +277,8 @@ Changes.deleteCharBackwardAtRange = (change, range, options) => {
*/
Changes.deleteLineBackwardAtRange = (change, range, options) => {
- const { state } = change
- const { document } = state
+ const { value } = change
+ const { document } = value
const { startKey, startOffset } = range
const startBlock = document.getClosestBlock(startKey)
const offset = startBlock.getOffset(startKey)
@@ -296,8 +296,8 @@ Changes.deleteLineBackwardAtRange = (change, range, options) => {
*/
Changes.deleteWordBackwardAtRange = (change, range, options) => {
- const { state } = change
- const { document } = state
+ const { value } = change
+ const { document } = value
const { startKey, startOffset } = range
const startBlock = document.getClosestBlock(startKey)
const offset = startBlock.getOffset(startKey)
@@ -319,8 +319,8 @@ Changes.deleteWordBackwardAtRange = (change, range, options) => {
Changes.deleteBackwardAtRange = (change, range, n = 1, options = {}) => {
const { normalize = true } = options
- const { state } = change
- const { document } = state
+ const { value } = change
+ const { document } = value
const { startKey, focusOffset } = range
// If the range is expanded, perform a regular delete instead.
@@ -442,8 +442,8 @@ Changes.deleteBackwardAtRange = (change, range, n = 1, options = {}) => {
*/
Changes.deleteCharForwardAtRange = (change, range, options) => {
- const { state } = change
- const { document } = state
+ const { value } = change
+ const { document } = value
const { startKey, startOffset } = range
const startBlock = document.getClosestBlock(startKey)
const offset = startBlock.getOffset(startKey)
@@ -463,8 +463,8 @@ Changes.deleteCharForwardAtRange = (change, range, options) => {
*/
Changes.deleteLineForwardAtRange = (change, range, options) => {
- const { state } = change
- const { document } = state
+ const { value } = change
+ const { document } = value
const { startKey, startOffset } = range
const startBlock = document.getClosestBlock(startKey)
const offset = startBlock.getOffset(startKey)
@@ -482,8 +482,8 @@ Changes.deleteLineForwardAtRange = (change, range, options) => {
*/
Changes.deleteWordForwardAtRange = (change, range, options) => {
- const { state } = change
- const { document } = state
+ const { value } = change
+ const { document } = value
const { startKey, startOffset } = range
const startBlock = document.getClosestBlock(startKey)
const offset = startBlock.getOffset(startKey)
@@ -505,8 +505,8 @@ Changes.deleteWordForwardAtRange = (change, range, options) => {
Changes.deleteForwardAtRange = (change, range, n = 1, options = {}) => {
const { normalize = true } = options
- const { state } = change
- const { document } = state
+ const { value } = change
+ const { document } = value
const { startKey, focusOffset } = range
// If the range is expanded, perform a regular delete instead.
@@ -636,8 +636,8 @@ Changes.insertBlockAtRange = (change, range, block, options = {}) => {
range = range.collapseToStart()
}
- const { state } = change
- const { document } = state
+ const { value } = change
+ const { document } = value
const { startKey, startOffset } = range
const startBlock = document.getClosestBlock(startKey)
const parent = document.getParent(startBlock.key)
@@ -700,8 +700,8 @@ Changes.insertFragmentAtRange = (change, range, fragment, options = {}) => {
// Calculate a few things...
const { startKey, startOffset } = range
- const { state } = change
- let { document } = state
+ const { value } = change
+ let { document } = value
let startText = document.getDescendant(startKey)
let startBlock = document.getClosestBlock(startText.key)
let startChild = startBlock.getFurthestAncestor(startText.key)
@@ -737,8 +737,8 @@ Changes.insertFragmentAtRange = (change, range, fragment, options = {}) => {
change.splitDescendantsByKey(startChild.key, startKey, startOffset, { normalize: false })
}
- // Update our variables with the new state.
- document = change.state.document
+ // Update our variables with the new value.
+ document = change.value.document
startText = document.getDescendant(startKey)
startBlock = document.getClosestBlock(startKey)
startChild = startBlock.getFurthestAncestor(startText.key)
@@ -802,8 +802,8 @@ Changes.insertInlineAtRange = (change, range, inline, options = {}) => {
range = range.collapseToStart()
}
- const { state } = change
- const { document } = state
+ const { value } = change
+ const { document } = value
const { startKey, startOffset } = range
const parent = document.getParent(startKey)
const startText = document.assertDescendant(startKey)
@@ -832,8 +832,8 @@ Changes.insertInlineAtRange = (change, range, inline, options = {}) => {
Changes.insertTextAtRange = (change, range, text, marks, options = {}) => {
let { normalize } = options
- const { state } = change
- const { document } = state
+ const { value } = change
+ const { document } = value
const { startKey, startOffset } = range
const parent = document.getParent(startKey)
@@ -865,8 +865,8 @@ Changes.removeMarkAtRange = (change, range, mark, options = {}) => {
if (range.isCollapsed) return
const { normalize = true } = options
- const { state } = change
- const { document } = state
+ const { value } = change
+ const { document } = value
const texts = document.getTextsAtRange(range)
const { startKey, startOffset, endKey, endOffset } = range
@@ -895,8 +895,8 @@ Changes.removeMarkAtRange = (change, range, mark, options = {}) => {
Changes.setBlockAtRange = (change, range, properties, options = {}) => {
const { normalize = true } = options
- const { state } = change
- const { document } = state
+ const { value } = change
+ const { document } = value
const blocks = document.getBlocksAtRange(range)
blocks.forEach((block) => {
@@ -916,8 +916,8 @@ Changes.setBlockAtRange = (change, range, properties, options = {}) => {
Changes.setInlineAtRange = (change, range, properties, options = {}) => {
const { normalize = true } = options
- const { state } = change
- const { document } = state
+ const { value } = change
+ const { document } = value
const inlines = document.getInlinesAtRange(range)
inlines.forEach((inline) => {
@@ -944,8 +944,8 @@ Changes.splitBlockAtRange = (change, range, height = 1, options = {}) => {
}
const { startKey, startOffset } = range
- const { state } = change
- const { document } = state
+ const { value } = change
+ const { document } = value
let node = document.assertDescendant(startKey)
let parent = document.getClosestBlock(node.key)
let h = 0
@@ -978,8 +978,8 @@ Changes.splitInlineAtRange = (change, range, height = Infinity, options = {}) =>
}
const { startKey, startOffset } = range
- const { state } = change
- const { document } = state
+ const { value } = change
+ const { document } = value
let node = document.assertDescendant(startKey)
let parent = document.getClosestInline(node.key)
let h = 0
@@ -1010,8 +1010,8 @@ Changes.toggleMarkAtRange = (change, range, mark, options = {}) => {
mark = Mark.create(mark)
const { normalize = true } = options
- const { state } = change
- const { document } = state
+ const { value } = change
+ const { document } = value
const marks = document.getActiveMarksAtRange(range)
const exists = marks.some(m => m.equals(mark))
@@ -1036,8 +1036,8 @@ Changes.unwrapBlockAtRange = (change, range, properties, options = {}) => {
properties = Node.createProperties(properties)
const { normalize = true } = options
- const { state } = change
- let { document } = state
+ const { value } = change
+ let { document } = value
const blocks = document.getBlocksAtRange(range)
const wrappers = blocks
.map((block) => {
@@ -1094,7 +1094,7 @@ Changes.unwrapBlockAtRange = (change, range, properties, options = {}) => {
else {
const firstText = firstMatch.getFirstText()
change.splitDescendantsByKey(block.key, firstText.key, 0, { normalize: false })
- document = change.state.document
+ document = change.value.document
children.forEach((child, i) => {
if (i == 0) {
@@ -1128,8 +1128,8 @@ Changes.unwrapInlineAtRange = (change, range, properties, options = {}) => {
properties = Node.createProperties(properties)
const { normalize = true } = options
- const { state } = change
- const { document } = state
+ const { value } = change
+ const { document } = value
const texts = document.getTextsAtRange(range)
const inlines = texts
.map((text) => {
@@ -1146,7 +1146,7 @@ Changes.unwrapInlineAtRange = (change, range, properties, options = {}) => {
.toList()
inlines.forEach((inline) => {
- const parent = change.state.document.getParent(inline.key)
+ const parent = change.value.document.getParent(inline.key)
const index = parent.nodes.indexOf(inline)
inline.nodes.forEach((child, i) => {
@@ -1175,8 +1175,8 @@ Changes.wrapBlockAtRange = (change, range, block, options = {}) => {
block = block.set('nodes', block.nodes.clear())
const { normalize = true } = options
- const { state } = change
- const { document } = state
+ const { value } = change
+ const { document } = value
const blocks = document.getBlocksAtRange(range)
const firstblock = blocks.first()
@@ -1242,8 +1242,8 @@ Changes.wrapBlockAtRange = (change, range, block, options = {}) => {
*/
Changes.wrapInlineAtRange = (change, range, inline, options = {}) => {
- const { state } = change
- let { document } = state
+ const { value } = change
+ let { document } = value
const { normalize = true } = options
const { startKey, startOffset, endKey, endOffset } = range
@@ -1269,7 +1269,7 @@ Changes.wrapInlineAtRange = (change, range, inline, options = {}) => {
change.splitDescendantsByKey(endChild.key, endKey, endOffset, { normalize: false })
change.splitDescendantsByKey(startChild.key, startKey, startOffset, { normalize: false })
- document = change.state.document
+ document = change.value.document
startBlock = document.getDescendant(startBlock.key)
endBlock = document.getDescendant(endBlock.key)
startChild = startBlock.getFurthestAncestor(startKey)
@@ -1278,7 +1278,7 @@ Changes.wrapInlineAtRange = (change, range, inline, options = {}) => {
const endIndex = endBlock.nodes.indexOf(endChild)
if (startBlock == endBlock) {
- document = change.state.document
+ document = change.value.document
startBlock = document.getClosestBlock(startKey)
startChild = startBlock.getFurthestAncestor(startKey)
diff --git a/packages/slate/src/changes/by-key.js b/packages/slate/src/changes/by-key.js
index e98354c29..5d1b8b1a9 100644
--- a/packages/slate/src/changes/by-key.js
+++ b/packages/slate/src/changes/by-key.js
@@ -27,8 +27,8 @@ const Changes = {}
Changes.addMarkByKey = (change, key, offset, length, mark, options = {}) => {
mark = Mark.create(mark)
const { normalize = true } = options
- const { state } = change
- const { document } = state
+ const { value } = change
+ const { document } = value
const path = document.getPath(key)
const node = document.getNode(key)
const leaves = node.getLeaves()
@@ -107,8 +107,8 @@ Changes.insertFragmentByKey = (change, key, index, fragment, options = {}) => {
Changes.insertNodeByKey = (change, key, index, node, options = {}) => {
const { normalize = true } = options
- const { state } = change
- const { document } = state
+ const { value } = change
+ const { document } = value
const path = document.getPath(key)
change.applyOperation({
@@ -136,8 +136,8 @@ Changes.insertNodeByKey = (change, key, index, node, options = {}) => {
Changes.insertTextByKey = (change, key, offset, text, marks, options = {}) => {
const { normalize = true } = options
- const { state } = change
- const { document } = state
+ const { value } = change
+ const { document } = value
const path = document.getPath(key)
const node = document.getNode(key)
marks = marks || node.getMarksAtIndex(offset)
@@ -167,8 +167,8 @@ Changes.insertTextByKey = (change, key, offset, text, marks, options = {}) => {
Changes.mergeNodeByKey = (change, key, options = {}) => {
const { normalize = true } = options
- const { state } = change
- const { document } = state
+ const { value } = change
+ const { document } = value
const path = document.getPath(key)
const previous = document.getPreviousSibling(key)
@@ -204,8 +204,8 @@ Changes.mergeNodeByKey = (change, key, options = {}) => {
Changes.moveNodeByKey = (change, key, newKey, newIndex, options = {}) => {
const { normalize = true } = options
- const { state } = change
- const { document } = state
+ const { value } = change
+ const { document } = value
const path = document.getPath(key)
const newPath = document.getPath(newKey)
@@ -236,8 +236,8 @@ Changes.moveNodeByKey = (change, key, newKey, newIndex, options = {}) => {
Changes.removeMarkByKey = (change, key, offset, length, mark, options = {}) => {
mark = Mark.create(mark)
const { normalize = true } = options
- const { state } = change
- const { document } = state
+ const { value } = change
+ const { document } = value
const path = document.getPath(key)
const node = document.getNode(key)
const leaves = node.getLeaves()
@@ -291,8 +291,8 @@ Changes.removeMarkByKey = (change, key, offset, length, mark, options = {}) => {
Changes.removeNodeByKey = (change, key, options = {}) => {
const { normalize = true } = options
- const { state } = change
- const { document } = state
+ const { value } = change
+ const { document } = value
const path = document.getPath(key)
const node = document.getNode(key)
@@ -321,8 +321,8 @@ Changes.removeNodeByKey = (change, key, options = {}) => {
Changes.removeTextByKey = (change, key, offset, length, options = {}) => {
const { normalize = true } = options
- const { state } = change
- const { document } = state
+ const { value } = change
+ const { document } = value
const path = document.getPath(key)
const node = document.getNode(key)
const leaves = node.getLeaves()
@@ -378,8 +378,8 @@ Changes.removeTextByKey = (change, key, offset, length, options = {}) => {
Changes.replaceNodeByKey = (change, key, newNode, options = {}) => {
newNode = Node.create(newNode)
const { normalize = true } = options
- const { state } = change
- const { document } = state
+ const { value } = change
+ const { document } = value
const node = document.getNode(key)
const parent = document.getParent(key)
const index = parent.nodes.indexOf(node)
@@ -406,8 +406,8 @@ Changes.setMarkByKey = (change, key, offset, length, mark, properties, options =
mark = Mark.create(mark)
properties = Mark.createProperties(properties)
const { normalize = true } = options
- const { state } = change
- const { document } = state
+ const { value } = change
+ const { document } = value
const path = document.getPath(key)
change.applyOperation({
@@ -438,8 +438,8 @@ Changes.setMarkByKey = (change, key, offset, length, mark, properties, options =
Changes.setNodeByKey = (change, key, properties, options = {}) => {
properties = Node.createProperties(properties)
const { normalize = true } = options
- const { state } = change
- const { document } = state
+ const { value } = change
+ const { document } = value
const path = document.getPath(key)
const node = document.getNode(key)
@@ -467,8 +467,8 @@ Changes.setNodeByKey = (change, key, properties, options = {}) => {
Changes.splitNodeByKey = (change, key, position, options = {}) => {
const { normalize = true, target = null } = options
- const { state } = change
- const { document } = state
+ const { value } = change
+ const { document } = value
const path = document.getPath(key)
change.applyOperation({
@@ -501,8 +501,8 @@ Changes.splitDescendantsByKey = (change, key, textKey, textOffset, options = {})
}
const { normalize = true } = options
- const { state } = change
- const { document } = state
+ const { value } = change
+ const { document } = value
const text = document.getNode(textKey)
const ancestors = document.getAncestors(textKey)
@@ -534,8 +534,8 @@ Changes.splitDescendantsByKey = (change, key, textKey, textOffset, options = {})
*/
Changes.unwrapInlineByKey = (change, key, properties, options) => {
- const { state } = change
- const { document, selection } = state
+ const { value } = change
+ const { document, selection } = value
const node = document.assertDescendant(key)
const first = node.getFirstText()
const last = node.getLastText()
@@ -554,8 +554,8 @@ Changes.unwrapInlineByKey = (change, key, properties, options) => {
*/
Changes.unwrapBlockByKey = (change, key, properties, options) => {
- const { state } = change
- const { document, selection } = state
+ const { value } = change
+ const { document, selection } = value
const node = document.assertDescendant(key)
const first = node.getFirstText()
const last = node.getLastText()
@@ -578,8 +578,8 @@ Changes.unwrapBlockByKey = (change, key, properties, options) => {
Changes.unwrapNodeByKey = (change, key, options = {}) => {
const { normalize = true } = options
- const { state } = change
- const { document } = state
+ const { value } = change
+ const { document } = value
const parent = document.getParent(key)
const node = parent.getChild(key)
@@ -632,7 +632,7 @@ Changes.wrapBlockByKey = (change, key, block, options) => {
block = Block.create(block)
block = block.set('nodes', block.nodes.clear())
- const { document } = change.state
+ const { document } = change.value
const node = document.assertDescendant(key)
const parent = document.getParent(node.key)
const index = parent.nodes.indexOf(node)
@@ -655,7 +655,7 @@ Changes.wrapInlineByKey = (change, key, inline, options) => {
inline = Inline.create(inline)
inline = inline.set('nodes', inline.nodes.clear())
- const { document } = change.state
+ const { document } = change.value
const node = document.assertDescendant(key)
const parent = document.getParent(node.key)
const index = parent.nodes.indexOf(node)
diff --git a/packages/slate/src/changes/index.js b/packages/slate/src/changes/index.js
index 3f3cf8a35..bab841ec1 100644
--- a/packages/slate/src/changes/index.js
+++ b/packages/slate/src/changes/index.js
@@ -4,7 +4,7 @@ import AtRange from './at-range'
import ByKey from './by-key'
import OnHistory from './on-history'
import OnSelection from './on-selection'
-import OnState from './on-state'
+import OnValue from './on-value'
import WithSchema from './with-schema'
/**
@@ -19,6 +19,6 @@ export default {
...ByKey,
...OnHistory,
...OnSelection,
- ...OnState,
+ ...OnValue,
...WithSchema,
}
diff --git a/packages/slate/src/changes/on-history.js b/packages/slate/src/changes/on-history.js
index 9db76f95c..ea195a215 100644
--- a/packages/slate/src/changes/on-history.js
+++ b/packages/slate/src/changes/on-history.js
@@ -10,21 +10,21 @@ import invert from '../operations/invert'
const Changes = {}
/**
- * Redo to the next state in the history.
+ * Redo to the next value in the history.
*
* @param {Change} change
*/
Changes.redo = (change) => {
- let { state } = change
- let { history } = state
+ let { value } = change
+ let { history } = value
if (!history) return
let { undos, redos } = history
const next = redos.peek()
if (!next) return
- // Shift the next state into the undo stack.
+ // Shift the next value into the undo stack.
redos = redos.pop()
undos = undos.push(next)
@@ -34,10 +34,10 @@ Changes.redo = (change) => {
})
// Update the history.
- state = change.state
+ value = change.value
history = history.set('undos', undos).set('redos', redos)
- state = state.set('history', history)
- change.state = state
+ value = value.set('history', history)
+ change.value = value
}
/**
@@ -47,8 +47,8 @@ Changes.redo = (change) => {
*/
Changes.undo = (change) => {
- let { state } = change
- let { history } = state
+ let { value } = change
+ let { history } = value
if (!history) return
let { undos, redos } = history
@@ -65,10 +65,10 @@ Changes.undo = (change) => {
})
// Update the history.
- state = change.state
+ value = change.value
history = history.set('undos', undos).set('redos', redos)
- state = state.set('history', history)
- change.state = state
+ value = value.set('history', history)
+ change.value = value
}
/**
diff --git a/packages/slate/src/changes/on-selection.js b/packages/slate/src/changes/on-selection.js
index d68fb80df..9cf21f98c 100644
--- a/packages/slate/src/changes/on-selection.js
+++ b/packages/slate/src/changes/on-selection.js
@@ -24,8 +24,8 @@ Changes.select = (change, properties, options = {}) => {
properties = Range.createProperties(properties)
const { snapshot = false } = options
- const { state } = change
- const { document, selection } = state
+ const { value } = change
+ const { document, selection } = value
const props = {}
const sel = selection.toJSON()
const next = selection.merge(properties).normalize(document)
@@ -89,8 +89,8 @@ Changes.select = (change, properties, options = {}) => {
*/
Changes.selectAll = (change) => {
- const { state } = change
- const { document, selection } = state
+ const { value } = change
+ const { document, selection } = value
const next = selection.moveToRangeOf(document)
change.select(next)
}
@@ -102,8 +102,8 @@ Changes.selectAll = (change) => {
*/
Changes.snapshotSelection = (change) => {
- const { state } = change
- const { selection } = state
+ const { value } = change
+ const { selection } = value
change.select(selection, { snapshot: true })
}
@@ -114,8 +114,8 @@ Changes.snapshotSelection = (change) => {
*/
Changes.moveAnchorCharBackward = (change) => {
- const { state } = change
- const { document, selection, anchorText, anchorBlock } = state
+ const { value } = change
+ const { document, selection, anchorText, anchorBlock } = value
const { anchorOffset } = selection
const previousText = document.getPreviousText(anchorText.key)
const isInVoid = document.hasVoidParent(anchorText.key)
@@ -144,8 +144,8 @@ Changes.moveAnchorCharBackward = (change) => {
*/
Changes.moveAnchorCharForward = (change) => {
- const { state } = change
- const { document, selection, anchorText, anchorBlock } = state
+ const { value } = change
+ const { document, selection, anchorText, anchorBlock } = value
const { anchorOffset } = selection
const nextText = document.getNextText(anchorText.key)
const isInVoid = document.hasVoidParent(anchorText.key)
@@ -174,8 +174,8 @@ Changes.moveAnchorCharForward = (change) => {
*/
Changes.moveFocusCharBackward = (change) => {
- const { state } = change
- const { document, selection, focusText, focusBlock } = state
+ const { value } = change
+ const { document, selection, focusText, focusBlock } = value
const { focusOffset } = selection
const previousText = document.getPreviousText(focusText.key)
const isInVoid = document.hasVoidParent(focusText.key)
@@ -204,8 +204,8 @@ Changes.moveFocusCharBackward = (change) => {
*/
Changes.moveFocusCharForward = (change) => {
- const { state } = change
- const { document, selection, focusText, focusBlock } = state
+ const { value } = change
+ const { document, selection, focusText, focusBlock } = value
const { focusOffset } = selection
const nextText = document.getNextText(focusText.key)
const isInVoid = document.hasVoidParent(focusText.key)
@@ -245,7 +245,7 @@ MOVE_DIRECTIONS.forEach((direction) => {
}
Changes[`moveStartChar${direction}`] = (change) => {
- if (change.state.isBackward) {
+ if (change.value.isBackward) {
change[focus]()
} else {
change[anchor]()
@@ -253,7 +253,7 @@ MOVE_DIRECTIONS.forEach((direction) => {
}
Changes[`moveEndChar${direction}`] = (change) => {
- if (change.state.isBackward) {
+ if (change.value.isBackward) {
change[anchor]()
} else {
change[focus]()
@@ -336,8 +336,8 @@ const PROXY_TRANSFORMS = [
PROXY_TRANSFORMS.forEach((method) => {
Changes[method] = (change, ...args) => {
const normalize = method != 'deselect'
- const { state } = change
- const { document, selection } = state
+ const { value } = change
+ const { document, selection } = value
let next = selection[method](...args)
if (normalize) next = next.normalize(document)
change.select(next)
@@ -386,8 +386,8 @@ PREFIXES.forEach((prefix) => {
const getNode = kind == 'Text' ? 'getNode' : `getClosest${kind}`
Changes[`${method}${kind}`] = (change) => {
- const { state } = change
- const { document, selection } = state
+ const { value } = change
+ const { document, selection } = value
const node = document[getNode](selection.startKey)
if (!node) return
change[method](node)
@@ -398,8 +398,8 @@ PREFIXES.forEach((prefix) => {
const directionKey = direction == 'Next' ? 'startKey' : 'endKey'
Changes[`${method}${direction}${kind}`] = (change) => {
- const { state } = change
- const { document, selection } = state
+ const { value } = change
+ const { document, selection } = value
const node = document[getNode](selection[directionKey])
if (!node) return
const target = document[getDirectionNode](node.key)
@@ -470,8 +470,8 @@ const DEPRECATED_TRANSFORMS = [
DEPRECATED_TRANSFORMS.forEach(([ old, current, warning ]) => {
Changes[old] = (change, ...args) => {
logger.deprecate('0.17.0', warning)
- const { state } = change
- const { document, selection } = state
+ const { value } = change
+ const { document, selection } = value
const sel = selection[current](...args).normalize(document)
change.select(sel)
}
diff --git a/packages/slate/src/changes/on-state.js b/packages/slate/src/changes/on-state.js
deleted file mode 100644
index 812558c26..000000000
--- a/packages/slate/src/changes/on-state.js
+++ /dev/null
@@ -1,47 +0,0 @@
-
-import logger from 'slate-dev-logger'
-
-import State from '../models/state'
-
-/**
- * Changes.
- *
- * @type {Object}
- */
-
-const Changes = {}
-
-/**
- * Set `properties` on the state.
- *
- * @param {Change} change
- * @param {Object|State} properties
- */
-
-Changes.setState = (change, properties) => {
- properties = State.createProperties(properties)
- const { state } = change
-
- change.applyOperation({
- type: 'set_state',
- properties,
- state,
- })
-}
-
-/**
- * Deprecated.
- */
-
-Changes.setData = (change, data) => {
- logger.deprecate('0.26.0', 'The `change.setData` method is deprecated, use `change.setState` instead.')
- change.setState({ data })
-}
-
-/**
- * Export.
- *
- * @type {Object}
- */
-
-export default Changes
diff --git a/packages/slate/src/changes/on-value.js b/packages/slate/src/changes/on-value.js
new file mode 100644
index 000000000..8f6bc386f
--- /dev/null
+++ b/packages/slate/src/changes/on-value.js
@@ -0,0 +1,52 @@
+
+import logger from 'slate-dev-logger'
+
+import Value from '../models/value'
+
+/**
+ * Changes.
+ *
+ * @type {Object}
+ */
+
+const Changes = {}
+
+/**
+ * Set `properties` on the value.
+ *
+ * @param {Change} change
+ * @param {Object|Value} properties
+ */
+
+Changes.setValue = (change, properties) => {
+ properties = Value.createProperties(properties)
+ const { value } = change
+
+ change.applyOperation({
+ type: 'set_value',
+ properties,
+ value,
+ })
+}
+
+/**
+ * Deprecated.
+ */
+
+Changes.setState = (change, ...args) => {
+ logger.deprecate('0.29.0', 'The `change.setState` method has been renamed to `change.setValue`.')
+ change.setValue(...args)
+}
+
+Changes.setData = (change, data) => {
+ logger.deprecate('0.26.0', 'The `change.setData` method is deprecated, use `change.setValue` instead.')
+ change.setValue({ data })
+}
+
+/**
+ * Export.
+ *
+ * @type {Object}
+ */
+
+export default Changes
diff --git a/packages/slate/src/changes/with-schema.js b/packages/slate/src/changes/with-schema.js
index ed4d31fb0..ecd726c59 100644
--- a/packages/slate/src/changes/with-schema.js
+++ b/packages/slate/src/changes/with-schema.js
@@ -10,7 +10,7 @@ import { Set } from 'immutable'
const Changes = {}
/**
- * Normalize the state with its schema.
+ * Normalize the value with its schema.
*
* @param {Change} change
*/
@@ -20,27 +20,27 @@ Changes.normalize = (change) => {
}
/**
- * Normalize the document with the state's schema.
+ * Normalize the document with the value's schema.
*
* @param {Change} change
*/
Changes.normalizeDocument = (change) => {
- const { state } = change
- const { document } = state
+ const { value } = change
+ const { document } = value
change.normalizeNodeByKey(document.key)
}
/**
- * Normalize a `node` and its children with the state's schema.
+ * Normalize a `node` and its children with the value's schema.
*
* @param {Change} change
* @param {Node|String} key
*/
Changes.normalizeNodeByKey = (change, key) => {
- const { state } = change
- let { document, schema } = state
+ const { value } = change
+ let { document, schema } = value
const node = document.assertNode(key)
normalizeNodeAndChildren(change, node, schema)
@@ -122,8 +122,8 @@ function normalizeNodeAndChildren(change, node, schema) {
*/
function refindNode(change, node) {
- const { state } = change
- const { document } = state
+ const { value } = change
+ const { document } = value
return node.kind == 'document'
? document
: document.getDescendant(node.key)
diff --git a/packages/slate/src/constants/model-types.js b/packages/slate/src/constants/model-types.js
index f2f41a60f..9071923f4 100644
--- a/packages/slate/src/constants/model-types.js
+++ b/packages/slate/src/constants/model-types.js
@@ -17,8 +17,8 @@ const MODEL_TYPES = {
RANGE: '@@__SLATE_RANGE__@@',
SCHEMA: '@@__SLATE_SCHEMA__@@',
STACK: '@@__SLATE_STACK__@@',
- STATE: '@@__SLATE_STATE__@@',
TEXT: '@@__SLATE_TEXT__@@',
+ VALUE: '@@__SLATE_VALUE__@@',
}
/**
diff --git a/packages/slate/src/index.js b/packages/slate/src/index.js
index ecac2bb69..271877139 100644
--- a/packages/slate/src/index.js
+++ b/packages/slate/src/index.js
@@ -16,6 +16,7 @@ import Selection from './models/selection'
import Stack from './models/stack'
import State from './models/state'
import Text from './models/text'
+import Value from './models/value'
import { resetKeyGenerator, setKeyGenerator } from './utils/generate-key'
/**
@@ -42,6 +43,7 @@ export {
Stack,
State,
Text,
+ Value,
resetKeyGenerator,
setKeyGenerator,
}
@@ -64,6 +66,7 @@ export default {
Stack,
State,
Text,
+ Value,
resetKeyGenerator,
setKeyGenerator,
}
diff --git a/packages/slate/src/models/Readme.md b/packages/slate/src/models/Readme.md
deleted file mode 100644
index 9f7196a81..000000000
--- a/packages/slate/src/models/Readme.md
+++ /dev/null
@@ -1,73 +0,0 @@
-
-This directory contains all of the immutable models that contain the data that powers Slate. They are built using [Immutable.js](https://facebook.github.io/immutable-js/). Here's what each of them does:
-
-- [Block](#block)
-- [Change](#change)
-- [Character](#character)
-- [Data](#data)
-- [Document](#document)
-- [Inline](#inline)
-- [Mark](#mark)
-- [Node](#node)
-- [Range](#range)
-- [State](#state)
-- [Text](#text)
-
-
-#### Block
-
-Just like in the DOM, `Block` nodes are one that contain other inline content. They can be split apart, and wrapped in other blocks, but they will always contain at least a single [`Text`](#text) node of inline content. They can also contain associated [`Data`](#data)
-
-
-#### Change
-
-`Change` is not publicly exposed; you access it by calling the `.change()` method on a [`State`](#state) model. It's simply a wrapper around the somewhat-complex change tracking logic that allows for a state's history to be populated correctly.
-
-
-#### Character
-
-The content of each [`Text`](#text) node is modeled as a `Character` list. Each character contains a single character string, and any associated [`Marks`](#mark) that are applied to it.
-
-
-#### Data
-
-`Data` is just a thin wrapper around [`Immutable.Map`](https://facebook.github.io/immutable-js/docs/#/Map), which allows for more easily creating maps without having to require [`Immutable`](https://facebook.github.io/immutable-js/) itself.
-
-
-#### Document
-
-The `Document` is where all of the content in the editor is stored. It is a recursively nested tree of [`Nodes`](#node), just like the DOM itself. Which can either be [`Block`](#block), [`Inline`](#inline), or [`Text`](#text) nodes.
-
-
-#### Inline
-
-Similar to [`Block`](#block) nodes, but containing inline content instead of block-level content. They too can be nested to any depth, but at the lowest level will always contain a single [`Text`](#text) node.
-
-
-#### Mark
-
-Marks are the pieces of "formatting" that can be applied to strings of text in the editor. Unlike [`Nodes`](#nodes), `Marks` are modeled as a flat set, such that each character can have multiple marks associated with it. This allows for cases where a link (ie. an inline node) can also have bold (ie. a mark) formatting attached to part of it.
-
-
-#### Node
-
-`Node` isn't actually a model that is exposed, but instead it's an interface full of convenience methods that [`Document`](#document), [`Block`](#block), [`Inline`](#inline) all implement.
-
-
-#### Range
-
-The `Range` represents a fragment of a [`Document`](#document). It's modeled after a combination of the [DOM Selection API](https://developer.mozilla.org/en-US/docs/Web/API/Selection) and the [DOM Range API](https://developer.mozilla.org/en-US/docs/Web/API/Range), using terms like "anchor", "focus" and "collapsed".
-
-
-#### State
-
-The `State` is the highest-level model. It is really just a convenient wrapper around a few other models: [`Document`](#document), [`Range`](#range), and a `History` which is not publicly exposed.
-
-Since `State` has knowledge of both the [`Document`](#document) and a selection [`Range`](#range), it provides a handful of convenience methods for updating the both at the same time. For example, when inserting a new content fragment, it inserts the fragment and then moves the range to the end of the newly inserted content.
-
-The `State` is the object that lets you apply "changes" that change the current document or range. By having them all be applied through the top-level state, it can keep track of changes in the `History`, allowing for undoing and redoing changes.
-
-
-#### Text
-
-`Text` is the lowest-level [`Node`](#node) in the tree. Each `Text` node contains a list of [`Characters`](#characters), which can optionally be dynamically decorated.
diff --git a/packages/slate/src/models/block.js b/packages/slate/src/models/block.js
index d2f2fbe68..88ffa5087 100644
--- a/packages/slate/src/models/block.js
+++ b/packages/slate/src/models/block.js
@@ -39,42 +39,42 @@ const DEFAULTS = {
class Block extends Record(DEFAULTS) {
/**
- * Create a new `Block` from `value`.
+ * Create a new `Block` from `attrs`.
*
- * @param {Object|String|Block} value
+ * @param {Object|String|Block} attrs
* @return {Block}
*/
- static create(value = {}) {
- if (Block.isBlock(value)) {
- return value
+ static create(attrs = {}) {
+ if (Block.isBlock(attrs)) {
+ return attrs
}
- if (typeof value == 'string') {
- value = { type: value }
+ if (typeof attrs == 'string') {
+ attrs = { type: attrs }
}
- if (isPlainObject(value)) {
- return Block.fromJSON(value)
+ if (isPlainObject(attrs)) {
+ return Block.fromJSON(attrs)
}
- throw new Error(`\`Block.create\` only accepts objects, strings or blocks, but you passed it: ${value}`)
+ throw new Error(`\`Block.create\` only accepts objects, strings or blocks, but you passed it: ${attrs}`)
}
/**
- * Create a list of `Blocks` from `value`.
+ * Create a list of `Blocks` from `attrs`.
*
- * @param {Array|List} value
+ * @param {Array|List} attrs
* @return {List}
*/
- static createList(value = []) {
- if (List.isList(value) || Array.isArray(value)) {
- const list = new List(value.map(Block.create))
+ static createList(attrs = []) {
+ if (List.isList(attrs) || Array.isArray(attrs)) {
+ const list = new List(attrs.map(Block.create))
return list
}
- throw new Error(`\`Block.createList\` only accepts arrays or lists, but you passed it: ${value}`)
+ throw new Error(`\`Block.createList\` only accepts arrays or lists, but you passed it: ${attrs}`)
}
/**
@@ -119,25 +119,25 @@ class Block extends Record(DEFAULTS) {
static fromJS = Block.fromJSON
/**
- * Check if a `value` is a `Block`.
+ * Check if `any` is a `Block`.
*
- * @param {Any} value
+ * @param {Any} any
* @return {Boolean}
*/
- static isBlock(value) {
- return !!(value && value[MODEL_TYPES.BLOCK])
+ static isBlock(any) {
+ return !!(any && any[MODEL_TYPES.BLOCK])
}
/**
- * Check if a `value` is a block list.
+ * Check if `any` is a block list.
*
- * @param {Any} value
+ * @param {Any} any
* @return {Boolean}
*/
- static isBlockList(value) {
- return List.isList(value) && value.every(item => Block.isBlock(item))
+ static isBlockList(any) {
+ return List.isList(any) && any.every(item => Block.isBlock(item))
}
/**
diff --git a/packages/slate/src/models/change.js b/packages/slate/src/models/change.js
index b77bcdf20..2eccd1781 100644
--- a/packages/slate/src/models/change.js
+++ b/packages/slate/src/models/change.js
@@ -24,26 +24,26 @@ const debug = Debug('slate:change')
class Change {
/**
- * Check if a `value` is a `Change`.
+ * Check if `any` is a `Change`.
*
- * @param {Any} value
+ * @param {Any} any
* @return {Boolean}
*/
- static isChange(value) {
- return !!(value && value[MODEL_TYPES.CHANGE])
+ static isChange(any) {
+ return !!(any && any[MODEL_TYPES.CHANGE])
}
/**
* Create a new `Change` with `attrs`.
*
* @param {Object} attrs
- * @property {State} state
+ * @property {Value} value
*/
constructor(attrs) {
- const { state } = attrs
- this.state = state
+ const { value } = attrs
+ this.value = value
this.operations = []
this.flags = pick(attrs, ['merge', 'save'])
}
@@ -59,7 +59,7 @@ class Change {
}
/**
- * Apply an `operation` to the current state, saving the operation to the
+ * Apply an `operation` to the current value, saving the operation to the
* history if needed.
*
* @param {Object} operation
@@ -69,8 +69,8 @@ class Change {
applyOperation(operation, options = {}) {
const { operations, flags } = this
- let { state } = this
- let { history } = state
+ let { value } = this
+ let { history } = value
// Default options to the change-level flags, this allows for setting
// specific options for all of the operations of a given change.
@@ -83,24 +83,24 @@ class Change {
skip = null,
} = options
- // Apply the operation to the state.
+ // Apply the operation to the value.
debug('apply', { operation, save, merge })
- state = apply(state, operation)
+ value = apply(value, operation)
// If needed, save the operation to the history.
if (history && save) {
history = history.save(operation, { merge, skip })
- state = state.set('history', history)
+ value = value.set('history', history)
}
// Update the mutable change object.
- this.state = state
+ this.value = value
this.operations.push(operation)
return this
}
/**
- * Apply a series of `operations` to the current state.
+ * Apply a series of `operations` to the current value.
*
* @param {Array} operations
* @param {Object} options
@@ -152,13 +152,16 @@ class Change {
/**
* Deprecated.
- *
- * @return {State}
*/
+ get state() {
+ logger.deprecate('0.29.0', 'The `change.state` property has been renamed to `change.value`.')
+ return this.value
+ }
+
apply(options = {}) {
- logger.deprecate('0.22.0', 'The `change.apply()` method is deprecrated and no longer necessary, as all operations are applied immediately when invoked. You can access the change\'s state, which is already pre-computed, directly via `change.state` instead.')
- return this.state
+ logger.deprecate('0.22.0', 'The `change.apply()` method is deprecrated and no longer necessary, as all operations are applied immediately when invoked. You can access the change\'s value, which is already pre-computed, directly via `change.value` instead.')
+ return this.value
}
}
@@ -182,7 +185,7 @@ Object.keys(Changes).forEach((type) => {
})
/**
- * Add deprecation warnings in case people try to access a change as a state.
+ * Add deprecation warnings in case people try to access a change as a value.
*/
;[
@@ -224,14 +227,14 @@ Object.keys(Changes).forEach((type) => {
].forEach((getter) => {
Object.defineProperty(Change.prototype, getter, {
get() {
- logger.deprecate('0.22.0', `You attempted to access the \`${getter}\` property of what was previously a \`state\` object but is now a \`change\` object. This syntax has been deprecated as plugins are now passed \`change\` objects instead of \`state\` objects.`)
- return this.state[getter]
+ logger.deprecate('0.22.0', `You attempted to access the \`${getter}\` property of what was previously a \`value\` object but is now a \`change\` object. This syntax has been deprecated as plugins are now passed \`change\` objects instead of \`value\` objects.`)
+ return this.value[getter]
}
})
})
Change.prototype.transform = function () {
- logger.deprecate('0.22.0', 'You attempted to call `.transform()` on what was previously a `state` object but is now already a `change` object. This syntax has been deprecated as plugins are now passed `change` objects instead of `state` objects.')
+ logger.deprecate('0.22.0', 'You attempted to call `.transform()` on what was previously a `value` object but is now already a `change` object. This syntax has been deprecated as plugins are now passed `change` objects instead of `value` objects.')
return this
}
diff --git a/packages/slate/src/models/character.js b/packages/slate/src/models/character.js
index 4842fc1d0..c0b7d951e 100644
--- a/packages/slate/src/models/character.js
+++ b/packages/slate/src/models/character.js
@@ -99,25 +99,25 @@ class Character extends Record(DEFAULTS) {
static fromJS = Character.fromJSON
/**
- * Check if a `value` is a `Character`.
+ * Check if `any` is a `Character`.
*
- * @param {Any} value
+ * @param {Any} any
* @return {Boolean}
*/
- static isCharacter(value) {
- return !!(value && value[MODEL_TYPES.CHARACTER])
+ static isCharacter(any) {
+ return !!(any && any[MODEL_TYPES.CHARACTER])
}
/**
- * Check if a `value` is a character list.
+ * Check if `any` is a character list.
*
- * @param {Any} value
+ * @param {Any} any
* @return {Boolean}
*/
- static isCharacterList(value) {
- return List.isList(value) && value.every(item => Character.isCharacter(item))
+ static isCharacterList(any) {
+ return List.isList(any) && any.every(item => Character.isCharacter(item))
}
/**
diff --git a/packages/slate/src/models/document.js b/packages/slate/src/models/document.js
index fff17bb60..575d7da8e 100644
--- a/packages/slate/src/models/document.js
+++ b/packages/slate/src/models/document.js
@@ -94,14 +94,14 @@ class Document extends Record(DEFAULTS) {
static fromJS = Document.fromJSON
/**
- * Check if a `value` is a `Document`.
+ * Check if `any` is a `Document`.
*
- * @param {Any} value
+ * @param {Any} any
* @return {Boolean}
*/
- static isDocument(value) {
- return !!(value && value[MODEL_TYPES.DOCUMENT])
+ static isDocument(any) {
+ return !!(any && any[MODEL_TYPES.DOCUMENT])
}
/**
diff --git a/packages/slate/src/models/history.js b/packages/slate/src/models/history.js
index 6a6f26faa..4f47db760 100644
--- a/packages/slate/src/models/history.js
+++ b/packages/slate/src/models/history.js
@@ -80,14 +80,14 @@ class History extends Record(DEFAULTS) {
static fromJS = History.fromJSON
/**
- * Check if a `value` is a `History`.
+ * Check if `any` is a `History`.
*
- * @param {Any} value
+ * @param {Any} any
* @return {Boolean}
*/
- static isHistory(value) {
- return !!(value && value[MODEL_TYPES.HISTORY])
+ static isHistory(any) {
+ return !!(any && any[MODEL_TYPES.HISTORY])
}
/**
diff --git a/packages/slate/src/models/inline.js b/packages/slate/src/models/inline.js
index a1193af6f..17357342d 100644
--- a/packages/slate/src/models/inline.js
+++ b/packages/slate/src/models/inline.js
@@ -119,25 +119,25 @@ class Inline extends Record(DEFAULTS) {
static fromJS = Inline.fromJSON
/**
- * Check if a `value` is a `Inline`.
+ * Check if `any` is a `Inline`.
*
- * @param {Any} value
+ * @param {Any} any
* @return {Boolean}
*/
- static isInline(value) {
- return !!(value && value[MODEL_TYPES.INLINE])
+ static isInline(any) {
+ return !!(any && any[MODEL_TYPES.INLINE])
}
/**
- * Check if a `value` is a list of inlines.
+ * Check if `any` is a list of inlines.
*
- * @param {Any} value
+ * @param {Any} any
* @return {Boolean}
*/
- static isInlineList(value) {
- return List.isList(value) && value.every(item => Inline.isInline(item))
+ static isInlineList(any) {
+ return List.isList(any) && any.every(item => Inline.isInline(item))
}
/**
diff --git a/packages/slate/src/models/leaf.js b/packages/slate/src/models/leaf.js
index c9db37e16..f81ed85b1 100644
--- a/packages/slate/src/models/leaf.js
+++ b/packages/slate/src/models/leaf.js
@@ -49,19 +49,19 @@ class Leaf extends Record(DEFAULTS) {
}
/**
- * Create a `Leaf` list from `value`.
+ * Create a `Leaf` list from `attrs`.
*
- * @param {Array|List} value
+ * @param {Array|List} attrs
* @return {List}
*/
- static createList(value = []) {
- if (List.isList(value) || Array.isArray(value)) {
- const list = new List(value.map(Leaf.create))
+ static createList(attrs = []) {
+ if (List.isList(attrs) || Array.isArray(attrs)) {
+ const list = new List(attrs.map(Leaf.create))
return list
}
- throw new Error(`\`Leaf.createList\` only accepts arrays or lists, but you passed it: ${value}`)
+ throw new Error(`\`Leaf.createList\` only accepts arrays or lists, but you passed it: ${attrs}`)
}
/**
@@ -92,25 +92,25 @@ class Leaf extends Record(DEFAULTS) {
static fromJS = Leaf.fromJSON
/**
- * Check if a `value` is a `Leaf`.
+ * Check if `any` is a `Leaf`.
*
- * @param {Any} value
+ * @param {Any} any
* @return {Boolean}
*/
- static isLeaf(value) {
- return !!(value && value[MODEL_TYPES.LEAF])
+ static isLeaf(any) {
+ return !!(any && any[MODEL_TYPES.LEAF])
}
/**
- * Check if a `value` is a list of leaves.
+ * Check if `any` is a list of leaves.
*
- * @param {Any} value
+ * @param {Any} any
* @return {Boolean}
*/
- static isLeafList(value) {
- return List.isList(value) && value.every(item => Leaf.isLeaf(item))
+ static isLeafList(any) {
+ return List.isList(any) && any.every(item => Leaf.isLeaf(item))
}
/**
diff --git a/packages/slate/src/models/mark.js b/packages/slate/src/models/mark.js
index 04ba39270..fd0c949ba 100644
--- a/packages/slate/src/models/mark.js
+++ b/packages/slate/src/models/mark.js
@@ -129,25 +129,25 @@ class Mark extends Record(DEFAULTS) {
static fromJS = Mark.fromJSON
/**
- * Check if a `value` is a `Mark`.
+ * Check if `any` is a `Mark`.
*
- * @param {Any} value
+ * @param {Any} any
* @return {Boolean}
*/
- static isMark(value) {
- return !!(value && value[MODEL_TYPES.MARK])
+ static isMark(any) {
+ return !!(any && any[MODEL_TYPES.MARK])
}
/**
- * Check if a `value` is a set of marks.
+ * Check if `any` is a set of marks.
*
- * @param {Any} value
+ * @param {Any} any
* @return {Boolean}
*/
- static isMarkSet(value) {
- return Set.isSet(value) && value.every(item => Mark.isMark(item))
+ static isMarkSet(any) {
+ return Set.isSet(any) && any.every(item => Mark.isMark(item))
}
/**
diff --git a/packages/slate/src/models/node.js b/packages/slate/src/models/node.js
index 0b1b225cd..9a1c20d2e 100644
--- a/packages/slate/src/models/node.js
+++ b/packages/slate/src/models/node.js
@@ -127,30 +127,30 @@ class Node {
static fromJS = Node.fromJSON
/**
- * Check if a `value` is a `Node`.
+ * Check if `any` is a `Node`.
*
- * @param {Any} value
+ * @param {Any} any
* @return {Boolean}
*/
- static isNode(value) {
+ static isNode(any) {
return (
- Block.isBlock(value) ||
- Document.isDocument(value) ||
- Inline.isInline(value) ||
- Text.isText(value)
+ Block.isBlock(any) ||
+ Document.isDocument(any) ||
+ Inline.isInline(any) ||
+ Text.isText(any)
)
}
/**
- * Check if a `value` is a list of nodes.
+ * Check if `any` is a list of nodes.
*
- * @param {Any} value
+ * @param {Any} any
* @return {Boolean}
*/
- static isNodeList(value) {
- return List.isList(value) && value.every(item => Node.isNode(item))
+ static isNodeList(any) {
+ return List.isList(any) && any.every(item => Node.isNode(item))
}
/**
@@ -2051,22 +2051,22 @@ class Node {
}
/**
- * Normalize a key argument `value`.
+ * Normalize a key `arg`.
*
- * @param {String|Node} value
+ * @param {String|Node} arg
* @return {String}
*/
-function normalizeKey(value) {
- if (typeof value == 'string') return value
+function normalizeKey(arg) {
+ if (typeof arg == 'string') return arg
- logger.deprecate('0.14.0', 'An object was passed to a Node method instead of a `key` string. This was previously supported, but is being deprecated because it can have a negative impact on performance. The object in question was:', value)
+ logger.deprecate('0.14.0', 'An object was passed to a Node method instead of a `key` string. This was previously supported, but is being deprecated because it can have a negative impact on performance. The object in question was:', arg)
- if (Node.isNode(value)) {
- return value.key
+ if (Node.isNode(arg)) {
+ return arg.key
}
- throw new Error(`Invalid \`key\` argument! It must be either a block, an inline, a text, or a string. You passed: ${value}`)
+ throw new Error(`Invalid \`key\` argument! It must be either a block, an inline, a text, or a string. You passed: ${arg}`)
}
/**
diff --git a/packages/slate/src/models/range.js b/packages/slate/src/models/range.js
index 24d9a9138..c2c7aa644 100644
--- a/packages/slate/src/models/range.js
+++ b/packages/slate/src/models/range.js
@@ -50,19 +50,19 @@ class Range extends Record(DEFAULTS) {
}
/**
- * Create a list of `Ranges` from a `value`.
+ * Create a list of `Ranges` from `elements`.
*
- * @param {Array|List} value
+ * @param {Array|List} elements
* @return {List}
*/
- static createList(value = []) {
- if (List.isList(value) || Array.isArray(value)) {
- const list = new List(value.map(Range.create))
+ static createList(elements = []) {
+ if (List.isList(elements) || Array.isArray(elements)) {
+ const list = new List(elements.map(Range.create))
return list
}
- throw new Error(`\`Range.createList\` only accepts arrays or lists, but you passed it: ${value}`)
+ throw new Error(`\`Range.createList\` only accepts arrays or lists, but you passed it: ${elements}`)
}
/**
@@ -138,14 +138,14 @@ class Range extends Record(DEFAULTS) {
static fromJS = Range.fromJSON
/**
- * Check if a `value` is a `Range`.
+ * Check if an `obj` is a `Range`.
*
- * @param {Any} value
+ * @param {Any} obj
* @return {Boolean}
*/
- static isRange(value) {
- return !!(value && value[MODEL_TYPES.RANGE])
+ static isRange(obj) {
+ return !!(obj && obj[MODEL_TYPES.RANGE])
}
/**
diff --git a/packages/slate/src/models/schema.js b/packages/slate/src/models/schema.js
index f4448e66c..9bcaf2ace 100644
--- a/packages/slate/src/models/schema.js
+++ b/packages/slate/src/models/schema.js
@@ -113,14 +113,14 @@ class Schema extends Record(DEFAULTS) {
static fromJS = Schema.fromJSON
/**
- * Check if a `value` is a `Schema`.
+ * Check if `any` is a `Schema`.
*
- * @param {Any} value
+ * @param {Any} any
* @return {Boolean}
*/
- static isSchema(value) {
- return !!(value && value[MODEL_TYPES.SCHEMA])
+ static isSchema(any) {
+ return !!(any && any[MODEL_TYPES.SCHEMA])
}
/**
@@ -193,7 +193,7 @@ class Schema extends Record(DEFAULTS) {
}
/**
- * Normalize an invalid state with `reason` and `context`.
+ * Normalize an invalid value with `reason` and `context`.
*
* @param {Change} change
* @param {String} reason
diff --git a/packages/slate/src/models/stack.js b/packages/slate/src/models/stack.js
index 6291e7f30..06fa5a4d0 100644
--- a/packages/slate/src/models/stack.js
+++ b/packages/slate/src/models/stack.js
@@ -35,14 +35,14 @@ class Stack extends Record(DEFAULTS) {
}
/**
- * Check if a `value` is a `Stack`.
+ * Check if `any` is a `Stack`.
*
- * @param {Any} value
+ * @param {Any} any
* @return {Boolean}
*/
- static isStack(value) {
- return !!(value && value[MODEL_TYPES.STACK])
+ static isStack(any) {
+ return !!(any && any[MODEL_TYPES.STACK])
}
/**
@@ -95,8 +95,8 @@ class Stack extends Record(DEFAULTS) {
const array = []
for (const plugin of plugins) {
- const value = plugin[property](...args)
- if (value != null) array.push(value)
+ const ret = plugin[property](...args)
+ if (ret != null) array.push(ret)
}
return array
@@ -131,9 +131,9 @@ class Stack extends Record(DEFAULTS) {
let { children = null } = props
for (const plugin of plugins) {
- const value = plugin[property](props, ...args)
- if (value == null) continue
- props.children = children = value
+ const ret = plugin[property](props, ...args)
+ if (ret == null) continue
+ props.children = children = ret
}
return children
diff --git a/packages/slate/src/models/state.js b/packages/slate/src/models/state.js
index c52e5fbe9..cb4b2aef3 100644
--- a/packages/slate/src/models/state.js
+++ b/packages/slate/src/models/state.js
@@ -1,703 +1,50 @@
-import isPlainObject from 'is-plain-object'
import logger from 'slate-dev-logger'
-import { Record, Set, List, Map } from 'immutable'
-import MODEL_TYPES from '../constants/model-types'
-import Data from './data'
-import Document from './document'
-import History from './history'
-import Range from './range'
-import Schema from './schema'
+import Value from './value'
/**
- * Default properties.
+ * Deprecated.
+ */
+
+const State = {
+
+ create(...args) {
+ logger.deprecate('0.29.0', 'The `State` model has been renamed to `Value`.')
+ return Value.create(...args)
+ },
+
+ createList(...args) {
+ logger.deprecate('0.29.0', 'The `State` model has been renamed to `Value`.')
+ return Value.createList(...args)
+ },
+
+ createProperties(...args) {
+ logger.deprecate('0.29.0', 'The `State` model has been renamed to `Value`.')
+ return Value.createProperties(...args)
+ },
+
+ fromJSON(...args) {
+ logger.deprecate('0.29.0', 'The `State` model has been renamed to `Value`.')
+ return Value.fromJSON(...args)
+ },
+
+ fromJS(...args) {
+ logger.deprecate('0.29.0', 'The `State` model has been renamed to `Value`.')
+ return Value.fromJS(...args)
+ },
+
+ isState(...args) {
+ logger.deprecate('0.29.0', 'The `State` model has been renamed to `Value`.')
+ return Value.isValue(...args)
+ },
+
+}
+
+/**
+ * Export.
*
* @type {Object}
*/
-const DEFAULTS = {
- data: new Map(),
- decorations: null,
- document: Document.create(),
- history: History.create(),
- schema: Schema.create(),
- selection: Range.create(),
-}
-
-/**
- * State.
- *
- * @type {State}
- */
-
-class State extends Record(DEFAULTS) {
-
- /**
- * Create a new `State` with `attrs`.
- *
- * @param {Object|State} attrs
- * @param {Object} options
- * @return {State}
- */
-
- static create(attrs = {}, options = {}) {
- if (State.isState(attrs)) {
- return attrs
- }
-
- if (isPlainObject(attrs)) {
- return State.fromJSON(attrs)
- }
-
- throw new Error(`\`State.create\` only accepts objects or states, but you passed it: ${attrs}`)
- }
-
- /**
- * Create a dictionary of settable state properties from `attrs`.
- *
- * @param {Object|State} attrs
- * @return {Object}
- */
-
- static createProperties(attrs = {}) {
- if (State.isState(attrs)) {
- return {
- data: attrs.data,
- decorations: attrs.decorations,
- schema: attrs.schema,
- }
- }
-
- if (isPlainObject(attrs)) {
- const props = {}
- if ('data' in attrs) props.data = Data.create(attrs.data)
- if ('decorations' in attrs) props.decorations = Range.createList(attrs.decorations)
- if ('schema' in attrs) props.schema = Schema.create(attrs.schema)
- return props
- }
-
- throw new Error(`\`State.createProperties\` only accepts objects or states, but you passed it: ${attrs}`)
- }
-
- /**
- * Create a `State` from a JSON `object`.
- *
- * @param {Object} object
- * @param {Object} options
- * @property {Boolean} normalize
- * @property {Array} plugins
- * @return {State}
- */
-
- static fromJSON(object, options = {}) {
- let {
- document = {},
- selection = {},
- schema = {},
- } = object
-
- let data = new Map()
-
- document = Document.fromJSON(document)
- selection = Range.fromJSON(selection)
- schema = Schema.fromJSON(schema)
-
- // Allow plugins to set a default value for `data`.
- if (options.plugins) {
- for (const plugin of options.plugins) {
- if (plugin.data) data = data.merge(plugin.data)
- }
- }
-
- // Then merge in the `data` provided.
- if ('data' in object) {
- data = data.merge(object.data)
- }
-
- if (selection.isUnset) {
- const text = document.getFirstText()
- if (text) selection = selection.collapseToStartOf(text)
- }
-
- let state = new State({
- data,
- document,
- selection,
- schema,
- })
-
- if (options.normalize !== false) {
- state = state.change({ save: false }).normalize().state
- }
-
- return state
- }
-
- /**
- * Alias `fromJS`.
- */
-
- static fromJS = State.fromJSON
-
- /**
- * Check if a `value` is a `State`.
- *
- * @param {Any} value
- * @return {Boolean}
- */
-
- static isState(value) {
- return !!(value && value[MODEL_TYPES.STATE])
- }
-
- /**
- * Get the kind.
- *
- * @return {String}
- */
-
- get kind() {
- return 'state'
- }
-
- /**
- * Are there undoable events?
- *
- * @return {Boolean}
- */
-
- get hasUndos() {
- return this.history.undos.size > 0
- }
-
- /**
- * Are there redoable events?
- *
- * @return {Boolean}
- */
-
- get hasRedos() {
- return this.history.redos.size > 0
- }
-
- /**
- * Is the current selection blurred?
- *
- * @return {Boolean}
- */
-
- get isBlurred() {
- return this.selection.isBlurred
- }
-
- /**
- * Is the current selection focused?
- *
- * @return {Boolean}
- */
-
- get isFocused() {
- return this.selection.isFocused
- }
-
- /**
- * Is the current selection collapsed?
- *
- * @return {Boolean}
- */
-
- get isCollapsed() {
- return this.selection.isCollapsed
- }
-
- /**
- * Is the current selection expanded?
- *
- * @return {Boolean}
- */
-
- get isExpanded() {
- return this.selection.isExpanded
- }
-
- /**
- * Is the current selection backward?
- *
- * @return {Boolean} isBackward
- */
-
- get isBackward() {
- return this.selection.isBackward
- }
-
- /**
- * Is the current selection forward?
- *
- * @return {Boolean}
- */
-
- get isForward() {
- return this.selection.isForward
- }
-
- /**
- * Get the current start key.
- *
- * @return {String}
- */
-
- get startKey() {
- return this.selection.startKey
- }
-
- /**
- * Get the current end key.
- *
- * @return {String}
- */
-
- get endKey() {
- return this.selection.endKey
- }
-
- /**
- * Get the current start offset.
- *
- * @return {String}
- */
-
- get startOffset() {
- return this.selection.startOffset
- }
-
- /**
- * Get the current end offset.
- *
- * @return {String}
- */
-
- get endOffset() {
- return this.selection.endOffset
- }
-
- /**
- * Get the current anchor key.
- *
- * @return {String}
- */
-
- get anchorKey() {
- return this.selection.anchorKey
- }
-
- /**
- * Get the current focus key.
- *
- * @return {String}
- */
-
- get focusKey() {
- return this.selection.focusKey
- }
-
- /**
- * Get the current anchor offset.
- *
- * @return {String}
- */
-
- get anchorOffset() {
- return this.selection.anchorOffset
- }
-
- /**
- * Get the current focus offset.
- *
- * @return {String}
- */
-
- get focusOffset() {
- return this.selection.focusOffset
- }
-
- /**
- * Get the current start text node's closest block parent.
- *
- * @return {Block}
- */
-
- get startBlock() {
- return this.startKey && this.document.getClosestBlock(this.startKey)
- }
-
- /**
- * Get the current end text node's closest block parent.
- *
- * @return {Block}
- */
-
- get endBlock() {
- return this.endKey && this.document.getClosestBlock(this.endKey)
- }
-
- /**
- * Get the current anchor text node's closest block parent.
- *
- * @return {Block}
- */
-
- get anchorBlock() {
- return this.anchorKey && this.document.getClosestBlock(this.anchorKey)
- }
-
- /**
- * Get the current focus text node's closest block parent.
- *
- * @return {Block}
- */
-
- get focusBlock() {
- return this.focusKey && this.document.getClosestBlock(this.focusKey)
- }
-
- /**
- * Get the current start text node's closest inline parent.
- *
- * @return {Inline}
- */
-
- get startInline() {
- return this.startKey && this.document.getClosestInline(this.startKey)
- }
-
- /**
- * Get the current end text node's closest inline parent.
- *
- * @return {Inline}
- */
-
- get endInline() {
- return this.endKey && this.document.getClosestInline(this.endKey)
- }
-
- /**
- * Get the current anchor text node's closest inline parent.
- *
- * @return {Inline}
- */
-
- get anchorInline() {
- return this.anchorKey && this.document.getClosestInline(this.anchorKey)
- }
-
- /**
- * Get the current focus text node's closest inline parent.
- *
- * @return {Inline}
- */
-
- get focusInline() {
- return this.focusKey && this.document.getClosestInline(this.focusKey)
- }
-
- /**
- * Get the current start text node.
- *
- * @return {Text}
- */
-
- get startText() {
- return this.startKey && this.document.getDescendant(this.startKey)
- }
-
- /**
- * Get the current end node.
- *
- * @return {Text}
- */
-
- get endText() {
- return this.endKey && this.document.getDescendant(this.endKey)
- }
-
- /**
- * Get the current anchor node.
- *
- * @return {Text}
- */
-
- get anchorText() {
- return this.anchorKey && this.document.getDescendant(this.anchorKey)
- }
-
- /**
- * Get the current focus node.
- *
- * @return {Text}
- */
-
- get focusText() {
- return this.focusKey && this.document.getDescendant(this.focusKey)
- }
-
- /**
- * Get the next block node.
- *
- * @return {Block}
- */
-
- get nextBlock() {
- return this.endKey && this.document.getNextBlock(this.endKey)
- }
-
- /**
- * Get the previous block node.
- *
- * @return {Block}
- */
-
- get previousBlock() {
- return this.startKey && this.document.getPreviousBlock(this.startKey)
- }
-
- /**
- * Get the next inline node.
- *
- * @return {Inline}
- */
-
- get nextInline() {
- return this.endKey && this.document.getNextInline(this.endKey)
- }
-
- /**
- * Get the previous inline node.
- *
- * @return {Inline}
- */
-
- get previousInline() {
- return this.startKey && this.document.getPreviousInline(this.startKey)
- }
-
- /**
- * Get the next text node.
- *
- * @return {Text}
- */
-
- get nextText() {
- return this.endKey && this.document.getNextText(this.endKey)
- }
-
- /**
- * Get the previous text node.
- *
- * @return {Text}
- */
-
- get previousText() {
- return this.startKey && this.document.getPreviousText(this.startKey)
- }
-
- /**
- * Get the characters in the current selection.
- *
- * @return {List}
- */
-
- get characters() {
- return this.selection.isUnset
- ? new List()
- : this.document.getCharactersAtRange(this.selection)
- }
-
- /**
- * Get the marks of the current selection.
- *
- * @return {Set}
- */
-
- get marks() {
- return this.selection.isUnset
- ? new Set()
- : this.selection.marks || this.document.getMarksAtRange(this.selection)
- }
-
- /**
- * Get the active marks of the current selection.
- *
- * @return {Set}
- */
-
- get activeMarks() {
- return this.selection.isUnset
- ? new Set()
- : this.selection.marks || this.document.getActiveMarksAtRange(this.selection)
- }
-
- /**
- * Get the block nodes in the current selection.
- *
- * @return {List}
- */
-
- get blocks() {
- return this.selection.isUnset
- ? new List()
- : this.document.getBlocksAtRange(this.selection)
- }
-
- /**
- * Get the fragment of the current selection.
- *
- * @return {Document}
- */
-
- get fragment() {
- return this.selection.isUnset
- ? Document.create()
- : this.document.getFragmentAtRange(this.selection)
- }
-
- /**
- * Get the inline nodes in the current selection.
- *
- * @return {List}
- */
-
- get inlines() {
- return this.selection.isUnset
- ? new List()
- : this.document.getInlinesAtRange(this.selection)
- }
-
- /**
- * Get the text nodes in the current selection.
- *
- * @return {List}
- */
-
- get texts() {
- return this.selection.isUnset
- ? new List()
- : this.document.getTextsAtRange(this.selection)
- }
-
- /**
- * Check whether the selection is empty.
- *
- * @return {Boolean}
- */
-
- get isEmpty() {
- if (this.isCollapsed) return true
- if (this.endOffset != 0 && this.startOffset != 0) return false
- return this.fragment.text.length == 0
- }
-
- /**
- * Check whether the selection is collapsed in a void node.
- *
- * @return {Boolean}
- */
-
- get isInVoid() {
- if (this.isExpanded) return false
- return this.document.hasVoidParent(this.startKey)
- }
-
- /**
- * Create a new `Change` with the current state as a starting point.
- *
- * @param {Object} attrs
- * @return {Change}
- */
-
- change(attrs = {}) {
- const Change = require('./change').default
- return new Change({ ...attrs, state: this })
- }
-
- /**
- * Deprecated.
- *
- * @return {Change}
- */
-
- transform(...args) {
- logger.deprecate('0.22.0', 'The `state.transform()` method has been deprecated in favor of `state.change()`.')
- return this.change(...args)
- }
-
- /**
- * Return a JSON representation of the state.
- *
- * @param {Object} options
- * @return {Object}
- */
-
- toJSON(options = {}) {
- const object = {
- kind: this.kind,
- document: this.document.toJSON(options),
- }
-
- if ('preserveStateData' in options) {
- logger.deprecate('0.26.0', 'The `preserveStateData` option to `state.toJSON` has been deprecated in favor of `options.preserveData`.')
- options.preserveData = options.preserveStateData
- }
-
- if (options.preserveData) {
- object.data = this.data.toJSON()
- }
-
- if (options.preserveDecorations) {
- object.decorations = this.decorations ? this.decorations.toArray().map(d => d.toJSON()) : null
- }
-
- if (options.preserveHistory) {
- object.history = this.history.toJSON()
- }
-
- if (options.preserveSelection) {
- object.selection = this.selection.toJSON()
- }
-
- if (options.preserveSchema) {
- object.schema = this.schema.toJSON()
- }
-
- if (options.preserveSelection && !options.preserveKeys) {
- const { document, selection } = this
- object.selection.anchorPath = selection.isSet ? document.getPath(selection.anchorKey) : null
- object.selection.focusPath = selection.isSet ? document.getPath(selection.focusKey) : null
- delete object.selection.anchorKey
- delete object.selection.focusKey
- }
-
- return object
- }
-
- /**
- * Alias `toJS`.
- */
-
- toJS(options) {
- return this.toJSON(options)
- }
-
-}
-
-/**
- * Attach a pseudo-symbol for type checking.
- */
-
-State.prototype[MODEL_TYPES.STATE] = true
-
-/**
- * Export.
- */
-
export default State
diff --git a/packages/slate/src/models/text.js b/packages/slate/src/models/text.js
index 73c8c9d31..533c2c476 100644
--- a/packages/slate/src/models/text.js
+++ b/packages/slate/src/models/text.js
@@ -58,19 +58,19 @@ class Text extends Record(DEFAULTS) {
}
/**
- * Create a list of `Texts` from a `value`.
+ * Create a list of `Texts` from `elements`.
*
- * @param {Array|List} value
+ * @param {Array|List} elements
* @return {List}
*/
- static createList(value = []) {
- if (List.isList(value) || Array.isArray(value)) {
- const list = new List(value.map(Text.create))
+ static createList(elements = []) {
+ if (List.isList(elements) || Array.isArray(elements)) {
+ const list = new List(elements.map(Text.create))
return list
}
- throw new Error(`\`Text.createList\` only accepts arrays or lists, but you passed it: ${value}`)
+ throw new Error(`\`Text.createList\` only accepts arrays or lists, but you passed it: ${elements}`)
}
/**
@@ -119,25 +119,25 @@ class Text extends Record(DEFAULTS) {
static fromJS = Text.fromJSON
/**
- * Check if a `value` is a `Text`.
+ * Check if `any` is a `Text`.
*
- * @param {Any} value
+ * @param {Any} any
* @return {Boolean}
*/
- static isText(value) {
- return !!(value && value[MODEL_TYPES.TEXT])
+ static isText(any) {
+ return !!(any && any[MODEL_TYPES.TEXT])
}
/**
- * Check if a `value` is a list of texts.
+ * Check if `any` is a list of texts.
*
- * @param {Any} value
+ * @param {Any} any
* @return {Boolean}
*/
- static isTextList(value) {
- return List.isList(value) && value.every(item => Text.isText(item))
+ static isTextList(any) {
+ return List.isList(any) && any.every(item => Text.isText(item))
}
/**
diff --git a/packages/slate/src/models/value.js b/packages/slate/src/models/value.js
new file mode 100644
index 000000000..5effde0bd
--- /dev/null
+++ b/packages/slate/src/models/value.js
@@ -0,0 +1,703 @@
+
+import isPlainObject from 'is-plain-object'
+import logger from 'slate-dev-logger'
+import { Record, Set, List, Map } from 'immutable'
+
+import MODEL_TYPES from '../constants/model-types'
+import Data from './data'
+import Document from './document'
+import History from './history'
+import Range from './range'
+import Schema from './schema'
+
+/**
+ * Default properties.
+ *
+ * @type {Object}
+ */
+
+const DEFAULTS = {
+ data: new Map(),
+ decorations: null,
+ document: Document.create(),
+ history: History.create(),
+ schema: Schema.create(),
+ selection: Range.create(),
+}
+
+/**
+ * Value.
+ *
+ * @type {Value}
+ */
+
+class Value extends Record(DEFAULTS) {
+
+ /**
+ * Create a new `Value` with `attrs`.
+ *
+ * @param {Object|Value} attrs
+ * @param {Object} options
+ * @return {Value}
+ */
+
+ static create(attrs = {}, options = {}) {
+ if (Value.isValue(attrs)) {
+ return attrs
+ }
+
+ if (isPlainObject(attrs)) {
+ return Value.fromJSON(attrs)
+ }
+
+ throw new Error(`\`Value.create\` only accepts objects or values, but you passed it: ${attrs}`)
+ }
+
+ /**
+ * Create a dictionary of settable value properties from `attrs`.
+ *
+ * @param {Object|Value} attrs
+ * @return {Object}
+ */
+
+ static createProperties(attrs = {}) {
+ if (Value.isValue(attrs)) {
+ return {
+ data: attrs.data,
+ decorations: attrs.decorations,
+ schema: attrs.schema,
+ }
+ }
+
+ if (isPlainObject(attrs)) {
+ const props = {}
+ if ('data' in attrs) props.data = Data.create(attrs.data)
+ if ('decorations' in attrs) props.decorations = Range.createList(attrs.decorations)
+ if ('schema' in attrs) props.schema = Schema.create(attrs.schema)
+ return props
+ }
+
+ throw new Error(`\`Value.createProperties\` only accepts objects or values, but you passed it: ${attrs}`)
+ }
+
+ /**
+ * Create a `Value` from a JSON `object`.
+ *
+ * @param {Object} object
+ * @param {Object} options
+ * @property {Boolean} normalize
+ * @property {Array} plugins
+ * @return {Value}
+ */
+
+ static fromJSON(object, options = {}) {
+ let {
+ document = {},
+ selection = {},
+ schema = {},
+ } = object
+
+ let data = new Map()
+
+ document = Document.fromJSON(document)
+ selection = Range.fromJSON(selection)
+ schema = Schema.fromJSON(schema)
+
+ // Allow plugins to set a default value for `data`.
+ if (options.plugins) {
+ for (const plugin of options.plugins) {
+ if (plugin.data) data = data.merge(plugin.data)
+ }
+ }
+
+ // Then merge in the `data` provided.
+ if ('data' in object) {
+ data = data.merge(object.data)
+ }
+
+ if (selection.isUnset) {
+ const text = document.getFirstText()
+ if (text) selection = selection.collapseToStartOf(text)
+ }
+
+ let value = new Value({
+ data,
+ document,
+ selection,
+ schema,
+ })
+
+ if (options.normalize !== false) {
+ value = value.change({ save: false }).normalize().value
+ }
+
+ return value
+ }
+
+ /**
+ * Alias `fromJS`.
+ */
+
+ static fromJS = Value.fromJSON
+
+ /**
+ * Check if a `value` is a `Value`.
+ *
+ * @param {Any} value
+ * @return {Boolean}
+ */
+
+ static isValue(value) {
+ return !!(value && value[MODEL_TYPES.VALUE])
+ }
+
+ /**
+ * Get the kind.
+ *
+ * @return {String}
+ */
+
+ get kind() {
+ return 'value'
+ }
+
+ /**
+ * Are there undoable events?
+ *
+ * @return {Boolean}
+ */
+
+ get hasUndos() {
+ return this.history.undos.size > 0
+ }
+
+ /**
+ * Are there redoable events?
+ *
+ * @return {Boolean}
+ */
+
+ get hasRedos() {
+ return this.history.redos.size > 0
+ }
+
+ /**
+ * Is the current selection blurred?
+ *
+ * @return {Boolean}
+ */
+
+ get isBlurred() {
+ return this.selection.isBlurred
+ }
+
+ /**
+ * Is the current selection focused?
+ *
+ * @return {Boolean}
+ */
+
+ get isFocused() {
+ return this.selection.isFocused
+ }
+
+ /**
+ * Is the current selection collapsed?
+ *
+ * @return {Boolean}
+ */
+
+ get isCollapsed() {
+ return this.selection.isCollapsed
+ }
+
+ /**
+ * Is the current selection expanded?
+ *
+ * @return {Boolean}
+ */
+
+ get isExpanded() {
+ return this.selection.isExpanded
+ }
+
+ /**
+ * Is the current selection backward?
+ *
+ * @return {Boolean} isBackward
+ */
+
+ get isBackward() {
+ return this.selection.isBackward
+ }
+
+ /**
+ * Is the current selection forward?
+ *
+ * @return {Boolean}
+ */
+
+ get isForward() {
+ return this.selection.isForward
+ }
+
+ /**
+ * Get the current start key.
+ *
+ * @return {String}
+ */
+
+ get startKey() {
+ return this.selection.startKey
+ }
+
+ /**
+ * Get the current end key.
+ *
+ * @return {String}
+ */
+
+ get endKey() {
+ return this.selection.endKey
+ }
+
+ /**
+ * Get the current start offset.
+ *
+ * @return {String}
+ */
+
+ get startOffset() {
+ return this.selection.startOffset
+ }
+
+ /**
+ * Get the current end offset.
+ *
+ * @return {String}
+ */
+
+ get endOffset() {
+ return this.selection.endOffset
+ }
+
+ /**
+ * Get the current anchor key.
+ *
+ * @return {String}
+ */
+
+ get anchorKey() {
+ return this.selection.anchorKey
+ }
+
+ /**
+ * Get the current focus key.
+ *
+ * @return {String}
+ */
+
+ get focusKey() {
+ return this.selection.focusKey
+ }
+
+ /**
+ * Get the current anchor offset.
+ *
+ * @return {String}
+ */
+
+ get anchorOffset() {
+ return this.selection.anchorOffset
+ }
+
+ /**
+ * Get the current focus offset.
+ *
+ * @return {String}
+ */
+
+ get focusOffset() {
+ return this.selection.focusOffset
+ }
+
+ /**
+ * Get the current start text node's closest block parent.
+ *
+ * @return {Block}
+ */
+
+ get startBlock() {
+ return this.startKey && this.document.getClosestBlock(this.startKey)
+ }
+
+ /**
+ * Get the current end text node's closest block parent.
+ *
+ * @return {Block}
+ */
+
+ get endBlock() {
+ return this.endKey && this.document.getClosestBlock(this.endKey)
+ }
+
+ /**
+ * Get the current anchor text node's closest block parent.
+ *
+ * @return {Block}
+ */
+
+ get anchorBlock() {
+ return this.anchorKey && this.document.getClosestBlock(this.anchorKey)
+ }
+
+ /**
+ * Get the current focus text node's closest block parent.
+ *
+ * @return {Block}
+ */
+
+ get focusBlock() {
+ return this.focusKey && this.document.getClosestBlock(this.focusKey)
+ }
+
+ /**
+ * Get the current start text node's closest inline parent.
+ *
+ * @return {Inline}
+ */
+
+ get startInline() {
+ return this.startKey && this.document.getClosestInline(this.startKey)
+ }
+
+ /**
+ * Get the current end text node's closest inline parent.
+ *
+ * @return {Inline}
+ */
+
+ get endInline() {
+ return this.endKey && this.document.getClosestInline(this.endKey)
+ }
+
+ /**
+ * Get the current anchor text node's closest inline parent.
+ *
+ * @return {Inline}
+ */
+
+ get anchorInline() {
+ return this.anchorKey && this.document.getClosestInline(this.anchorKey)
+ }
+
+ /**
+ * Get the current focus text node's closest inline parent.
+ *
+ * @return {Inline}
+ */
+
+ get focusInline() {
+ return this.focusKey && this.document.getClosestInline(this.focusKey)
+ }
+
+ /**
+ * Get the current start text node.
+ *
+ * @return {Text}
+ */
+
+ get startText() {
+ return this.startKey && this.document.getDescendant(this.startKey)
+ }
+
+ /**
+ * Get the current end node.
+ *
+ * @return {Text}
+ */
+
+ get endText() {
+ return this.endKey && this.document.getDescendant(this.endKey)
+ }
+
+ /**
+ * Get the current anchor node.
+ *
+ * @return {Text}
+ */
+
+ get anchorText() {
+ return this.anchorKey && this.document.getDescendant(this.anchorKey)
+ }
+
+ /**
+ * Get the current focus node.
+ *
+ * @return {Text}
+ */
+
+ get focusText() {
+ return this.focusKey && this.document.getDescendant(this.focusKey)
+ }
+
+ /**
+ * Get the next block node.
+ *
+ * @return {Block}
+ */
+
+ get nextBlock() {
+ return this.endKey && this.document.getNextBlock(this.endKey)
+ }
+
+ /**
+ * Get the previous block node.
+ *
+ * @return {Block}
+ */
+
+ get previousBlock() {
+ return this.startKey && this.document.getPreviousBlock(this.startKey)
+ }
+
+ /**
+ * Get the next inline node.
+ *
+ * @return {Inline}
+ */
+
+ get nextInline() {
+ return this.endKey && this.document.getNextInline(this.endKey)
+ }
+
+ /**
+ * Get the previous inline node.
+ *
+ * @return {Inline}
+ */
+
+ get previousInline() {
+ return this.startKey && this.document.getPreviousInline(this.startKey)
+ }
+
+ /**
+ * Get the next text node.
+ *
+ * @return {Text}
+ */
+
+ get nextText() {
+ return this.endKey && this.document.getNextText(this.endKey)
+ }
+
+ /**
+ * Get the previous text node.
+ *
+ * @return {Text}
+ */
+
+ get previousText() {
+ return this.startKey && this.document.getPreviousText(this.startKey)
+ }
+
+ /**
+ * Get the characters in the current selection.
+ *
+ * @return {List}
+ */
+
+ get characters() {
+ return this.selection.isUnset
+ ? new List()
+ : this.document.getCharactersAtRange(this.selection)
+ }
+
+ /**
+ * Get the marks of the current selection.
+ *
+ * @return {Set}
+ */
+
+ get marks() {
+ return this.selection.isUnset
+ ? new Set()
+ : this.selection.marks || this.document.getMarksAtRange(this.selection)
+ }
+
+ /**
+ * Get the active marks of the current selection.
+ *
+ * @return {Set}
+ */
+
+ get activeMarks() {
+ return this.selection.isUnset
+ ? new Set()
+ : this.selection.marks || this.document.getActiveMarksAtRange(this.selection)
+ }
+
+ /**
+ * Get the block nodes in the current selection.
+ *
+ * @return {List}
+ */
+
+ get blocks() {
+ return this.selection.isUnset
+ ? new List()
+ : this.document.getBlocksAtRange(this.selection)
+ }
+
+ /**
+ * Get the fragment of the current selection.
+ *
+ * @return {Document}
+ */
+
+ get fragment() {
+ return this.selection.isUnset
+ ? Document.create()
+ : this.document.getFragmentAtRange(this.selection)
+ }
+
+ /**
+ * Get the inline nodes in the current selection.
+ *
+ * @return {List}
+ */
+
+ get inlines() {
+ return this.selection.isUnset
+ ? new List()
+ : this.document.getInlinesAtRange(this.selection)
+ }
+
+ /**
+ * Get the text nodes in the current selection.
+ *
+ * @return {List}
+ */
+
+ get texts() {
+ return this.selection.isUnset
+ ? new List()
+ : this.document.getTextsAtRange(this.selection)
+ }
+
+ /**
+ * Check whether the selection is empty.
+ *
+ * @return {Boolean}
+ */
+
+ get isEmpty() {
+ if (this.isCollapsed) return true
+ if (this.endOffset != 0 && this.startOffset != 0) return false
+ return this.fragment.text.length == 0
+ }
+
+ /**
+ * Check whether the selection is collapsed in a void node.
+ *
+ * @return {Boolean}
+ */
+
+ get isInVoid() {
+ if (this.isExpanded) return false
+ return this.document.hasVoidParent(this.startKey)
+ }
+
+ /**
+ * Create a new `Change` with the current value as a starting point.
+ *
+ * @param {Object} attrs
+ * @return {Change}
+ */
+
+ change(attrs = {}) {
+ const Change = require('./change').default
+ return new Change({ ...attrs, value: this })
+ }
+
+ /**
+ * Deprecated.
+ *
+ * @return {Change}
+ */
+
+ transform(...args) {
+ logger.deprecate('0.22.0', 'The `value.transform()` method has been deprecated in favor of `value.change()`.')
+ return this.change(...args)
+ }
+
+ /**
+ * Return a JSON representation of the value.
+ *
+ * @param {Object} options
+ * @return {Object}
+ */
+
+ toJSON(options = {}) {
+ const object = {
+ kind: this.kind,
+ document: this.document.toJSON(options),
+ }
+
+ if ('preserveStateData' in options) {
+ logger.deprecate('0.26.0', 'The `preserveStateData` option to `value.toJSON` has been deprecated in favor of `options.preserveData`.')
+ options.preserveData = options.preserveStateData
+ }
+
+ if (options.preserveData) {
+ object.data = this.data.toJSON()
+ }
+
+ if (options.preserveDecorations) {
+ object.decorations = this.decorations ? this.decorations.toArray().map(d => d.toJSON()) : null
+ }
+
+ if (options.preserveHistory) {
+ object.history = this.history.toJSON()
+ }
+
+ if (options.preserveSelection) {
+ object.selection = this.selection.toJSON()
+ }
+
+ if (options.preserveSchema) {
+ object.schema = this.schema.toJSON()
+ }
+
+ if (options.preserveSelection && !options.preserveKeys) {
+ const { document, selection } = this
+ object.selection.anchorPath = selection.isSet ? document.getPath(selection.anchorKey) : null
+ object.selection.focusPath = selection.isSet ? document.getPath(selection.focusKey) : null
+ delete object.selection.anchorKey
+ delete object.selection.focusKey
+ }
+
+ return object
+ }
+
+ /**
+ * Alias `toJS`.
+ */
+
+ toJS(options) {
+ return this.toJSON(options)
+ }
+
+}
+
+/**
+ * Attach a pseudo-symbol for type checking.
+ */
+
+Value.prototype[MODEL_TYPES.VALUE] = true
+
+/**
+ * Export.
+ */
+
+export default Value
diff --git a/packages/slate/src/operations/Readme.md b/packages/slate/src/operations/Readme.md
deleted file mode 100644
index 36f69ad9a..000000000
--- a/packages/slate/src/operations/Readme.md
+++ /dev/null
@@ -1,2 +0,0 @@
-
-This directory contains all of the low-level operations logic that ships with Slate by default and makes up the core of how changes are applied.
diff --git a/packages/slate/src/operations/apply.js b/packages/slate/src/operations/apply.js
index 783441393..29cd0a77f 100644
--- a/packages/slate/src/operations/apply.js
+++ b/packages/slate/src/operations/apply.js
@@ -24,58 +24,58 @@ const APPLIERS = {
/**
* Add mark to text at `offset` and `length` in node by `path`.
*
- * @param {State} state
+ * @param {Value} value
* @param {Object} operation
- * @return {State}
+ * @return {Value}
*/
- add_mark(state, operation) {
+ add_mark(value, operation) {
const { path, offset, length } = operation
const mark = Mark.create(operation.mark)
- let { document } = state
+ let { document } = value
let node = document.assertPath(path)
node = node.addMark(offset, length, mark)
document = document.updateNode(node)
- state = state.set('document', document)
- return state
+ value = value.set('document', document)
+ return value
},
/**
* Insert a `node` at `index` in a node by `path`.
*
- * @param {State} state
+ * @param {Value} value
* @param {Object} operation
- * @return {State}
+ * @return {Value}
*/
- insert_node(state, operation) {
+ insert_node(value, operation) {
const { path } = operation
const node = Node.create(operation.node)
const index = path[path.length - 1]
const rest = path.slice(0, -1)
- let { document } = state
+ let { document } = value
let parent = document.assertPath(rest)
parent = parent.insertNode(index, node)
document = document.updateNode(parent)
- state = state.set('document', document)
- return state
+ value = value.set('document', document)
+ return value
},
/**
* Insert `text` at `offset` in node by `path`.
*
- * @param {State} state
+ * @param {Value} value
* @param {Object} operation
- * @return {State}
+ * @return {Value}
*/
- insert_text(state, operation) {
+ insert_text(value, operation) {
const { path, offset, text } = operation
let { marks } = operation
if (Array.isArray(marks)) marks = Mark.createSet(marks)
- let { document, selection } = state
+ let { document, selection } = value
const { anchorKey, focusKey, anchorOffset, focusOffset } = selection
let node = document.assertPath(path)
@@ -91,22 +91,22 @@ const APPLIERS = {
selection = selection.moveFocus(text.length)
}
- state = state.set('document', document).set('selection', selection)
- return state
+ value = value.set('document', document).set('selection', selection)
+ return value
},
/**
* Merge a node at `path` with the previous node.
*
- * @param {State} state
+ * @param {Value} value
* @param {Object} operation
- * @return {State}
+ * @return {Value}
*/
- merge_node(state, operation) {
+ merge_node(value, operation) {
const { path } = operation
const withPath = path.slice(0, path.length - 1).concat([path[path.length - 1] - 1])
- let { document, selection } = state
+ let { document, selection } = value
const one = document.assertPath(withPath)
const two = document.assertPath(path)
let parent = document.getParent(one.key)
@@ -139,25 +139,25 @@ const APPLIERS = {
}
// Update the document and selection.
- state = state.set('document', document).set('selection', selection)
- return state
+ value = value.set('document', document).set('selection', selection)
+ return value
},
/**
* Move a node by `path` to `newPath`.
*
- * @param {State} state
+ * @param {Value} value
* @param {Object} operation
- * @return {State}
+ * @return {Value}
*/
- move_node(state, operation) {
+ move_node(value, operation) {
const { path, newPath } = operation
const newIndex = newPath[newPath.length - 1]
const newParentPath = newPath.slice(0, -1)
const oldParentPath = path.slice(0, -1)
const oldIndex = path[path.length - 1]
- let { document } = state
+ let { document } = value
const node = document.assertPath(path)
// Remove the node from its current parent.
@@ -195,40 +195,40 @@ const APPLIERS = {
// Insert the new node to its new parent.
target = target.insertNode(newIndex, node)
document = document.updateNode(target)
- state = state.set('document', document)
- return state
+ value = value.set('document', document)
+ return value
},
/**
* Remove mark from text at `offset` and `length` in node by `path`.
*
- * @param {State} state
+ * @param {Value} value
* @param {Object} operation
- * @return {State}
+ * @return {Value}
*/
- remove_mark(state, operation) {
+ remove_mark(value, operation) {
const { path, offset, length } = operation
const mark = Mark.create(operation.mark)
- let { document } = state
+ let { document } = value
let node = document.assertPath(path)
node = node.removeMark(offset, length, mark)
document = document.updateNode(node)
- state = state.set('document', document)
- return state
+ value = value.set('document', document)
+ return value
},
/**
* Remove a node by `path`.
*
- * @param {State} state
+ * @param {Value} value
* @param {Object} operation
- * @return {State}
+ * @return {Value}
*/
- remove_node(state, operation) {
+ remove_node(value, operation) {
const { path } = operation
- let { document, selection } = state
+ let { document, selection } = value
const { startKey, endKey } = selection
const node = document.assertPath(path)
// If the selection is set, check to see if it needs to be updated.
@@ -275,23 +275,23 @@ const APPLIERS = {
document = document.updateNode(parent)
// Update the document and selection.
- state = state.set('document', document).set('selection', selection)
- return state
+ value = value.set('document', document).set('selection', selection)
+ return value
},
/**
* Remove `text` at `offset` in node by `path`.
*
- * @param {State} state
+ * @param {Value} value
* @param {Object} operation
- * @return {State}
+ * @return {Value}
*/
- remove_text(state, operation) {
+ remove_text(value, operation) {
const { path, offset, text } = operation
const { length } = text
const rangeOffset = offset + length
- let { document, selection } = state
+ let { document, selection } = value
const { anchorKey, focusKey, anchorOffset, focusOffset } = selection
let node = document.assertPath(path)
@@ -306,40 +306,40 @@ const APPLIERS = {
node = node.removeText(offset, length)
document = document.updateNode(node)
- state = state.set('document', document).set('selection', selection)
- return state
+ value = value.set('document', document).set('selection', selection)
+ return value
},
/**
* Set `properties` on mark on text at `offset` and `length` in node by `path`.
*
- * @param {State} state
+ * @param {Value} value
* @param {Object} operation
- * @return {State}
+ * @return {Value}
*/
- set_mark(state, operation) {
+ set_mark(value, operation) {
const { path, offset, length, properties } = operation
const mark = Mark.create(operation.mark)
- let { document } = state
+ let { document } = value
let node = document.assertPath(path)
node = node.updateMark(offset, length, mark, properties)
document = document.updateNode(node)
- state = state.set('document', document)
- return state
+ value = value.set('document', document)
+ return value
},
/**
* Set `properties` on a node by `path`.
*
- * @param {State} state
+ * @param {Value} value
* @param {Object} operation
- * @return {State}
+ * @return {Value}
*/
- set_node(state, operation) {
+ set_node(value, operation) {
const { path, properties } = operation
- let { document } = state
+ let { document } = value
let node = document.assertPath(path)
if ('nodes' in properties) {
@@ -354,21 +354,21 @@ const APPLIERS = {
node = node.merge(properties)
document = document.updateNode(node)
- state = state.set('document', document)
- return state
+ value = value.set('document', document)
+ return value
},
/**
* Set `properties` on the selection.
*
- * @param {State} state
+ * @param {Value} value
* @param {Object} operation
- * @return {State}
+ * @return {Value}
*/
- set_selection(state, operation) {
+ set_selection(value, operation) {
const properties = { ...operation.properties }
- let { document, selection } = state
+ let { document, selection } = value
if (properties.marks != null) {
properties.marks = Mark.createSet(properties.marks)
@@ -390,51 +390,51 @@ const APPLIERS = {
selection = selection.merge(properties)
selection = selection.normalize(document)
- state = state.set('selection', selection)
- return state
+ value = value.set('selection', selection)
+ return value
},
/**
- * Set `properties` on `state`.
+ * Set `properties` on `value`.
*
- * @param {State} state
+ * @param {Value} value
* @param {Object} operation
- * @return {State}
+ * @return {Value}
*/
- set_state(state, operation) {
+ set_value(value, operation) {
const { properties } = operation
if ('document' in properties) {
- logger.warn('Updating `state.document` property via `setState()` is not allowed. Use the appropriate document updating methods instead. The operation in question was:', operation)
+ logger.warn('Updating `value.document` property via `setValue()` is not allowed. Use the appropriate document updating methods instead. The operation in question was:', operation)
delete properties.document
}
if ('selection' in properties) {
- logger.warn('Updating `state.selection` property via `setState()` is not allowed. Use the appropriate selection updating methods instead. The operation in question was:', operation)
+ logger.warn('Updating `value.selection` property via `setValue()` is not allowed. Use the appropriate selection updating methods instead. The operation in question was:', operation)
delete properties.selection
}
if ('history' in properties) {
- logger.warn('Updating `state.history` property via `setState()` is not allowed. Use the appropriate history updating methods instead. The operation in question was:', operation)
+ logger.warn('Updating `value.history` property via `setValue()` is not allowed. Use the appropriate history updating methods instead. The operation in question was:', operation)
delete properties.history
}
- state = state.merge(properties)
- return state
+ value = value.merge(properties)
+ return value
},
/**
* Split a node by `path` at `offset`.
*
- * @param {State} state
+ * @param {Value} value
* @param {Object} operation
- * @return {State}
+ * @return {Value}
*/
- split_node(state, operation) {
+ split_node(value, operation) {
const { path, position } = operation
- let { document, selection } = state
+ let { document, selection } = value
// Calculate a few things...
const node = document.assertPath(path)
@@ -463,27 +463,27 @@ const APPLIERS = {
}
// Normalize the selection if we changed it, since the methods we use might
- // leave it in a non-normalized state.
+ // leave it in a non-normalized value.
if (normalize) {
selection = selection.normalize(document)
}
- // Return the updated state.
- state = state.set('document', document).set('selection', selection)
- return state
+ // Return the updated value.
+ value = value.set('document', document).set('selection', selection)
+ return value
},
}
/**
- * Apply an `operation` to a `state`.
+ * Apply an `operation` to a `value`.
*
- * @param {State} state
+ * @param {Value} value
* @param {Object} operation
- * @return {State} state
+ * @return {Value} value
*/
-function applyOperation(state, operation) {
+function applyOperation(value, operation) {
const { type } = operation
const apply = APPLIERS[type]
@@ -492,8 +492,8 @@ function applyOperation(state, operation) {
}
debug(type, operation)
- state = apply(state, operation)
- return state
+ value = apply(value, operation)
+ return value
}
/**
diff --git a/packages/slate/src/operations/invert.js b/packages/slate/src/operations/invert.js
index 1c29f26b0..08a7970c0 100644
--- a/packages/slate/src/operations/invert.js
+++ b/packages/slate/src/operations/invert.js
@@ -171,15 +171,15 @@ function invertOperation(op) {
}
/**
- * Set state.
+ * Set value.
*/
- if (type == 'set_state') {
- const { properties, state } = op
+ if (type == 'set_value') {
+ const { properties, value } = op
return {
...op,
- state: state.merge(properties),
- properties: pick(state, Object.keys(properties)),
+ value: value.merge(properties),
+ properties: pick(value, Object.keys(properties)),
}
}
diff --git a/packages/slate/src/utils/Readme.md b/packages/slate/src/utils/Readme.md
deleted file mode 100644
index b44749566..000000000
--- a/packages/slate/src/utils/Readme.md
+++ /dev/null
@@ -1,2 +0,0 @@
-
-This directory contains a series of utilities that Slate uses internally. They're pulled out here to re-use code and to enforce consistency. You'll have to read the source to see what they do, but it's all commented so don't worry!
diff --git a/packages/slate/test/changes/at-current-range/add-mark/across-blocks.js b/packages/slate/test/changes/at-current-range/add-mark/across-blocks.js
index 06485a9f0..07a3f2a12 100644
--- a/packages/slate/test/changes/at-current-range/add-mark/across-blocks.js
+++ b/packages/slate/test/changes/at-current-range/add-mark/across-blocks.js
@@ -7,7 +7,7 @@ export default function (change) {
}
export const input = (
-
+
wo rd
@@ -16,11 +16,11 @@ export const input = (
an other
-
+
)
export const output = (
-
+
word
@@ -29,5 +29,5 @@ export const output = (
an other
-
+
)
diff --git a/packages/slate/test/changes/at-current-range/add-mark/across-inlines.js b/packages/slate/test/changes/at-current-range/add-mark/across-inlines.js
index 0defd394c..061abc35e 100644
--- a/packages/slate/test/changes/at-current-range/add-mark/across-inlines.js
+++ b/packages/slate/test/changes/at-current-range/add-mark/across-inlines.js
@@ -7,7 +7,7 @@ export default function (change) {
}
export const input = (
-
+
wo rd
@@ -16,11 +16,11 @@ export const input = (
an other
-
+
)
export const output = (
-
+
@@ -33,5 +33,5 @@ export const output = (
-
+
)
diff --git a/packages/slate/test/changes/at-current-range/add-mark/collapsed-selection.js b/packages/slate/test/changes/at-current-range/add-mark/collapsed-selection.js
index fbeb2da2f..572c09dab 100644
--- a/packages/slate/test/changes/at-current-range/add-mark/collapsed-selection.js
+++ b/packages/slate/test/changes/at-current-range/add-mark/collapsed-selection.js
@@ -9,21 +9,21 @@ export default function (change) {
}
export const input = (
-
+
word
-
+
)
export const output = (
-
+
a word
-
+
)
diff --git a/packages/slate/test/changes/at-current-range/add-mark/existing-marks.js b/packages/slate/test/changes/at-current-range/add-mark/existing-marks.js
index c5610e226..a1e7db82e 100644
--- a/packages/slate/test/changes/at-current-range/add-mark/existing-marks.js
+++ b/packages/slate/test/changes/at-current-range/add-mark/existing-marks.js
@@ -7,21 +7,21 @@ export default function (change) {
}
export const input = (
-
+
wo rd
-
+
)
export const output = (
-
+
wo rd
-
+
)
diff --git a/packages/slate/test/changes/at-current-range/add-mark/first-character.js b/packages/slate/test/changes/at-current-range/add-mark/first-character.js
index 502e2592a..524d06446 100644
--- a/packages/slate/test/changes/at-current-range/add-mark/first-character.js
+++ b/packages/slate/test/changes/at-current-range/add-mark/first-character.js
@@ -7,21 +7,21 @@ export default function (change) {
}
export const input = (
-
+
w ord
-
+
)
export const output = (
-
+
w ord
-
+
)
diff --git a/packages/slate/test/changes/at-current-range/add-mark/last-character.js b/packages/slate/test/changes/at-current-range/add-mark/last-character.js
index 98e204a65..197aa641f 100644
--- a/packages/slate/test/changes/at-current-range/add-mark/last-character.js
+++ b/packages/slate/test/changes/at-current-range/add-mark/last-character.js
@@ -7,21 +7,21 @@ export default function (change) {
}
export const input = (
-
+
wor d
-
+
)
export const output = (
-
+
word
-
+
)
diff --git a/packages/slate/test/changes/at-current-range/add-mark/middle-character.js b/packages/slate/test/changes/at-current-range/add-mark/middle-character.js
index dd533b6e2..59ee28278 100644
--- a/packages/slate/test/changes/at-current-range/add-mark/middle-character.js
+++ b/packages/slate/test/changes/at-current-range/add-mark/middle-character.js
@@ -7,21 +7,21 @@ export default function (change) {
}
export const input = (
-
+
w o rd
-
+
)
export const output = (
-
+
wo rd
-
+
)
diff --git a/packages/slate/test/changes/at-current-range/add-mark/whole-word.js b/packages/slate/test/changes/at-current-range/add-mark/whole-word.js
index 4ebeafbd9..ab94b3282 100644
--- a/packages/slate/test/changes/at-current-range/add-mark/whole-word.js
+++ b/packages/slate/test/changes/at-current-range/add-mark/whole-word.js
@@ -7,21 +7,21 @@ export default function (change) {
}
export const input = (
-
+
word
-
+
)
export const output = (
-
+
word
-
+
)
diff --git a/packages/slate/test/changes/at-current-range/add-mark/with-mark-object.js b/packages/slate/test/changes/at-current-range/add-mark/with-mark-object.js
index 3e9129e8f..eb72c4566 100644
--- a/packages/slate/test/changes/at-current-range/add-mark/with-mark-object.js
+++ b/packages/slate/test/changes/at-current-range/add-mark/with-mark-object.js
@@ -13,21 +13,21 @@ export default function (change) {
}
export const input = (
-
+
w ord
-
+
)
export const output = (
-
+
w ord
-
+
)
diff --git a/packages/slate/test/changes/at-current-range/add-mark/with-plain-object.js b/packages/slate/test/changes/at-current-range/add-mark/with-plain-object.js
index 296c5163b..e9cf55d42 100644
--- a/packages/slate/test/changes/at-current-range/add-mark/with-plain-object.js
+++ b/packages/slate/test/changes/at-current-range/add-mark/with-plain-object.js
@@ -10,21 +10,21 @@ export default function (change) {
}
export const input = (
-
+
w ord
-
+
)
export const output = (
-
+
w ord
-
+
)
diff --git a/packages/slate/test/changes/at-current-range/delete-backward/empty-after-void-block.js b/packages/slate/test/changes/at-current-range/delete-backward/empty-after-void-block.js
index 77a2adcf9..94567ab5c 100644
--- a/packages/slate/test/changes/at-current-range/delete-backward/empty-after-void-block.js
+++ b/packages/slate/test/changes/at-current-range/delete-backward/empty-after-void-block.js
@@ -7,22 +7,22 @@ export default function (change) {
}
export const input = (
-
+
-
+
)
export const output = (
-
+
{' '}
-
+
)
diff --git a/packages/slate/test/changes/at-current-range/delete-backward/first-character.js b/packages/slate/test/changes/at-current-range/delete-backward/first-character.js
index 690d3ad86..8c47250d7 100644
--- a/packages/slate/test/changes/at-current-range/delete-backward/first-character.js
+++ b/packages/slate/test/changes/at-current-range/delete-backward/first-character.js
@@ -7,21 +7,21 @@ export default function (change) {
}
export const input = (
-
+
w ord
-
+
)
export const output = (
-
+
ord
-
+
)
diff --git a/packages/slate/test/changes/at-current-range/delete-backward/inline-after.js b/packages/slate/test/changes/at-current-range/delete-backward/inline-after.js
index 21d16e8b8..3fa4ee366 100644
--- a/packages/slate/test/changes/at-current-range/delete-backward/inline-after.js
+++ b/packages/slate/test/changes/at-current-range/delete-backward/inline-after.js
@@ -7,21 +7,21 @@ export default function (change) {
}
export const input = (
-
+
one twoa
-
+
)
export const output = (
-
+
one two
-
+
)
diff --git a/packages/slate/test/changes/at-current-range/delete-backward/inline-before.js b/packages/slate/test/changes/at-current-range/delete-backward/inline-before.js
index 52bc03c42..5128fa649 100644
--- a/packages/slate/test/changes/at-current-range/delete-backward/inline-before.js
+++ b/packages/slate/test/changes/at-current-range/delete-backward/inline-before.js
@@ -7,21 +7,21 @@ export default function (change) {
}
export const input = (
-
+
a two
-
+
)
export const output = (
-
+
two
-
+
)
diff --git a/packages/slate/test/changes/at-current-range/delete-backward/inline-end.js b/packages/slate/test/changes/at-current-range/delete-backward/inline-end.js
index 742b8681e..b55620b88 100644
--- a/packages/slate/test/changes/at-current-range/delete-backward/inline-end.js
+++ b/packages/slate/test/changes/at-current-range/delete-backward/inline-end.js
@@ -7,21 +7,21 @@ export default function (change) {
}
export const input = (
-
+
one two
-
+
)
export const output = (
-
+
one tw
-
+
)
diff --git a/packages/slate/test/changes/at-current-range/delete-backward/inline-inside.js b/packages/slate/test/changes/at-current-range/delete-backward/inline-inside.js
index 46eca5b49..8532a4f9e 100644
--- a/packages/slate/test/changes/at-current-range/delete-backward/inline-inside.js
+++ b/packages/slate/test/changes/at-current-range/delete-backward/inline-inside.js
@@ -7,21 +7,21 @@ export default function (change) {
}
export const input = (
-
+
one a two
-
+
)
export const output = (
-
+
one two
-
+
)
diff --git a/packages/slate/test/changes/at-current-range/delete-backward/join-blocks-with-inline-void.js b/packages/slate/test/changes/at-current-range/delete-backward/join-blocks-with-inline-void.js
index 66bfb4156..299bb9851 100644
--- a/packages/slate/test/changes/at-current-range/delete-backward/join-blocks-with-inline-void.js
+++ b/packages/slate/test/changes/at-current-range/delete-backward/join-blocks-with-inline-void.js
@@ -7,7 +7,7 @@ export default function (change) {
}
export const input = (
-
+
@@ -16,15 +16,15 @@ export const input = (
word
-
+
)
export const output = (
-
+
word
-
+
)
diff --git a/packages/slate/test/changes/at-current-range/delete-backward/join-blocks-with-inline.js b/packages/slate/test/changes/at-current-range/delete-backward/join-blocks-with-inline.js
index 1106250fb..728776b7c 100644
--- a/packages/slate/test/changes/at-current-range/delete-backward/join-blocks-with-inline.js
+++ b/packages/slate/test/changes/at-current-range/delete-backward/join-blocks-with-inline.js
@@ -7,7 +7,7 @@ export default function (change) {
}
export const input = (
-
+
one
@@ -16,15 +16,15 @@ export const input = (
two threefour
-
+
)
export const output = (
-
+
one two threefour
-
+
)
diff --git a/packages/slate/test/changes/at-current-range/delete-backward/join-blocks.js b/packages/slate/test/changes/at-current-range/delete-backward/join-blocks.js
index fe681b8f0..c233f6928 100644
--- a/packages/slate/test/changes/at-current-range/delete-backward/join-blocks.js
+++ b/packages/slate/test/changes/at-current-range/delete-backward/join-blocks.js
@@ -7,7 +7,7 @@ export default function (change) {
}
export const input = (
-
+
word
@@ -16,15 +16,15 @@ export const input = (
another
-
+
)
export const output = (
-
+
word another
-
+
)
diff --git a/packages/slate/test/changes/at-current-range/delete-backward/join-nested-blocks.js b/packages/slate/test/changes/at-current-range/delete-backward/join-nested-blocks.js
index 0797071d1..55eabe2c7 100644
--- a/packages/slate/test/changes/at-current-range/delete-backward/join-nested-blocks.js
+++ b/packages/slate/test/changes/at-current-range/delete-backward/join-nested-blocks.js
@@ -7,7 +7,7 @@ export default function (change) {
}
export const input = (
-
+
@@ -18,11 +18,11 @@ export const input = (
-
+
)
export const output = (
-
+
@@ -30,5 +30,5 @@ export const output = (
-
+
)
diff --git a/packages/slate/test/changes/at-current-range/delete-backward/last-character.js b/packages/slate/test/changes/at-current-range/delete-backward/last-character.js
index 3b47c7084..9f5866676 100644
--- a/packages/slate/test/changes/at-current-range/delete-backward/last-character.js
+++ b/packages/slate/test/changes/at-current-range/delete-backward/last-character.js
@@ -7,21 +7,21 @@ export default function (change) {
}
export const input = (
-
+
word
-
+
)
export const output = (
-
+
wor
-
+
)
diff --git a/packages/slate/test/changes/at-current-range/delete-backward/middle-character.js b/packages/slate/test/changes/at-current-range/delete-backward/middle-character.js
index 0c344b391..c2d5284fb 100644
--- a/packages/slate/test/changes/at-current-range/delete-backward/middle-character.js
+++ b/packages/slate/test/changes/at-current-range/delete-backward/middle-character.js
@@ -7,21 +7,21 @@ export default function (change) {
}
export const input = (
-
+
wo rd
-
+
)
export const output = (
-
+
w rd
-
+
)
diff --git a/packages/slate/test/changes/at-current-range/delete-backward/multiple-characters.js b/packages/slate/test/changes/at-current-range/delete-backward/multiple-characters.js
index 63c89d355..a7be1c430 100644
--- a/packages/slate/test/changes/at-current-range/delete-backward/multiple-characters.js
+++ b/packages/slate/test/changes/at-current-range/delete-backward/multiple-characters.js
@@ -7,17 +7,17 @@ export default function (change) {
}
export const input = (
-
+
word
-
+
)
export const output = (
-
+
w
-
+
)
diff --git a/packages/slate/test/changes/at-current-range/delete-backward/single-non-void-block.js b/packages/slate/test/changes/at-current-range/delete-backward/single-non-void-block.js
index baf6170c7..840647c3e 100644
--- a/packages/slate/test/changes/at-current-range/delete-backward/single-non-void-block.js
+++ b/packages/slate/test/changes/at-current-range/delete-backward/single-non-void-block.js
@@ -7,21 +7,21 @@ export default function (change) {
}
export const input = (
-
+
-
+
)
export const output = (
-
+
-
+
)
diff --git a/packages/slate/test/changes/at-current-range/delete-backward/single-void-block.js b/packages/slate/test/changes/at-current-range/delete-backward/single-void-block.js
index c559119d1..3a4232402 100644
--- a/packages/slate/test/changes/at-current-range/delete-backward/single-void-block.js
+++ b/packages/slate/test/changes/at-current-range/delete-backward/single-void-block.js
@@ -7,17 +7,17 @@ export default function (change) {
}
export const input = (
-
+
{' '}
-
+
)
export const output = (
-
+
-
+
)
diff --git a/packages/slate/test/changes/at-current-range/delete-backward/start-of-document.js b/packages/slate/test/changes/at-current-range/delete-backward/start-of-document.js
index b0478a6b6..e736812aa 100644
--- a/packages/slate/test/changes/at-current-range/delete-backward/start-of-document.js
+++ b/packages/slate/test/changes/at-current-range/delete-backward/start-of-document.js
@@ -7,21 +7,21 @@ export default function (change) {
}
export const input = (
-
+
word
-
+
)
export const output = (
-
+
word
-
+
)
diff --git a/packages/slate/test/changes/at-current-range/delete-char-backward/inline-after-emoji.js b/packages/slate/test/changes/at-current-range/delete-char-backward/inline-after-emoji.js
index a8d108923..fcae94f2d 100644
--- a/packages/slate/test/changes/at-current-range/delete-char-backward/inline-after-emoji.js
+++ b/packages/slate/test/changes/at-current-range/delete-char-backward/inline-after-emoji.js
@@ -7,21 +7,21 @@ export default function (change) {
}
export const input = (
-
+
word📛
-
+
)
export const output = (
-
+
word
-
+
)
diff --git a/packages/slate/test/changes/at-current-range/delete-char-backward/inline-end-emoji.js b/packages/slate/test/changes/at-current-range/delete-char-backward/inline-end-emoji.js
index 5e13de898..29df9e0cd 100644
--- a/packages/slate/test/changes/at-current-range/delete-char-backward/inline-end-emoji.js
+++ b/packages/slate/test/changes/at-current-range/delete-char-backward/inline-end-emoji.js
@@ -7,21 +7,21 @@ export default function (change) {
}
export const input = (
-
+
word📛
-
+
)
export const output = (
-
+
word
-
+
)
diff --git a/packages/slate/test/changes/at-current-range/delete-char-backward/inline-inside-emoji.js b/packages/slate/test/changes/at-current-range/delete-char-backward/inline-inside-emoji.js
index 3bc5b9984..babe36067 100644
--- a/packages/slate/test/changes/at-current-range/delete-char-backward/inline-inside-emoji.js
+++ b/packages/slate/test/changes/at-current-range/delete-char-backward/inline-inside-emoji.js
@@ -7,21 +7,21 @@ export default function (change) {
}
export const input = (
-
+
wor📛 d
-
+
)
export const output = (
-
+
wor d
-
+
)
diff --git a/packages/slate/test/changes/at-current-range/delete-char-backward/inline-only-emoji.js b/packages/slate/test/changes/at-current-range/delete-char-backward/inline-only-emoji.js
index d9548be2f..9b274e867 100644
--- a/packages/slate/test/changes/at-current-range/delete-char-backward/inline-only-emoji.js
+++ b/packages/slate/test/changes/at-current-range/delete-char-backward/inline-only-emoji.js
@@ -7,21 +7,21 @@ export default function (change) {
}
export const input = (
-
+
📛
-
+
)
export const output = (
-
+
-
+
)
diff --git a/packages/slate/test/changes/at-current-range/delete-char-backward/text-end.js b/packages/slate/test/changes/at-current-range/delete-char-backward/text-end.js
index ec4772b3f..d8f6f6185 100644
--- a/packages/slate/test/changes/at-current-range/delete-char-backward/text-end.js
+++ b/packages/slate/test/changes/at-current-range/delete-char-backward/text-end.js
@@ -7,21 +7,21 @@ export default function (change) {
}
export const input = (
-
+
word
-
+
)
export const output = (
-
+
wor
-
+
)
diff --git a/packages/slate/test/changes/at-current-range/delete-char-backward/text-middle.js b/packages/slate/test/changes/at-current-range/delete-char-backward/text-middle.js
index 55c146528..c3a6d9f66 100644
--- a/packages/slate/test/changes/at-current-range/delete-char-backward/text-middle.js
+++ b/packages/slate/test/changes/at-current-range/delete-char-backward/text-middle.js
@@ -7,21 +7,21 @@ export default function (change) {
}
export const input = (
-
+
wor d
-
+
)
export const output = (
-
+
wo d
-
+
)
diff --git a/packages/slate/test/changes/at-current-range/delete-char-backward/text-start.js b/packages/slate/test/changes/at-current-range/delete-char-backward/text-start.js
index 10aaa7153..dc89dc050 100644
--- a/packages/slate/test/changes/at-current-range/delete-char-backward/text-start.js
+++ b/packages/slate/test/changes/at-current-range/delete-char-backward/text-start.js
@@ -7,21 +7,21 @@ export default function (change) {
}
export const input = (
-
+
w ord
-
+
)
export const output = (
-
+
ord
-
+
)
diff --git a/packages/slate/test/changes/at-current-range/delete-char-forward/inline-before-emoji.js b/packages/slate/test/changes/at-current-range/delete-char-forward/inline-before-emoji.js
index e881ba010..d2a3c8fd8 100644
--- a/packages/slate/test/changes/at-current-range/delete-char-forward/inline-before-emoji.js
+++ b/packages/slate/test/changes/at-current-range/delete-char-forward/inline-before-emoji.js
@@ -7,21 +7,21 @@ export default function (change) {
}
export const input = (
-
+
📛 word
-
+
)
export const output = (
-
+
word
-
+
)
diff --git a/packages/slate/test/changes/at-current-range/delete-char-forward/inline-middle-emoji.js b/packages/slate/test/changes/at-current-range/delete-char-forward/inline-middle-emoji.js
index 343ace3da..6fd71cd5a 100644
--- a/packages/slate/test/changes/at-current-range/delete-char-forward/inline-middle-emoji.js
+++ b/packages/slate/test/changes/at-current-range/delete-char-forward/inline-middle-emoji.js
@@ -7,21 +7,21 @@ export default function (change) {
}
export const input = (
-
+
wo 📛rd
-
+
)
export const output = (
-
+
wo rd
-
+
)
diff --git a/packages/slate/test/changes/at-current-range/delete-char-forward/inline-start-emoji.js b/packages/slate/test/changes/at-current-range/delete-char-forward/inline-start-emoji.js
index 8909298ae..10d6a282e 100644
--- a/packages/slate/test/changes/at-current-range/delete-char-forward/inline-start-emoji.js
+++ b/packages/slate/test/changes/at-current-range/delete-char-forward/inline-start-emoji.js
@@ -7,21 +7,21 @@ export default function (change) {
}
export const input = (
-
+
📛word
-
+
)
export const output = (
-
+
word
-
+
)
diff --git a/packages/slate/test/changes/at-current-range/delete-char-forward/text-last.js b/packages/slate/test/changes/at-current-range/delete-char-forward/text-last.js
index 734695331..4d2ee57b5 100644
--- a/packages/slate/test/changes/at-current-range/delete-char-forward/text-last.js
+++ b/packages/slate/test/changes/at-current-range/delete-char-forward/text-last.js
@@ -7,21 +7,21 @@ export default function (change) {
}
export const input = (
-
+
wor d
-
+
)
export const output = (
-
+
wor
-
+
)
diff --git a/packages/slate/test/changes/at-current-range/delete-char-forward/text-middle.js b/packages/slate/test/changes/at-current-range/delete-char-forward/text-middle.js
index c598062fe..eae6f82f8 100644
--- a/packages/slate/test/changes/at-current-range/delete-char-forward/text-middle.js
+++ b/packages/slate/test/changes/at-current-range/delete-char-forward/text-middle.js
@@ -7,21 +7,21 @@ export default function (change) {
}
export const input = (
-
+
wo rd
-
+
)
export const output = (
-
+
wo d
-
+
)
diff --git a/packages/slate/test/changes/at-current-range/delete-char-forward/text-start.js b/packages/slate/test/changes/at-current-range/delete-char-forward/text-start.js
index 1422bf962..8b9795de3 100644
--- a/packages/slate/test/changes/at-current-range/delete-char-forward/text-start.js
+++ b/packages/slate/test/changes/at-current-range/delete-char-forward/text-start.js
@@ -7,21 +7,21 @@ export default function (change) {
}
export const input = (
-
+
word
-
+
)
export const output = (
-
+
ord
-
+
)
diff --git a/packages/slate/test/changes/at-current-range/delete-forward/before-inline-sibling.js b/packages/slate/test/changes/at-current-range/delete-forward/before-inline-sibling.js
index 8b365fa7a..5a2b5410b 100644
--- a/packages/slate/test/changes/at-current-range/delete-forward/before-inline-sibling.js
+++ b/packages/slate/test/changes/at-current-range/delete-forward/before-inline-sibling.js
@@ -7,21 +7,21 @@ export default function (change) {
}
export const input = (
-
+
one two a
-
+
)
export const output = (
-
+
one two
-
+
)
diff --git a/packages/slate/test/changes/at-current-range/delete-forward/empty-before-void-block.js b/packages/slate/test/changes/at-current-range/delete-forward/empty-before-void-block.js
index b3b20a0a9..ec06ef54d 100644
--- a/packages/slate/test/changes/at-current-range/delete-forward/empty-before-void-block.js
+++ b/packages/slate/test/changes/at-current-range/delete-forward/empty-before-void-block.js
@@ -7,22 +7,22 @@ export default function (change) {
}
export const input = (
-
+
-
+
)
export const output = (
-
+
{' '}
-
+
)
diff --git a/packages/slate/test/changes/at-current-range/delete-forward/end-of-document.js b/packages/slate/test/changes/at-current-range/delete-forward/end-of-document.js
index 0031951cf..04a854c55 100644
--- a/packages/slate/test/changes/at-current-range/delete-forward/end-of-document.js
+++ b/packages/slate/test/changes/at-current-range/delete-forward/end-of-document.js
@@ -7,21 +7,21 @@ export default function (change) {
}
export const input = (
-
+
word
-
+
)
export const output = (
-
+
word
-
+
)
diff --git a/packages/slate/test/changes/at-current-range/delete-forward/first-character.js b/packages/slate/test/changes/at-current-range/delete-forward/first-character.js
index 0f53e4b5a..3731542a2 100644
--- a/packages/slate/test/changes/at-current-range/delete-forward/first-character.js
+++ b/packages/slate/test/changes/at-current-range/delete-forward/first-character.js
@@ -7,21 +7,21 @@ export default function (change) {
}
export const input = (
-
+
word
-
+
)
export const output = (
-
+
ord
-
+
)
diff --git a/packages/slate/test/changes/at-current-range/delete-forward/inside-inline-sibling.js b/packages/slate/test/changes/at-current-range/delete-forward/inside-inline-sibling.js
index 3b0845d77..767a517a9 100644
--- a/packages/slate/test/changes/at-current-range/delete-forward/inside-inline-sibling.js
+++ b/packages/slate/test/changes/at-current-range/delete-forward/inside-inline-sibling.js
@@ -7,19 +7,19 @@ export default function (change) {
}
export const input = (
-
+
one atwo
-
+
)
export const output = (
-
+
one two
-
+
)
diff --git a/packages/slate/test/changes/at-current-range/delete-forward/join-blocks-with-inline-void.js b/packages/slate/test/changes/at-current-range/delete-forward/join-blocks-with-inline-void.js
index 639634047..65b4c820c 100644
--- a/packages/slate/test/changes/at-current-range/delete-forward/join-blocks-with-inline-void.js
+++ b/packages/slate/test/changes/at-current-range/delete-forward/join-blocks-with-inline-void.js
@@ -7,7 +7,7 @@ export default function (change) {
}
export const input = (
-
+
word
@@ -16,15 +16,15 @@ export const input = (
-
+
)
export const output = (
-
+
word
-
+
)
diff --git a/packages/slate/test/changes/at-current-range/delete-forward/join-blocks-with-inline.js b/packages/slate/test/changes/at-current-range/delete-forward/join-blocks-with-inline.js
index 1c752bf11..7eeec87ff 100644
--- a/packages/slate/test/changes/at-current-range/delete-forward/join-blocks-with-inline.js
+++ b/packages/slate/test/changes/at-current-range/delete-forward/join-blocks-with-inline.js
@@ -7,7 +7,7 @@ export default function (change) {
}
export const input = (
-
+
one
@@ -16,15 +16,15 @@ export const input = (
two threefour
-
+
)
export const output = (
-
+
one two threefour
-
+
)
diff --git a/packages/slate/test/changes/at-current-range/delete-forward/join-blocks.js b/packages/slate/test/changes/at-current-range/delete-forward/join-blocks.js
index 8ee9a97f4..dfedf0eea 100644
--- a/packages/slate/test/changes/at-current-range/delete-forward/join-blocks.js
+++ b/packages/slate/test/changes/at-current-range/delete-forward/join-blocks.js
@@ -7,7 +7,7 @@ export default function (change) {
}
export const input = (
-
+
word
@@ -16,15 +16,15 @@ export const input = (
another
-
+
)
export const output = (
-
+
word another
-
+
)
diff --git a/packages/slate/test/changes/at-current-range/delete-forward/join-nested-blocks.js b/packages/slate/test/changes/at-current-range/delete-forward/join-nested-blocks.js
index df9394804..7bf884674 100644
--- a/packages/slate/test/changes/at-current-range/delete-forward/join-nested-blocks.js
+++ b/packages/slate/test/changes/at-current-range/delete-forward/join-nested-blocks.js
@@ -7,7 +7,7 @@ export default function (change) {
}
export const input = (
-
+
@@ -18,11 +18,11 @@ export const input = (
-
+
)
export const output = (
-
+
@@ -30,5 +30,5 @@ export const output = (
-
+
)
diff --git a/packages/slate/test/changes/at-current-range/delete-forward/last-character.js b/packages/slate/test/changes/at-current-range/delete-forward/last-character.js
index 8965e32ca..d3090f544 100644
--- a/packages/slate/test/changes/at-current-range/delete-forward/last-character.js
+++ b/packages/slate/test/changes/at-current-range/delete-forward/last-character.js
@@ -7,21 +7,21 @@ export default function (change) {
}
export const input = (
-
+
wor d
-
+
)
export const output = (
-
+
wor
-
+
)
diff --git a/packages/slate/test/changes/at-current-range/delete-forward/middle-character.js b/packages/slate/test/changes/at-current-range/delete-forward/middle-character.js
index dfc14c5a9..bd92e00f3 100644
--- a/packages/slate/test/changes/at-current-range/delete-forward/middle-character.js
+++ b/packages/slate/test/changes/at-current-range/delete-forward/middle-character.js
@@ -7,21 +7,21 @@ export default function (change) {
}
export const input = (
-
+
w ord
-
+
)
export const output = (
-
+
w rd
-
+
)
diff --git a/packages/slate/test/changes/at-current-range/delete-forward/multiple-characters.js b/packages/slate/test/changes/at-current-range/delete-forward/multiple-characters.js
index 469c3058d..6b31148c3 100644
--- a/packages/slate/test/changes/at-current-range/delete-forward/multiple-characters.js
+++ b/packages/slate/test/changes/at-current-range/delete-forward/multiple-characters.js
@@ -7,21 +7,21 @@ export default function (change) {
}
export const input = (
-
+
word
-
+
)
export const output = (
-
+
d
-
+
)
diff --git a/packages/slate/test/changes/at-current-range/delete-forward/single-non-void-block.js b/packages/slate/test/changes/at-current-range/delete-forward/single-non-void-block.js
index 7ce483049..cd1cdd036 100644
--- a/packages/slate/test/changes/at-current-range/delete-forward/single-non-void-block.js
+++ b/packages/slate/test/changes/at-current-range/delete-forward/single-non-void-block.js
@@ -7,21 +7,21 @@ export default function (change) {
}
export const input = (
-
+
-
+
)
export const output = (
-
+
-
+
)
diff --git a/packages/slate/test/changes/at-current-range/delete-forward/single-void-block.js b/packages/slate/test/changes/at-current-range/delete-forward/single-void-block.js
index 06303773c..570003b29 100644
--- a/packages/slate/test/changes/at-current-range/delete-forward/single-void-block.js
+++ b/packages/slate/test/changes/at-current-range/delete-forward/single-void-block.js
@@ -7,17 +7,17 @@ export default function (change) {
}
export const input = (
-
+
{' '}
-
+
)
export const output = (
-
+
-
+
)
diff --git a/packages/slate/test/changes/at-current-range/delete-forward/start-text-middle-inline.js b/packages/slate/test/changes/at-current-range/delete-forward/start-text-middle-inline.js
index e41e5bd81..2864250dd 100644
--- a/packages/slate/test/changes/at-current-range/delete-forward/start-text-middle-inline.js
+++ b/packages/slate/test/changes/at-current-range/delete-forward/start-text-middle-inline.js
@@ -7,22 +7,22 @@ export default function (change) {
}
export const input = (
-
+
one t wo
-
+
)
-// TODO: this output selection state seems bad
+// TODO: this output selection seems bad
export const output = (
-
+
wo
-
+
)
diff --git a/packages/slate/test/changes/at-current-range/delete-word-backward/inline-after-emoji.js b/packages/slate/test/changes/at-current-range/delete-word-backward/inline-after-emoji.js
index fa1e4e1fb..9001fc554 100644
--- a/packages/slate/test/changes/at-current-range/delete-word-backward/inline-after-emoji.js
+++ b/packages/slate/test/changes/at-current-range/delete-word-backward/inline-after-emoji.js
@@ -7,21 +7,21 @@ export default function (change) {
}
export const input = (
-
+
word📛
-
+
)
export const output = (
-
+
-
+
)
diff --git a/packages/slate/test/changes/at-current-range/delete-word-backward/inline-middle-emoji.js b/packages/slate/test/changes/at-current-range/delete-word-backward/inline-middle-emoji.js
index 7c7b18600..904529011 100644
--- a/packages/slate/test/changes/at-current-range/delete-word-backward/inline-middle-emoji.js
+++ b/packages/slate/test/changes/at-current-range/delete-word-backward/inline-middle-emoji.js
@@ -7,21 +7,21 @@ export default function (change) {
}
export const input = (
-
+
wo📛rd
-
+
)
export const output = (
-
+
-
+
)
diff --git a/packages/slate/test/changes/at-current-range/delete-word-backward/text-end.js b/packages/slate/test/changes/at-current-range/delete-word-backward/text-end.js
index fd670c95c..6f7aefb01 100644
--- a/packages/slate/test/changes/at-current-range/delete-word-backward/text-end.js
+++ b/packages/slate/test/changes/at-current-range/delete-word-backward/text-end.js
@@ -7,21 +7,21 @@ export default function (change) {
}
export const input = (
-
+
one two three
-
+
)
export const output = (
-
+
one two
-
+
)
diff --git a/packages/slate/test/changes/at-current-range/delete-word-backward/word-middle.js b/packages/slate/test/changes/at-current-range/delete-word-backward/word-middle.js
index 778606057..5bc3ede08 100644
--- a/packages/slate/test/changes/at-current-range/delete-word-backward/word-middle.js
+++ b/packages/slate/test/changes/at-current-range/delete-word-backward/word-middle.js
@@ -7,21 +7,21 @@ export default function (change) {
}
export const input = (
-
+
one two thr ee
-
+
)
export const output = (
-
+
one two ee
-
+
)
diff --git a/packages/slate/test/changes/at-current-range/delete-word-forward/inline-after-emoji.js b/packages/slate/test/changes/at-current-range/delete-word-forward/inline-after-emoji.js
index c44f713f6..db7aab712 100644
--- a/packages/slate/test/changes/at-current-range/delete-word-forward/inline-after-emoji.js
+++ b/packages/slate/test/changes/at-current-range/delete-word-forward/inline-after-emoji.js
@@ -7,21 +7,21 @@ export default function (change) {
}
export const input = (
-
+
word📛
-
+
)
export const output = (
-
+
-
+
)
diff --git a/packages/slate/test/changes/at-current-range/delete-word-forward/inline-middle-emoji.js b/packages/slate/test/changes/at-current-range/delete-word-forward/inline-middle-emoji.js
index 93caa0d29..bd2aea511 100644
--- a/packages/slate/test/changes/at-current-range/delete-word-forward/inline-middle-emoji.js
+++ b/packages/slate/test/changes/at-current-range/delete-word-forward/inline-middle-emoji.js
@@ -7,21 +7,21 @@ export default function (change) {
}
export const input = (
-
+
wo📛rd
-
+
)
export const output = (
-
+
-
+
)
diff --git a/packages/slate/test/changes/at-current-range/delete-word-forward/word-middle.js b/packages/slate/test/changes/at-current-range/delete-word-forward/word-middle.js
index 7ff1b91bb..4f3f0b99f 100644
--- a/packages/slate/test/changes/at-current-range/delete-word-forward/word-middle.js
+++ b/packages/slate/test/changes/at-current-range/delete-word-forward/word-middle.js
@@ -7,21 +7,21 @@ export default function (change) {
}
export const input = (
-
+
o ne two three
-
+
)
export const output = (
-
+
o two three
-
+
)
diff --git a/packages/slate/test/changes/at-current-range/delete-word-forward/word-start.js b/packages/slate/test/changes/at-current-range/delete-word-forward/word-start.js
index b63fe0fec..08b009770 100644
--- a/packages/slate/test/changes/at-current-range/delete-word-forward/word-start.js
+++ b/packages/slate/test/changes/at-current-range/delete-word-forward/word-start.js
@@ -7,21 +7,21 @@ export default function (change) {
}
export const input = (
-
+
one two three
-
+
)
export const output = (
-
+
two three
-
+
)
diff --git a/packages/slate/test/changes/at-current-range/delete/across-blocks-inlines.js b/packages/slate/test/changes/at-current-range/delete/across-blocks-inlines.js
index 7b89958c0..1651a9fe7 100644
--- a/packages/slate/test/changes/at-current-range/delete/across-blocks-inlines.js
+++ b/packages/slate/test/changes/at-current-range/delete/across-blocks-inlines.js
@@ -7,7 +7,7 @@ export default function (change) {
}
export const input = (
-
+
wo rd
@@ -16,16 +16,16 @@ export const input = (
an other
-
+
)
export const output = (
-
+
wo
other
-
+
)
diff --git a/packages/slate/test/changes/at-current-range/delete/across-depths.js b/packages/slate/test/changes/at-current-range/delete/across-depths.js
index 5ecc946f0..23ff0719e 100644
--- a/packages/slate/test/changes/at-current-range/delete/across-depths.js
+++ b/packages/slate/test/changes/at-current-range/delete/across-depths.js
@@ -7,7 +7,7 @@ export default function (change) {
}
export const input = (
-
+
@@ -18,11 +18,11 @@ export const input = (
two
-
+
)
export const output = (
-
+
@@ -30,5 +30,5 @@ export const output = (
-
+
)
diff --git a/packages/slate/test/changes/at-current-range/delete/across-nested-blocks.js b/packages/slate/test/changes/at-current-range/delete/across-nested-blocks.js
index b7aaf885c..a570d8f15 100644
--- a/packages/slate/test/changes/at-current-range/delete/across-nested-blocks.js
+++ b/packages/slate/test/changes/at-current-range/delete/across-nested-blocks.js
@@ -7,7 +7,7 @@ export default function (change) {
}
export const input = (
-
+
@@ -26,11 +26,11 @@ export const input = (
-
+
)
export const output = (
-
+
@@ -43,5 +43,5 @@ export const output = (
-
+
)
diff --git a/packages/slate/test/changes/at-current-range/delete/across-texts-and-inlines.js b/packages/slate/test/changes/at-current-range/delete/across-texts-and-inlines.js
index 5dce50408..44a25e553 100644
--- a/packages/slate/test/changes/at-current-range/delete/across-texts-and-inlines.js
+++ b/packages/slate/test/changes/at-current-range/delete/across-texts-and-inlines.js
@@ -7,21 +7,21 @@ export default function (change) {
}
export const input = (
-
+
o ne twothre e
-
+
)
export const output = (
-
+
o e
-
+
)
diff --git a/packages/slate/test/changes/at-current-range/delete/before-inline-sibling.js b/packages/slate/test/changes/at-current-range/delete/before-inline-sibling.js
index 4be2781e6..9d0fa7f7b 100644
--- a/packages/slate/test/changes/at-current-range/delete/before-inline-sibling.js
+++ b/packages/slate/test/changes/at-current-range/delete/before-inline-sibling.js
@@ -7,21 +7,21 @@ export default function (change) {
}
export const input = (
-
+
one two a
-
+
)
export const output = (
-
+
one two
-
+
)
diff --git a/packages/slate/test/changes/at-current-range/delete/first-character.js b/packages/slate/test/changes/at-current-range/delete/first-character.js
index e81883f91..2215c41c4 100644
--- a/packages/slate/test/changes/at-current-range/delete/first-character.js
+++ b/packages/slate/test/changes/at-current-range/delete/first-character.js
@@ -7,21 +7,21 @@ export default function (change) {
}
export const input = (
-
+
w ord
-
+
)
export const output = (
-
+
ord
-
+
)
diff --git a/packages/slate/test/changes/at-current-range/delete/hanging-selection-multiple-blocks.js b/packages/slate/test/changes/at-current-range/delete/hanging-selection-multiple-blocks.js
index db2de10db..9455bb03b 100644
--- a/packages/slate/test/changes/at-current-range/delete/hanging-selection-multiple-blocks.js
+++ b/packages/slate/test/changes/at-current-range/delete/hanging-selection-multiple-blocks.js
@@ -7,7 +7,7 @@ export default function (change) {
}
export const input = (
-
+
one
@@ -19,15 +19,15 @@ export const input = (
three
-
+
)
export const output = (
-
+
three
-
+
)
diff --git a/packages/slate/test/changes/at-current-range/delete/hanging-selection-single-block.js b/packages/slate/test/changes/at-current-range/delete/hanging-selection-single-block.js
index 142d8eda9..3b2364eed 100644
--- a/packages/slate/test/changes/at-current-range/delete/hanging-selection-single-block.js
+++ b/packages/slate/test/changes/at-current-range/delete/hanging-selection-single-block.js
@@ -7,7 +7,7 @@ export default function (change) {
}
export const input = (
-
+
one
@@ -16,15 +16,15 @@ export const input = (
two
-
+
)
export const output = (
-
+
two
-
+
)
diff --git a/packages/slate/test/changes/at-current-range/delete/inside-inline-sibling.js b/packages/slate/test/changes/at-current-range/delete/inside-inline-sibling.js
index 9c88e0b49..2f0de19f8 100644
--- a/packages/slate/test/changes/at-current-range/delete/inside-inline-sibling.js
+++ b/packages/slate/test/changes/at-current-range/delete/inside-inline-sibling.js
@@ -7,21 +7,21 @@ export default function (change) {
}
export const input = (
-
+
one a two
-
+
)
export const output = (
-
+
one two
-
+
)
diff --git a/packages/slate/test/changes/at-current-range/delete/join-blocks-and-trim.js b/packages/slate/test/changes/at-current-range/delete/join-blocks-and-trim.js
index 0ef1b1525..381657d0f 100644
--- a/packages/slate/test/changes/at-current-range/delete/join-blocks-and-trim.js
+++ b/packages/slate/test/changes/at-current-range/delete/join-blocks-and-trim.js
@@ -7,7 +7,7 @@ export default function (change) {
}
export const input = (
-
+
wo rd
@@ -16,15 +16,15 @@ export const input = (
an other
-
+
)
export const output = (
-
+
wo other
-
+
)
diff --git a/packages/slate/test/changes/at-current-range/delete/join-blocks-with-inlines.js b/packages/slate/test/changes/at-current-range/delete/join-blocks-with-inlines.js
index 44bd7d3fe..9d1c9f32f 100644
--- a/packages/slate/test/changes/at-current-range/delete/join-blocks-with-inlines.js
+++ b/packages/slate/test/changes/at-current-range/delete/join-blocks-with-inlines.js
@@ -7,7 +7,7 @@ export default function (change) {
}
export const input = (
-
+
one
@@ -16,15 +16,15 @@ export const input = (
two threefour
-
+
)
export const output = (
-
+
one two threefour
-
+
)
diff --git a/packages/slate/test/changes/at-current-range/delete/join-blocks.js b/packages/slate/test/changes/at-current-range/delete/join-blocks.js
index 0fe5b1af8..f08b5ec54 100644
--- a/packages/slate/test/changes/at-current-range/delete/join-blocks.js
+++ b/packages/slate/test/changes/at-current-range/delete/join-blocks.js
@@ -7,7 +7,7 @@ export default function (change) {
}
export const input = (
-
+
word
@@ -16,15 +16,15 @@ export const input = (
another
-
+
)
export const output = (
-
+
word another
-
+
)
diff --git a/packages/slate/test/changes/at-current-range/delete/join-double-nested-blocks.js b/packages/slate/test/changes/at-current-range/delete/join-double-nested-blocks.js
index ab2be46c5..f87c08a15 100644
--- a/packages/slate/test/changes/at-current-range/delete/join-double-nested-blocks.js
+++ b/packages/slate/test/changes/at-current-range/delete/join-double-nested-blocks.js
@@ -7,7 +7,7 @@ export default function (change) {
}
export const input = (
-
+
@@ -20,11 +20,11 @@ export const input = (
-
+
)
export const output = (
-
+
@@ -34,5 +34,5 @@ export const output = (
-
+
)
diff --git a/packages/slate/test/changes/at-current-range/delete/join-nested-blocks.js b/packages/slate/test/changes/at-current-range/delete/join-nested-blocks.js
index b61417c8a..e6cc7a72c 100644
--- a/packages/slate/test/changes/at-current-range/delete/join-nested-blocks.js
+++ b/packages/slate/test/changes/at-current-range/delete/join-nested-blocks.js
@@ -7,7 +7,7 @@ export default function (change) {
}
export const input = (
-
+
@@ -18,11 +18,11 @@ export const input = (
-
+
)
export const output = (
-
+
@@ -30,5 +30,5 @@ export const output = (
-
+
)
diff --git a/packages/slate/test/changes/at-current-range/delete/last-character.js b/packages/slate/test/changes/at-current-range/delete/last-character.js
index 649d39dab..efbe5a43a 100644
--- a/packages/slate/test/changes/at-current-range/delete/last-character.js
+++ b/packages/slate/test/changes/at-current-range/delete/last-character.js
@@ -7,21 +7,21 @@ export default function (change) {
}
export const input = (
-
+
wor d
-
+
)
export const output = (
-
+
wor
-
+
)
diff --git a/packages/slate/test/changes/at-current-range/delete/middle-character.js b/packages/slate/test/changes/at-current-range/delete/middle-character.js
index 5859ff11b..ebf5f36ec 100644
--- a/packages/slate/test/changes/at-current-range/delete/middle-character.js
+++ b/packages/slate/test/changes/at-current-range/delete/middle-character.js
@@ -7,21 +7,21 @@ export default function (change) {
}
export const input = (
-
+
w o rd
-
+
)
export const output = (
-
+
w rd
-
+
)
diff --git a/packages/slate/test/changes/at-current-range/delete/nested-block.js b/packages/slate/test/changes/at-current-range/delete/nested-block.js
index 2bd884f8b..462f79c68 100644
--- a/packages/slate/test/changes/at-current-range/delete/nested-block.js
+++ b/packages/slate/test/changes/at-current-range/delete/nested-block.js
@@ -7,7 +7,7 @@ export default function (change) {
}
export const input = (
-
+
wo rd
@@ -21,15 +21,15 @@ export const input = (
-
+
)
export const output = (
-
+
wo other
-
+
)
diff --git a/packages/slate/test/changes/at-current-range/delete/non-void-block-as-first-with-void-siblings-only-non-void.js b/packages/slate/test/changes/at-current-range/delete/non-void-block-as-first-with-void-siblings-only-non-void.js
index 77c8319f5..c01eb7686 100644
--- a/packages/slate/test/changes/at-current-range/delete/non-void-block-as-first-with-void-siblings-only-non-void.js
+++ b/packages/slate/test/changes/at-current-range/delete/non-void-block-as-first-with-void-siblings-only-non-void.js
@@ -7,7 +7,7 @@ export default function (change) {
}
export const input = (
-
+
one
@@ -19,11 +19,11 @@ export const input = (
two
-
+
)
export const output = (
-
+
@@ -32,5 +32,5 @@ export const output = (
two
-
+
)
diff --git a/packages/slate/test/changes/at-current-range/delete/non-void-block-as-first-with-void-siblings-partially-non-void-and-up-to-start-of-void.js b/packages/slate/test/changes/at-current-range/delete/non-void-block-as-first-with-void-siblings-partially-non-void-and-up-to-start-of-void.js
index 27b1c8d34..167268574 100644
--- a/packages/slate/test/changes/at-current-range/delete/non-void-block-as-first-with-void-siblings-partially-non-void-and-up-to-start-of-void.js
+++ b/packages/slate/test/changes/at-current-range/delete/non-void-block-as-first-with-void-siblings-partially-non-void-and-up-to-start-of-void.js
@@ -7,7 +7,7 @@ export default function (change) {
}
export const input = (
-
+
on e
@@ -19,11 +19,11 @@ export const input = (
three
-
+
)
export const output = (
-
+
on
@@ -32,5 +32,5 @@ export const output = (
three
-
+
)
diff --git a/packages/slate/test/changes/at-current-range/delete/non-void-block-as-first-with-void-siblings-partially-non-void-and-void.js b/packages/slate/test/changes/at-current-range/delete/non-void-block-as-first-with-void-siblings-partially-non-void-and-void.js
index 245c92fba..d36c117b2 100644
--- a/packages/slate/test/changes/at-current-range/delete/non-void-block-as-first-with-void-siblings-partially-non-void-and-void.js
+++ b/packages/slate/test/changes/at-current-range/delete/non-void-block-as-first-with-void-siblings-partially-non-void-and-void.js
@@ -7,7 +7,7 @@ export default function (change) {
}
export const input = (
-
+
on e
@@ -19,11 +19,11 @@ export const input = (
three
-
+
)
export const output = (
-
+
on
@@ -32,5 +32,5 @@ export const output = (
three
-
+
)
diff --git a/packages/slate/test/changes/at-current-range/delete/non-void-block-as-first-with-void-siblings-partially-non-void.js b/packages/slate/test/changes/at-current-range/delete/non-void-block-as-first-with-void-siblings-partially-non-void.js
index b22493723..7fe4c1036 100644
--- a/packages/slate/test/changes/at-current-range/delete/non-void-block-as-first-with-void-siblings-partially-non-void.js
+++ b/packages/slate/test/changes/at-current-range/delete/non-void-block-as-first-with-void-siblings-partially-non-void.js
@@ -7,7 +7,7 @@ export default function (change) {
}
export const input = (
-
+
on e
@@ -17,11 +17,11 @@ export const input = (
three
-
+
)
export const output = (
-
+
on
@@ -31,5 +31,5 @@ export const output = (
three
-
+
)
diff --git a/packages/slate/test/changes/at-current-range/delete/void-block-as-first-with-non-void-siblings-all.js b/packages/slate/test/changes/at-current-range/delete/void-block-as-first-with-non-void-siblings-all.js
index f15e35fe4..7a7b4256f 100644
--- a/packages/slate/test/changes/at-current-range/delete/void-block-as-first-with-non-void-siblings-all.js
+++ b/packages/slate/test/changes/at-current-range/delete/void-block-as-first-with-non-void-siblings-all.js
@@ -7,7 +7,7 @@ export default function (change) {
}
export const input = (
-
+
@@ -19,15 +19,15 @@ export const input = (
two
-
+
)
export const output = (
-
+
-
+
)
diff --git a/packages/slate/test/changes/at-current-range/delete/void-block-as-first-with-non-void-siblings-backward-selection-all.js b/packages/slate/test/changes/at-current-range/delete/void-block-as-first-with-non-void-siblings-backward-selection-all.js
index e9bcc7f62..79040cd1a 100644
--- a/packages/slate/test/changes/at-current-range/delete/void-block-as-first-with-non-void-siblings-backward-selection-all.js
+++ b/packages/slate/test/changes/at-current-range/delete/void-block-as-first-with-non-void-siblings-backward-selection-all.js
@@ -7,7 +7,7 @@ export default function (change) {
}
export const input = (
-
+
@@ -19,15 +19,15 @@ export const input = (
two
-
+
)
export const output = (
-
+
-
+
)
diff --git a/packages/slate/test/changes/at-current-range/delete/void-block-as-first-with-non-void-siblings-only-void.js b/packages/slate/test/changes/at-current-range/delete/void-block-as-first-with-non-void-siblings-only-void.js
index c8353df46..3caac3c59 100644
--- a/packages/slate/test/changes/at-current-range/delete/void-block-as-first-with-non-void-siblings-only-void.js
+++ b/packages/slate/test/changes/at-current-range/delete/void-block-as-first-with-non-void-siblings-only-void.js
@@ -7,7 +7,7 @@ export default function (change) {
}
export const input = (
-
+
@@ -19,11 +19,11 @@ export const input = (
two
-
+
)
export const output = (
-
+
one
@@ -32,5 +32,5 @@ export const output = (
two
-
+
)
diff --git a/packages/slate/test/changes/at-current-range/delete/void-block-as-first-with-non-void-siblings-select-void-and-next-word.js b/packages/slate/test/changes/at-current-range/delete/void-block-as-first-with-non-void-siblings-select-void-and-next-word.js
index a22eb34c0..8c93a1bbd 100644
--- a/packages/slate/test/changes/at-current-range/delete/void-block-as-first-with-non-void-siblings-select-void-and-next-word.js
+++ b/packages/slate/test/changes/at-current-range/delete/void-block-as-first-with-non-void-siblings-select-void-and-next-word.js
@@ -7,7 +7,7 @@ export default function (change) {
}
export const input = (
-
+
@@ -19,11 +19,11 @@ export const input = (
three
-
+
)
export const output = (
-
+
o
@@ -32,5 +32,5 @@ export const output = (
three
-
+
)
diff --git a/packages/slate/test/changes/at-current-range/delete/void-block-as-first-with-non-void-siblings-select-void-end-and-next-word.js b/packages/slate/test/changes/at-current-range/delete/void-block-as-first-with-non-void-siblings-select-void-end-and-next-word.js
index 4e185734b..45f81716a 100644
--- a/packages/slate/test/changes/at-current-range/delete/void-block-as-first-with-non-void-siblings-select-void-end-and-next-word.js
+++ b/packages/slate/test/changes/at-current-range/delete/void-block-as-first-with-non-void-siblings-select-void-end-and-next-word.js
@@ -7,7 +7,7 @@ export default function (change) {
}
export const input = (
-
+
{' '}
@@ -19,11 +19,11 @@ export const input = (
three
-
+
)
export const output = (
-
+
o
@@ -32,5 +32,5 @@ export const output = (
three
-
+
)
diff --git a/packages/slate/test/changes/at-current-range/delete/void-block-as-only.js b/packages/slate/test/changes/at-current-range/delete/void-block-as-only.js
index 9ac7abc59..c0c6abe15 100644
--- a/packages/slate/test/changes/at-current-range/delete/void-block-as-only.js
+++ b/packages/slate/test/changes/at-current-range/delete/void-block-as-only.js
@@ -7,17 +7,17 @@ export default function (change) {
}
export const input = (
-
+
{' '}
-
+
)
export const output = (
-
+
-
+
)
diff --git a/packages/slate/test/changes/at-current-range/delete/void-blocks-as-first-with-non-void-siblings-only-first-void.js b/packages/slate/test/changes/at-current-range/delete/void-blocks-as-first-with-non-void-siblings-only-first-void.js
index 0dd1d1b17..1060c3d77 100644
--- a/packages/slate/test/changes/at-current-range/delete/void-blocks-as-first-with-non-void-siblings-only-first-void.js
+++ b/packages/slate/test/changes/at-current-range/delete/void-blocks-as-first-with-non-void-siblings-only-first-void.js
@@ -7,7 +7,7 @@ export default function (change) {
}
export const input = (
-
+
{' '}
@@ -22,11 +22,11 @@ export const input = (
two
-
+
)
export const output = (
-
+
one
@@ -35,5 +35,5 @@ export const output = (
two
-
+
)
diff --git a/packages/slate/test/changes/at-current-range/delete/void-blocks-as-first-with-non-void-siblings-only-voids.js b/packages/slate/test/changes/at-current-range/delete/void-blocks-as-first-with-non-void-siblings-only-voids.js
index 052afcc23..0590f8772 100644
--- a/packages/slate/test/changes/at-current-range/delete/void-blocks-as-first-with-non-void-siblings-only-voids.js
+++ b/packages/slate/test/changes/at-current-range/delete/void-blocks-as-first-with-non-void-siblings-only-voids.js
@@ -7,7 +7,7 @@ export default function (change) {
}
export const input = (
-
+
@@ -20,11 +20,11 @@ export const input = (
two
-
+
)
export const output = (
-
+
one
@@ -33,5 +33,5 @@ export const output = (
two
-
+
)
diff --git a/packages/slate/test/changes/at-current-range/delete/void-inline-as-first-with-non-void-block-next.js b/packages/slate/test/changes/at-current-range/delete/void-inline-as-first-with-non-void-block-next.js
index 308d5b0cc..e6f6316d3 100644
--- a/packages/slate/test/changes/at-current-range/delete/void-inline-as-first-with-non-void-block-next.js
+++ b/packages/slate/test/changes/at-current-range/delete/void-inline-as-first-with-non-void-block-next.js
@@ -7,7 +7,7 @@ export default function (change) {
}
export const input = (
-
+
one two
@@ -16,15 +16,15 @@ export const input = (
three
-
+
)
export const output = (
-
+
one three
-
+
)
diff --git a/packages/slate/test/changes/at-current-range/delete/void-inline-as-first-with-non-void-sibling.js b/packages/slate/test/changes/at-current-range/delete/void-inline-as-first-with-non-void-sibling.js
index ff4e26b8c..b89d827c7 100644
--- a/packages/slate/test/changes/at-current-range/delete/void-inline-as-first-with-non-void-sibling.js
+++ b/packages/slate/test/changes/at-current-range/delete/void-inline-as-first-with-non-void-sibling.js
@@ -7,19 +7,19 @@ export default function (change) {
}
export const input = (
-
+
{' '} abc
-
+
)
export const output = (
-
+
abc
-
+
)
diff --git a/packages/slate/test/changes/at-current-range/delete/whole-block-with-other-block-type-below.js b/packages/slate/test/changes/at-current-range/delete/whole-block-with-other-block-type-below.js
index 607ae9c30..5afc73499 100644
--- a/packages/slate/test/changes/at-current-range/delete/whole-block-with-other-block-type-below.js
+++ b/packages/slate/test/changes/at-current-range/delete/whole-block-with-other-block-type-below.js
@@ -7,18 +7,18 @@ export default function (change) {
}
export const input = (
-
+
one
two
-
+
)
export const output = (
-
+
two
-
+
)
diff --git a/packages/slate/test/changes/at-current-range/delete/whole-inline.js b/packages/slate/test/changes/at-current-range/delete/whole-inline.js
index f1ce85011..28db7c662 100644
--- a/packages/slate/test/changes/at-current-range/delete/whole-inline.js
+++ b/packages/slate/test/changes/at-current-range/delete/whole-inline.js
@@ -7,21 +7,21 @@ export default function (change) {
}
export const input = (
-
+
word
-
+
)
export const output = (
-
+
-
+
)
diff --git a/packages/slate/test/changes/at-current-range/delete/whole-word.js b/packages/slate/test/changes/at-current-range/delete/whole-word.js
index a3394db06..82af071b6 100644
--- a/packages/slate/test/changes/at-current-range/delete/whole-word.js
+++ b/packages/slate/test/changes/at-current-range/delete/whole-word.js
@@ -7,21 +7,21 @@ export default function (change) {
}
export const input = (
-
+
word
-
+
)
export const output = (
-
+
-
+
)
diff --git a/packages/slate/test/changes/at-current-range/insert-block/block-end.js b/packages/slate/test/changes/at-current-range/insert-block/block-end.js
index f482a9c7a..e2aff5c6d 100644
--- a/packages/slate/test/changes/at-current-range/insert-block/block-end.js
+++ b/packages/slate/test/changes/at-current-range/insert-block/block-end.js
@@ -7,17 +7,17 @@ export default function (change) {
}
export const input = (
-
+
word
-
+
)
export const output = (
-
+
word
@@ -26,5 +26,5 @@ export const output = (
-
+
)
diff --git a/packages/slate/test/changes/at-current-range/insert-block/block-middle.js b/packages/slate/test/changes/at-current-range/insert-block/block-middle.js
index 4ed91c7b0..2a0b8c462 100644
--- a/packages/slate/test/changes/at-current-range/insert-block/block-middle.js
+++ b/packages/slate/test/changes/at-current-range/insert-block/block-middle.js
@@ -7,17 +7,17 @@ export default function (change) {
}
export const input = (
-
+
wo rd
-
+
)
export const output = (
-
+
wo
@@ -29,5 +29,5 @@ export const output = (
rd
-
+
)
diff --git a/packages/slate/test/changes/at-current-range/insert-block/block-start.js b/packages/slate/test/changes/at-current-range/insert-block/block-start.js
index c87c8e8e1..d9f0837fc 100644
--- a/packages/slate/test/changes/at-current-range/insert-block/block-start.js
+++ b/packages/slate/test/changes/at-current-range/insert-block/block-start.js
@@ -7,17 +7,17 @@ export default function (change) {
}
export const input = (
-
+
word
-
+
)
export const output = (
-
+
@@ -26,5 +26,5 @@ export const output = (
word
-
+
)
diff --git a/packages/slate/test/changes/at-current-range/insert-block/is-empty.js b/packages/slate/test/changes/at-current-range/insert-block/is-empty.js
index 8e7010ac8..d4e58aec7 100644
--- a/packages/slate/test/changes/at-current-range/insert-block/is-empty.js
+++ b/packages/slate/test/changes/at-current-range/insert-block/is-empty.js
@@ -7,7 +7,7 @@ export default function (change) {
}
export const input = (
-
+
@@ -16,11 +16,11 @@ export const input = (
not empty
-
+
)
export const output = (
-
+
@@ -30,5 +30,5 @@ export const output = (
not empty
-
+
)
diff --git a/packages/slate/test/changes/at-current-range/insert-block/is-void-end.js b/packages/slate/test/changes/at-current-range/insert-block/is-void-end.js
index 54a15a433..c15a47385 100644
--- a/packages/slate/test/changes/at-current-range/insert-block/is-void-end.js
+++ b/packages/slate/test/changes/at-current-range/insert-block/is-void-end.js
@@ -7,7 +7,7 @@ export default function (change) {
}
export const input = (
-
+
{' '}
@@ -16,11 +16,11 @@ export const input = (
text
-
+
)
export const output = (
-
+
@@ -30,5 +30,5 @@ export const output = (
text
-
+
)
diff --git a/packages/slate/test/changes/at-current-range/insert-block/is-void-start.js b/packages/slate/test/changes/at-current-range/insert-block/is-void-start.js
index 3d7b3cb47..bb7c62d8b 100644
--- a/packages/slate/test/changes/at-current-range/insert-block/is-void-start.js
+++ b/packages/slate/test/changes/at-current-range/insert-block/is-void-start.js
@@ -7,7 +7,7 @@ export default function (change) {
}
export const input = (
-
+
{' '}
@@ -16,11 +16,11 @@ export const input = (
text
-
+
)
export const output = (
-
+
@@ -30,5 +30,5 @@ export const output = (
text
-
+
)
diff --git a/packages/slate/test/changes/at-current-range/insert-block/with-block.js b/packages/slate/test/changes/at-current-range/insert-block/with-block.js
index 54fb04e2e..19f7e20a5 100644
--- a/packages/slate/test/changes/at-current-range/insert-block/with-block.js
+++ b/packages/slate/test/changes/at-current-range/insert-block/with-block.js
@@ -9,17 +9,17 @@ export default function (change) {
}
export const input = (
-
+
word
-
+
)
export const output = (
-
+
@@ -28,5 +28,5 @@ export const output = (
word
-
+
)
diff --git a/packages/slate/test/changes/at-current-range/insert-block/with-object.js b/packages/slate/test/changes/at-current-range/insert-block/with-object.js
index 43a7ed73a..4999113cd 100644
--- a/packages/slate/test/changes/at-current-range/insert-block/with-object.js
+++ b/packages/slate/test/changes/at-current-range/insert-block/with-object.js
@@ -7,17 +7,17 @@ export default function (change) {
}
export const input = (
-
+
word
-
+
)
export const output = (
-
+
@@ -26,5 +26,5 @@ export const output = (
word
-
+
)
diff --git a/packages/slate/test/changes/at-current-range/insert-fragment/end-block-multiple-blocks.js b/packages/slate/test/changes/at-current-range/insert-fragment/end-block-multiple-blocks.js
index 72755ee80..123fbbbf3 100644
--- a/packages/slate/test/changes/at-current-range/insert-fragment/end-block-multiple-blocks.js
+++ b/packages/slate/test/changes/at-current-range/insert-fragment/end-block-multiple-blocks.js
@@ -19,18 +19,18 @@ export default function (change) {
}
export const input = (
-
+
word
-
+
)
// TODO: this output selection should be at the end of the block
export const output = (
-
+
wordone
@@ -42,5 +42,5 @@ export const output = (
three
-
+
)
diff --git a/packages/slate/test/changes/at-current-range/insert-fragment/end-block.js b/packages/slate/test/changes/at-current-range/insert-fragment/end-block.js
index 21b162ed3..4dad5aed3 100644
--- a/packages/slate/test/changes/at-current-range/insert-fragment/end-block.js
+++ b/packages/slate/test/changes/at-current-range/insert-fragment/end-block.js
@@ -13,21 +13,21 @@ export default function (change) {
}
export const input = (
-
+
word
-
+
)
export const output = (
-
+
word fragment
-
+
)
diff --git a/packages/slate/test/changes/at-current-range/insert-fragment/end-inline.js b/packages/slate/test/changes/at-current-range/insert-fragment/end-inline.js
index e140814b3..16b0aae67 100644
--- a/packages/slate/test/changes/at-current-range/insert-fragment/end-inline.js
+++ b/packages/slate/test/changes/at-current-range/insert-fragment/end-inline.js
@@ -13,21 +13,21 @@ export default function (change) {
}
export const input = (
-
+
word
-
+
)
export const output = (
-
+
word fragment
-
+
)
diff --git a/packages/slate/test/changes/at-current-range/insert-fragment/fragment-multiple-blocks.js b/packages/slate/test/changes/at-current-range/insert-fragment/fragment-multiple-blocks.js
index 17ed5fa46..9d83097cc 100644
--- a/packages/slate/test/changes/at-current-range/insert-fragment/fragment-multiple-blocks.js
+++ b/packages/slate/test/changes/at-current-range/insert-fragment/fragment-multiple-blocks.js
@@ -16,17 +16,17 @@ export default function (change) {
}
export const input = (
-
+
wo rd
-
+
)
export const output = (
-
+
woone
@@ -35,5 +35,5 @@ export const output = (
tword
-
+
)
diff --git a/packages/slate/test/changes/at-current-range/insert-fragment/fragment-nested-blocks.js b/packages/slate/test/changes/at-current-range/insert-fragment/fragment-nested-blocks.js
index de7f0bffd..5ccffa6c1 100644
--- a/packages/slate/test/changes/at-current-range/insert-fragment/fragment-nested-blocks.js
+++ b/packages/slate/test/changes/at-current-range/insert-fragment/fragment-nested-blocks.js
@@ -18,17 +18,17 @@ export default function (change) {
}
export const input = (
-
+
wo rd
-
+
)
export const output = (
-
+
woone
@@ -39,5 +39,5 @@ export const output = (
-
+
)
diff --git a/packages/slate/test/changes/at-current-range/insert-fragment/middle-block.js b/packages/slate/test/changes/at-current-range/insert-fragment/middle-block.js
index 1937b8f01..fa3759c9a 100644
--- a/packages/slate/test/changes/at-current-range/insert-fragment/middle-block.js
+++ b/packages/slate/test/changes/at-current-range/insert-fragment/middle-block.js
@@ -13,21 +13,21 @@ export default function (change) {
}
export const input = (
-
+
wo rd
-
+
)
export const output = (
-
+
wo fragmentrd
-
+
)
diff --git a/packages/slate/test/changes/at-current-range/insert-fragment/middle-inline-fragment-inline.js b/packages/slate/test/changes/at-current-range/insert-fragment/middle-inline-fragment-inline.js
index e0717c955..b02ca5125 100644
--- a/packages/slate/test/changes/at-current-range/insert-fragment/middle-inline-fragment-inline.js
+++ b/packages/slate/test/changes/at-current-range/insert-fragment/middle-inline-fragment-inline.js
@@ -13,22 +13,22 @@ export default function (change) {
}
export const input = (
-
+
wo rd
-
+
)
// TODO: the cursor placement needs to be fixed
export const output = (
-
+
wofragment rd
-
+
)
diff --git a/packages/slate/test/changes/at-current-range/insert-fragment/middle-inline.js b/packages/slate/test/changes/at-current-range/insert-fragment/middle-inline.js
index da519cdf3..cc7f32a7d 100644
--- a/packages/slate/test/changes/at-current-range/insert-fragment/middle-inline.js
+++ b/packages/slate/test/changes/at-current-range/insert-fragment/middle-inline.js
@@ -13,21 +13,21 @@ export default function (change) {
}
export const input = (
-
+
wo rd
-
+
)
export const output = (
-
+
wo fragment rd
-
+
)
diff --git a/packages/slate/test/changes/at-current-range/insert-fragment/nested-block-fragment-nested-blocks.js b/packages/slate/test/changes/at-current-range/insert-fragment/nested-block-fragment-nested-blocks.js
index cf09c3ec7..71ed55aad 100644
--- a/packages/slate/test/changes/at-current-range/insert-fragment/nested-block-fragment-nested-blocks.js
+++ b/packages/slate/test/changes/at-current-range/insert-fragment/nested-block-fragment-nested-blocks.js
@@ -18,7 +18,7 @@ export default function (change) {
}
export const input = (
-
+
@@ -26,11 +26,11 @@ export const input = (
-
+
)
export const output = (
-
+
@@ -43,5 +43,5 @@ export const output = (
-
+
)
diff --git a/packages/slate/test/changes/at-current-range/insert-fragment/start-block-multiple-blocks.js b/packages/slate/test/changes/at-current-range/insert-fragment/start-block-multiple-blocks.js
index d6c3dbc72..e233402a9 100644
--- a/packages/slate/test/changes/at-current-range/insert-fragment/start-block-multiple-blocks.js
+++ b/packages/slate/test/changes/at-current-range/insert-fragment/start-block-multiple-blocks.js
@@ -19,17 +19,17 @@ export default function (change) {
}
export const input = (
-
+
word
-
+
)
export const output = (
-
+
one
@@ -41,5 +41,5 @@ export const output = (
threeword
-
+
)
diff --git a/packages/slate/test/changes/at-current-range/insert-fragment/start-block.js b/packages/slate/test/changes/at-current-range/insert-fragment/start-block.js
index 880a3d972..a7d5b3ebd 100644
--- a/packages/slate/test/changes/at-current-range/insert-fragment/start-block.js
+++ b/packages/slate/test/changes/at-current-range/insert-fragment/start-block.js
@@ -13,21 +13,21 @@ export default function (change) {
}
export const input = (
-
+
word
-
+
)
export const output = (
-
+
fragmentword
-
+
)
diff --git a/packages/slate/test/changes/at-current-range/insert-fragment/start-inline.js b/packages/slate/test/changes/at-current-range/insert-fragment/start-inline.js
index 5c44bdaa6..b99cfa063 100644
--- a/packages/slate/test/changes/at-current-range/insert-fragment/start-inline.js
+++ b/packages/slate/test/changes/at-current-range/insert-fragment/start-inline.js
@@ -13,21 +13,21 @@ export default function (change) {
}
export const input = (
-
+
word
-
+
)
export const output = (
-
+
fragment word
-
+
)
diff --git a/packages/slate/test/changes/at-current-range/insert-fragment/start-second-block.js b/packages/slate/test/changes/at-current-range/insert-fragment/start-second-block.js
index 03774870a..745633b43 100644
--- a/packages/slate/test/changes/at-current-range/insert-fragment/start-second-block.js
+++ b/packages/slate/test/changes/at-current-range/insert-fragment/start-second-block.js
@@ -13,7 +13,7 @@ export default function (change) {
}
export const input = (
-
+
word
@@ -22,11 +22,11 @@ export const input = (
another
-
+
)
export const output = (
-
+
word
@@ -35,5 +35,5 @@ export const output = (
fragmentanother
-
+
)
diff --git a/packages/slate/test/changes/at-current-range/insert-fragment/with-delete-across-blocks.js b/packages/slate/test/changes/at-current-range/insert-fragment/with-delete-across-blocks.js
index 003076758..8cff3b8ee 100644
--- a/packages/slate/test/changes/at-current-range/insert-fragment/with-delete-across-blocks.js
+++ b/packages/slate/test/changes/at-current-range/insert-fragment/with-delete-across-blocks.js
@@ -13,7 +13,7 @@ export default function (change) {
}
export const input = (
-
+
wo rd
@@ -22,15 +22,15 @@ export const input = (
an other
-
+
)
export const output = (
-
+
wo fragmentother
-
+
)
diff --git a/packages/slate/test/changes/at-current-range/insert-inline/block-end.js b/packages/slate/test/changes/at-current-range/insert-inline/block-end.js
index fd701f911..26973d263 100644
--- a/packages/slate/test/changes/at-current-range/insert-inline/block-end.js
+++ b/packages/slate/test/changes/at-current-range/insert-inline/block-end.js
@@ -10,21 +10,21 @@ export default function (change) {
}
export const input = (
-
+
word
-
+
)
export const output = (
-
+
word{' '}
-
+
)
diff --git a/packages/slate/test/changes/at-current-range/insert-inline/block-middle.js b/packages/slate/test/changes/at-current-range/insert-inline/block-middle.js
index e5a373690..ed21fb720 100644
--- a/packages/slate/test/changes/at-current-range/insert-inline/block-middle.js
+++ b/packages/slate/test/changes/at-current-range/insert-inline/block-middle.js
@@ -10,19 +10,19 @@ export default function (change) {
}
export const input = (
-
+
wo rd
-
+
)
export const output = (
-
+
wo{' '} rd
-
+
)
diff --git a/packages/slate/test/changes/at-current-range/insert-inline/block-start.js b/packages/slate/test/changes/at-current-range/insert-inline/block-start.js
index baaab0276..5b5c202f8 100644
--- a/packages/slate/test/changes/at-current-range/insert-inline/block-start.js
+++ b/packages/slate/test/changes/at-current-range/insert-inline/block-start.js
@@ -10,21 +10,21 @@ export default function (change) {
}
export const input = (
-
+
word
-
+
)
export const output = (
-
+
{' '} word
-
+
)
diff --git a/packages/slate/test/changes/at-current-range/insert-inline/inline-middle.js b/packages/slate/test/changes/at-current-range/insert-inline/inline-middle.js
index cad450c8a..f58d167ff 100644
--- a/packages/slate/test/changes/at-current-range/insert-inline/inline-middle.js
+++ b/packages/slate/test/changes/at-current-range/insert-inline/inline-middle.js
@@ -10,21 +10,21 @@ export default function (change) {
}
export const input = (
-
+
wo rd
-
+
)
export const output = (
-
+
wo{' '} rd
-
+
)
diff --git a/packages/slate/test/changes/at-current-range/insert-inline/is-empty.js b/packages/slate/test/changes/at-current-range/insert-inline/is-empty.js
index f5d354c35..006d843b2 100644
--- a/packages/slate/test/changes/at-current-range/insert-inline/is-empty.js
+++ b/packages/slate/test/changes/at-current-range/insert-inline/is-empty.js
@@ -10,21 +10,21 @@ export default function (change) {
}
export const input = (
-
+
-
+
)
export const output = (
-
+
{' '}
-
+
)
diff --git a/packages/slate/test/changes/at-current-range/insert-inline/is-void.js b/packages/slate/test/changes/at-current-range/insert-inline/is-void.js
index 012b9208c..92c7af714 100644
--- a/packages/slate/test/changes/at-current-range/insert-inline/is-void.js
+++ b/packages/slate/test/changes/at-current-range/insert-inline/is-void.js
@@ -10,21 +10,21 @@ export default function (change) {
}
export const input = (
-
+
-
+
)
export const output = (
-
+
-
+
)
diff --git a/packages/slate/test/changes/at-current-range/insert-inline/with-inline.js b/packages/slate/test/changes/at-current-range/insert-inline/with-inline.js
index 5b3b3137f..147655748 100644
--- a/packages/slate/test/changes/at-current-range/insert-inline/with-inline.js
+++ b/packages/slate/test/changes/at-current-range/insert-inline/with-inline.js
@@ -11,19 +11,19 @@ export default function (change) {
}
export const input = (
-
+
wo rd
-
+
)
export const output = (
-
+
wo{' '} rd
-
+
)
diff --git a/packages/slate/test/changes/at-current-range/insert-text/after-mark.js b/packages/slate/test/changes/at-current-range/insert-text/after-mark.js
index dfc7faac1..dc6b30d84 100644
--- a/packages/slate/test/changes/at-current-range/insert-text/after-mark.js
+++ b/packages/slate/test/changes/at-current-range/insert-text/after-mark.js
@@ -7,21 +7,21 @@ export default function (change) {
}
export const input = (
-
+
wor d
-
+
)
export const output = (
-
+
wora d
-
+
)
diff --git a/packages/slate/test/changes/at-current-range/insert-text/before-mark.js b/packages/slate/test/changes/at-current-range/insert-text/before-mark.js
index 0c8cda9fa..d5466e50b 100644
--- a/packages/slate/test/changes/at-current-range/insert-text/before-mark.js
+++ b/packages/slate/test/changes/at-current-range/insert-text/before-mark.js
@@ -7,21 +7,21 @@ export default function (change) {
}
export const input = (
-
+
wor d
-
+
)
export const output = (
-
+
waor d
-
+
)
diff --git a/packages/slate/test/changes/at-current-range/insert-text/during-mark.js b/packages/slate/test/changes/at-current-range/insert-text/during-mark.js
index f0a857b9a..4b0f8fade 100644
--- a/packages/slate/test/changes/at-current-range/insert-text/during-mark.js
+++ b/packages/slate/test/changes/at-current-range/insert-text/during-mark.js
@@ -7,21 +7,21 @@ export default function (change) {
}
export const input = (
-
+
wo r d
-
+
)
export const output = (
-
+
woa r d
-
+
)
diff --git a/packages/slate/test/changes/at-current-range/insert-text/first-character.js b/packages/slate/test/changes/at-current-range/insert-text/first-character.js
index 562389226..48d375405 100644
--- a/packages/slate/test/changes/at-current-range/insert-text/first-character.js
+++ b/packages/slate/test/changes/at-current-range/insert-text/first-character.js
@@ -7,21 +7,21 @@ export default function (change) {
}
export const input = (
-
+
word
-
+
)
export const output = (
-
+
a word
-
+
)
diff --git a/packages/slate/test/changes/at-current-range/insert-text/first-space.js b/packages/slate/test/changes/at-current-range/insert-text/first-space.js
index 5cd5aa6b4..ad00cdd48 100644
--- a/packages/slate/test/changes/at-current-range/insert-text/first-space.js
+++ b/packages/slate/test/changes/at-current-range/insert-text/first-space.js
@@ -7,21 +7,21 @@ export default function (change) {
}
export const input = (
-
+
word
-
+
)
export const output = (
-
+
{' '} word
-
+
)
diff --git a/packages/slate/test/changes/at-current-range/insert-text/first-words.js b/packages/slate/test/changes/at-current-range/insert-text/first-words.js
index b975c345b..b0a6103f9 100644
--- a/packages/slate/test/changes/at-current-range/insert-text/first-words.js
+++ b/packages/slate/test/changes/at-current-range/insert-text/first-words.js
@@ -7,19 +7,19 @@ export default function (change) {
}
export const input = (
-
+
word
-
+
)
export const output = (
-
+
a few words word
-
+
)
diff --git a/packages/slate/test/changes/at-current-range/insert-text/inside-void.js b/packages/slate/test/changes/at-current-range/insert-text/inside-void.js
index b1dd7a8f6..93946cd19 100644
--- a/packages/slate/test/changes/at-current-range/insert-text/inside-void.js
+++ b/packages/slate/test/changes/at-current-range/insert-text/inside-void.js
@@ -7,21 +7,21 @@ export default function (change) {
}
export const input = (
-
+
-
+
)
export const output = (
-
+
-
+
)
diff --git a/packages/slate/test/changes/at-current-range/insert-text/last-character.js b/packages/slate/test/changes/at-current-range/insert-text/last-character.js
index e0799ee33..96e1770a4 100644
--- a/packages/slate/test/changes/at-current-range/insert-text/last-character.js
+++ b/packages/slate/test/changes/at-current-range/insert-text/last-character.js
@@ -7,21 +7,21 @@ export default function (change) {
}
export const input = (
-
+
word
-
+
)
export const output = (
-
+
worda
-
+
)
diff --git a/packages/slate/test/changes/at-current-range/insert-text/last-space.js b/packages/slate/test/changes/at-current-range/insert-text/last-space.js
index 2074de2bb..2bc9cd903 100644
--- a/packages/slate/test/changes/at-current-range/insert-text/last-space.js
+++ b/packages/slate/test/changes/at-current-range/insert-text/last-space.js
@@ -7,21 +7,21 @@ export default function (change) {
}
export const input = (
-
+
word
-
+
)
export const output = (
-
+
word
-
+
)
diff --git a/packages/slate/test/changes/at-current-range/insert-text/last-words.js b/packages/slate/test/changes/at-current-range/insert-text/last-words.js
index e45a4446e..97374ddfb 100644
--- a/packages/slate/test/changes/at-current-range/insert-text/last-words.js
+++ b/packages/slate/test/changes/at-current-range/insert-text/last-words.js
@@ -7,21 +7,21 @@ export default function (change) {
}
export const input = (
-
+
word
-
+
)
export const output = (
-
+
word a few words
-
+
)
diff --git a/packages/slate/test/changes/at-current-range/insert-text/middle-character.js b/packages/slate/test/changes/at-current-range/insert-text/middle-character.js
index 4235b7321..a3f0ffe47 100644
--- a/packages/slate/test/changes/at-current-range/insert-text/middle-character.js
+++ b/packages/slate/test/changes/at-current-range/insert-text/middle-character.js
@@ -7,21 +7,21 @@ export default function (change) {
}
export const input = (
-
+
w ord
-
+
)
export const output = (
-
+
wa ord
-
+
)
diff --git a/packages/slate/test/changes/at-current-range/insert-text/middle-space.js b/packages/slate/test/changes/at-current-range/insert-text/middle-space.js
index a9db0feaf..cea5b4614 100644
--- a/packages/slate/test/changes/at-current-range/insert-text/middle-space.js
+++ b/packages/slate/test/changes/at-current-range/insert-text/middle-space.js
@@ -7,21 +7,21 @@ export default function (change) {
}
export const input = (
-
+
w ord
-
+
)
export const output = (
-
+
w ord
-
+
)
diff --git a/packages/slate/test/changes/at-current-range/insert-text/middle-words.js b/packages/slate/test/changes/at-current-range/insert-text/middle-words.js
index 9883da6fe..3bd47f8f0 100644
--- a/packages/slate/test/changes/at-current-range/insert-text/middle-words.js
+++ b/packages/slate/test/changes/at-current-range/insert-text/middle-words.js
@@ -7,21 +7,21 @@ export default function (change) {
}
export const input = (
-
+
w ord
-
+
)
export const output = (
-
+
w a few words ord
-
+
)
diff --git a/packages/slate/test/changes/at-current-range/insert-text/with-marks.js b/packages/slate/test/changes/at-current-range/insert-text/with-marks.js
index a3b2586f4..35a47f58e 100644
--- a/packages/slate/test/changes/at-current-range/insert-text/with-marks.js
+++ b/packages/slate/test/changes/at-current-range/insert-text/with-marks.js
@@ -9,21 +9,21 @@ export default function (change) {
}
export const input = (
-
+
word
-
+
)
export const output = (
-
+
worda
-
+
)
diff --git a/packages/slate/test/changes/at-current-range/remove-mark/across-blocks.js b/packages/slate/test/changes/at-current-range/remove-mark/across-blocks.js
index c115cbc95..f7c6e5fed 100644
--- a/packages/slate/test/changes/at-current-range/remove-mark/across-blocks.js
+++ b/packages/slate/test/changes/at-current-range/remove-mark/across-blocks.js
@@ -7,7 +7,7 @@ export default function (change) {
}
export const input = (
-
+
word
@@ -16,11 +16,11 @@ export const input = (
an other
-
+
)
export const output = (
-
+
wo rd
@@ -29,5 +29,5 @@ export const output = (
an other
-
+
)
diff --git a/packages/slate/test/changes/at-current-range/remove-mark/across-inlines.js b/packages/slate/test/changes/at-current-range/remove-mark/across-inlines.js
index 61df19900..84944a353 100644
--- a/packages/slate/test/changes/at-current-range/remove-mark/across-inlines.js
+++ b/packages/slate/test/changes/at-current-range/remove-mark/across-inlines.js
@@ -7,7 +7,7 @@ export default function (change) {
}
export const input = (
-
+
word
@@ -16,11 +16,11 @@ export const input = (
an other
-
+
)
export const output = (
-
+
wo rd
@@ -29,5 +29,5 @@ export const output = (
an other
-
+
)
diff --git a/packages/slate/test/changes/at-current-range/remove-mark/collapsed-selection.js b/packages/slate/test/changes/at-current-range/remove-mark/collapsed-selection.js
index 568959d2b..2fa83fdbd 100644
--- a/packages/slate/test/changes/at-current-range/remove-mark/collapsed-selection.js
+++ b/packages/slate/test/changes/at-current-range/remove-mark/collapsed-selection.js
@@ -10,21 +10,21 @@ export default function (change) {
}
export const input = (
-
+
word
-
+
)
export const output = (
-
+
a word
-
+
)
diff --git a/packages/slate/test/changes/at-current-range/remove-mark/existing-marks.js b/packages/slate/test/changes/at-current-range/remove-mark/existing-marks.js
index 02e4cd66b..f32d5536e 100644
--- a/packages/slate/test/changes/at-current-range/remove-mark/existing-marks.js
+++ b/packages/slate/test/changes/at-current-range/remove-mark/existing-marks.js
@@ -7,21 +7,21 @@ export default function (change) {
}
export const input = (
-
+
wo rd
-
+
)
export const output = (
-
+
wo rd
-
+
)
diff --git a/packages/slate/test/changes/at-current-range/remove-mark/first-character.js b/packages/slate/test/changes/at-current-range/remove-mark/first-character.js
index c05ba6926..f91c1b343 100644
--- a/packages/slate/test/changes/at-current-range/remove-mark/first-character.js
+++ b/packages/slate/test/changes/at-current-range/remove-mark/first-character.js
@@ -7,21 +7,21 @@ export default function (change) {
}
export const input = (
-
+
w ord
-
+
)
export const output = (
-
+
w ord
-
+
)
diff --git a/packages/slate/test/changes/at-current-range/remove-mark/last-character.js b/packages/slate/test/changes/at-current-range/remove-mark/last-character.js
index b8e0cf1e6..a6f28891c 100644
--- a/packages/slate/test/changes/at-current-range/remove-mark/last-character.js
+++ b/packages/slate/test/changes/at-current-range/remove-mark/last-character.js
@@ -7,21 +7,21 @@ export default function (change) {
}
export const input = (
-
+
word
-
+
)
export const output = (
-
+
wor d
-
+
)
diff --git a/packages/slate/test/changes/at-current-range/remove-mark/middle-character.js b/packages/slate/test/changes/at-current-range/remove-mark/middle-character.js
index 76fa4ca12..5dffa8f4a 100644
--- a/packages/slate/test/changes/at-current-range/remove-mark/middle-character.js
+++ b/packages/slate/test/changes/at-current-range/remove-mark/middle-character.js
@@ -7,21 +7,21 @@ export default function (change) {
}
export const input = (
-
+
wo rd
-
+
)
export const output = (
-
+
w o rd
-
+
)
diff --git a/packages/slate/test/changes/at-current-range/remove-mark/whole-word.js b/packages/slate/test/changes/at-current-range/remove-mark/whole-word.js
index dab17f230..8466e8d45 100644
--- a/packages/slate/test/changes/at-current-range/remove-mark/whole-word.js
+++ b/packages/slate/test/changes/at-current-range/remove-mark/whole-word.js
@@ -7,21 +7,21 @@ export default function (change) {
}
export const input = (
-
+
word
-
+
)
export const output = (
-
+
word
-
+
)
diff --git a/packages/slate/test/changes/at-current-range/remove-mark/with-mark-object.js b/packages/slate/test/changes/at-current-range/remove-mark/with-mark-object.js
index a5d7ee403..e18e9ed31 100644
--- a/packages/slate/test/changes/at-current-range/remove-mark/with-mark-object.js
+++ b/packages/slate/test/changes/at-current-range/remove-mark/with-mark-object.js
@@ -11,21 +11,21 @@ export default function (change) {
}
export const input = (
-
+
w ord
-
+
)
export const output = (
-
+
w ord
-
+
)
diff --git a/packages/slate/test/changes/at-current-range/remove-mark/with-plain-object.js b/packages/slate/test/changes/at-current-range/remove-mark/with-plain-object.js
index 239eca464..3eed5ab75 100644
--- a/packages/slate/test/changes/at-current-range/remove-mark/with-plain-object.js
+++ b/packages/slate/test/changes/at-current-range/remove-mark/with-plain-object.js
@@ -10,21 +10,21 @@ export default function (change) {
}
export const input = (
-
+
w ord
-
+
)
export const output = (
-
+
w ord
-
+
)
diff --git a/packages/slate/test/changes/at-current-range/set-block/across-blocks.js b/packages/slate/test/changes/at-current-range/set-block/across-blocks.js
index 510067b6c..ccd718f6d 100644
--- a/packages/slate/test/changes/at-current-range/set-block/across-blocks.js
+++ b/packages/slate/test/changes/at-current-range/set-block/across-blocks.js
@@ -7,7 +7,7 @@ export default function (change) {
}
export const input = (
-
+
word
@@ -16,11 +16,11 @@ export const input = (
another
-
+
)
export const output = (
-
+
word
@@ -29,5 +29,5 @@ export const output = (
another
-
+
)
diff --git a/packages/slate/test/changes/at-current-range/set-block/across-inlines.js b/packages/slate/test/changes/at-current-range/set-block/across-inlines.js
index 75c94c05e..8e74535bd 100644
--- a/packages/slate/test/changes/at-current-range/set-block/across-inlines.js
+++ b/packages/slate/test/changes/at-current-range/set-block/across-inlines.js
@@ -7,7 +7,7 @@ export default function (change) {
}
export const input = (
-
+
word
@@ -16,11 +16,11 @@ export const input = (
another
-
+
)
export const output = (
-
+
word
@@ -29,5 +29,5 @@ export const output = (
another
-
+
)
diff --git a/packages/slate/test/changes/at-current-range/set-block/data-only.js b/packages/slate/test/changes/at-current-range/set-block/data-only.js
index 6e75b28c6..34f5972da 100644
--- a/packages/slate/test/changes/at-current-range/set-block/data-only.js
+++ b/packages/slate/test/changes/at-current-range/set-block/data-only.js
@@ -10,21 +10,21 @@ export default function (change) {
}
export const input = (
-
+
word
-
+
)
export const output = (
-
+
word
-
+
)
diff --git a/packages/slate/test/changes/at-current-range/set-block/nested-block.js b/packages/slate/test/changes/at-current-range/set-block/nested-block.js
index ce276074f..bd9b5274f 100644
--- a/packages/slate/test/changes/at-current-range/set-block/nested-block.js
+++ b/packages/slate/test/changes/at-current-range/set-block/nested-block.js
@@ -7,7 +7,7 @@ export default function (change) {
}
export const input = (
-
+
@@ -15,11 +15,11 @@ export const input = (
-
+
)
export const output = (
-
+
@@ -27,5 +27,5 @@ export const output = (
-
+
)
diff --git a/packages/slate/test/changes/at-current-range/set-block/single-block-string-shorthand.js b/packages/slate/test/changes/at-current-range/set-block/single-block-string-shorthand.js
index ba00b5309..bef060241 100644
--- a/packages/slate/test/changes/at-current-range/set-block/single-block-string-shorthand.js
+++ b/packages/slate/test/changes/at-current-range/set-block/single-block-string-shorthand.js
@@ -7,21 +7,21 @@ export default function (change) {
}
export const input = (
-
+
word
-
+
)
export const output = (
-
+
word
-
+
)
diff --git a/packages/slate/test/changes/at-current-range/set-block/single-block.js b/packages/slate/test/changes/at-current-range/set-block/single-block.js
index 1d8a3bce8..10eca9933 100644
--- a/packages/slate/test/changes/at-current-range/set-block/single-block.js
+++ b/packages/slate/test/changes/at-current-range/set-block/single-block.js
@@ -7,21 +7,21 @@ export default function (change) {
}
export const input = (
-
+
word
-
+
)
export const output = (
-
+
word
-
+
)
diff --git a/packages/slate/test/changes/at-current-range/set-block/with-data-as-map.js b/packages/slate/test/changes/at-current-range/set-block/with-data-as-map.js
index 711ec572d..9decbbf5d 100644
--- a/packages/slate/test/changes/at-current-range/set-block/with-data-as-map.js
+++ b/packages/slate/test/changes/at-current-range/set-block/with-data-as-map.js
@@ -11,21 +11,21 @@ export default function (change) {
}
export const input = (
-
+
word
-
+
)
export const output = (
-
+
word
-
+
)
diff --git a/packages/slate/test/changes/at-current-range/set-block/with-data-as-object.js b/packages/slate/test/changes/at-current-range/set-block/with-data-as-object.js
index ccc45105f..c087617fb 100644
--- a/packages/slate/test/changes/at-current-range/set-block/with-data-as-object.js
+++ b/packages/slate/test/changes/at-current-range/set-block/with-data-as-object.js
@@ -10,21 +10,21 @@ export default function (change) {
}
export const input = (
-
+
word
-
+
)
export const output = (
-
+
word
-
+
)
diff --git a/packages/slate/test/changes/at-current-range/set-block/with-is-void.js b/packages/slate/test/changes/at-current-range/set-block/with-is-void.js
index bb19b3507..5acf294a0 100644
--- a/packages/slate/test/changes/at-current-range/set-block/with-is-void.js
+++ b/packages/slate/test/changes/at-current-range/set-block/with-is-void.js
@@ -10,21 +10,21 @@ export default function (change) {
}
export const input = (
-
+
word
-
+
)
export const output = (
-
+
{' '}
-
+
)
diff --git a/packages/slate/test/changes/at-current-range/set-inline/across-inlines.js b/packages/slate/test/changes/at-current-range/set-inline/across-inlines.js
index bec7c4bf4..92c90ac05 100644
--- a/packages/slate/test/changes/at-current-range/set-inline/across-inlines.js
+++ b/packages/slate/test/changes/at-current-range/set-inline/across-inlines.js
@@ -7,7 +7,7 @@ export default function (change) {
}
export const input = (
-
+
word
@@ -16,11 +16,11 @@ export const input = (
another
-
+
)
export const output = (
-
+
word
@@ -29,5 +29,5 @@ export const output = (
another
-
+
)
diff --git a/packages/slate/test/changes/at-current-range/set-inline/data-only.js b/packages/slate/test/changes/at-current-range/set-inline/data-only.js
index bd16d8531..2bf693b91 100644
--- a/packages/slate/test/changes/at-current-range/set-inline/data-only.js
+++ b/packages/slate/test/changes/at-current-range/set-inline/data-only.js
@@ -8,21 +8,21 @@ export default function (change) {
}
export const input = (
-
+
word
-
+
)
export const output = (
-
+
word
-
+
)
diff --git a/packages/slate/test/changes/at-current-range/set-inline/nested-inline.js b/packages/slate/test/changes/at-current-range/set-inline/nested-inline.js
index 0ad04db5d..5353f71e0 100644
--- a/packages/slate/test/changes/at-current-range/set-inline/nested-inline.js
+++ b/packages/slate/test/changes/at-current-range/set-inline/nested-inline.js
@@ -7,7 +7,7 @@ export default function (change) {
}
export const input = (
-
+
@@ -15,11 +15,11 @@ export const input = (
-
+
)
export const output = (
-
+
@@ -27,5 +27,5 @@ export const output = (
-
+
)
diff --git a/packages/slate/test/changes/at-current-range/set-inline/single-inline-string-shorthand.js b/packages/slate/test/changes/at-current-range/set-inline/single-inline-string-shorthand.js
index d9c41d0dd..6c07514d0 100644
--- a/packages/slate/test/changes/at-current-range/set-inline/single-inline-string-shorthand.js
+++ b/packages/slate/test/changes/at-current-range/set-inline/single-inline-string-shorthand.js
@@ -7,21 +7,21 @@ export default function (change) {
}
export const input = (
-
+
word
-
+
)
export const output = (
-
+
word
-
+
)
diff --git a/packages/slate/test/changes/at-current-range/set-inline/single-inline.js b/packages/slate/test/changes/at-current-range/set-inline/single-inline.js
index 7f8e17c6e..2c9163c83 100644
--- a/packages/slate/test/changes/at-current-range/set-inline/single-inline.js
+++ b/packages/slate/test/changes/at-current-range/set-inline/single-inline.js
@@ -7,21 +7,21 @@ export default function (change) {
}
export const input = (
-
+
word
-
+
)
export const output = (
-
+
word
-
+
)
diff --git a/packages/slate/test/changes/at-current-range/set-inline/with-data-object.js b/packages/slate/test/changes/at-current-range/set-inline/with-data-object.js
index 811b24524..44c3de3c9 100644
--- a/packages/slate/test/changes/at-current-range/set-inline/with-data-object.js
+++ b/packages/slate/test/changes/at-current-range/set-inline/with-data-object.js
@@ -10,21 +10,21 @@ export default function (change) {
}
export const input = (
-
+
word
-
+
)
export const output = (
-
+
word
-
+
)
diff --git a/packages/slate/test/changes/at-current-range/set-inline/with-data.js b/packages/slate/test/changes/at-current-range/set-inline/with-data.js
index a47cd0a6d..0a41236fb 100644
--- a/packages/slate/test/changes/at-current-range/set-inline/with-data.js
+++ b/packages/slate/test/changes/at-current-range/set-inline/with-data.js
@@ -11,21 +11,21 @@ export default function (change) {
}
export const input = (
-
+
word
-
+
)
export const output = (
-
+
word
-
+
)
diff --git a/packages/slate/test/changes/at-current-range/set-inline/with-is-void.js b/packages/slate/test/changes/at-current-range/set-inline/with-is-void.js
index 806f57c93..912fb8366 100644
--- a/packages/slate/test/changes/at-current-range/set-inline/with-is-void.js
+++ b/packages/slate/test/changes/at-current-range/set-inline/with-is-void.js
@@ -10,22 +10,22 @@ export default function (change) {
}
export const input = (
-
+
word
-
+
)
// TODO: fix cursor placement
export const output = (
-
+
{' '}
-
+
)
diff --git a/packages/slate/test/changes/at-current-range/split-block/after-inline-void.js b/packages/slate/test/changes/at-current-range/split-block/after-inline-void.js
index 695bc0a01..1aa9b8098 100644
--- a/packages/slate/test/changes/at-current-range/split-block/after-inline-void.js
+++ b/packages/slate/test/changes/at-current-range/split-block/after-inline-void.js
@@ -7,17 +7,17 @@ export default function (change) {
}
export const input = (
-
+
one two
-
+
)
export const output = (
-
+
one
@@ -26,5 +26,5 @@ export const output = (
two
-
+
)
diff --git a/packages/slate/test/changes/at-current-range/split-block/after-inline.js b/packages/slate/test/changes/at-current-range/split-block/after-inline.js
index a03152c64..8aae8e4ad 100644
--- a/packages/slate/test/changes/at-current-range/split-block/after-inline.js
+++ b/packages/slate/test/changes/at-current-range/split-block/after-inline.js
@@ -7,17 +7,17 @@ export default function (change) {
}
export const input = (
-
+
word hyperlink word
-
+
)
export const output = (
-
+
word hyperlink
@@ -26,5 +26,5 @@ export const output = (
word
-
+
)
diff --git a/packages/slate/test/changes/at-current-range/split-block/before-inline.js b/packages/slate/test/changes/at-current-range/split-block/before-inline.js
index b89745f27..baacba20c 100644
--- a/packages/slate/test/changes/at-current-range/split-block/before-inline.js
+++ b/packages/slate/test/changes/at-current-range/split-block/before-inline.js
@@ -7,17 +7,17 @@ export default function (change) {
}
export const input = (
-
+
word hyperlinkword
-
+
)
export const output = (
-
+
word
@@ -26,5 +26,5 @@ export const output = (
hyperlinkword
-
+
)
diff --git a/packages/slate/test/changes/at-current-range/split-block/block-end.js b/packages/slate/test/changes/at-current-range/split-block/block-end.js
index 400e3dae4..9aad74825 100644
--- a/packages/slate/test/changes/at-current-range/split-block/block-end.js
+++ b/packages/slate/test/changes/at-current-range/split-block/block-end.js
@@ -7,7 +7,7 @@ export default function (change) {
}
export const input = (
-
+
word
@@ -16,11 +16,11 @@ export const input = (
another
-
+
)
export const output = (
-
+
word
@@ -32,5 +32,5 @@ export const output = (
another
-
+
)
diff --git a/packages/slate/test/changes/at-current-range/split-block/block-middle.js b/packages/slate/test/changes/at-current-range/split-block/block-middle.js
index f1b467992..40597bff8 100644
--- a/packages/slate/test/changes/at-current-range/split-block/block-middle.js
+++ b/packages/slate/test/changes/at-current-range/split-block/block-middle.js
@@ -7,17 +7,17 @@ export default function (change) {
}
export const input = (
-
+
wo rd
-
+
)
export const output = (
-
+
wo
@@ -26,5 +26,5 @@ export const output = (
rd
-
+
)
diff --git a/packages/slate/test/changes/at-current-range/split-block/block-start.js b/packages/slate/test/changes/at-current-range/split-block/block-start.js
index c5775358e..c5d42d617 100644
--- a/packages/slate/test/changes/at-current-range/split-block/block-start.js
+++ b/packages/slate/test/changes/at-current-range/split-block/block-start.js
@@ -7,7 +7,7 @@ export default function (change) {
}
export const input = (
-
+
word
@@ -16,11 +16,11 @@ export const input = (
another
-
+
)
export const output = (
-
+
word
@@ -30,5 +30,5 @@ export const output = (
another
-
+
)
diff --git a/packages/slate/test/changes/at-current-range/split-block/depth.js b/packages/slate/test/changes/at-current-range/split-block/depth.js
index a6444eb40..d62c89b82 100644
--- a/packages/slate/test/changes/at-current-range/split-block/depth.js
+++ b/packages/slate/test/changes/at-current-range/split-block/depth.js
@@ -7,7 +7,7 @@ export default function (change) {
}
export const input = (
-
+
@@ -15,11 +15,11 @@ export const input = (
-
+
)
export const output = (
-
+
@@ -32,5 +32,5 @@ export const output = (
-
+
)
diff --git a/packages/slate/test/changes/at-current-range/split-block/with-delete-across-blocks-and-inlines.js b/packages/slate/test/changes/at-current-range/split-block/with-delete-across-blocks-and-inlines.js
index 8348852a8..f8a86b6e7 100644
--- a/packages/slate/test/changes/at-current-range/split-block/with-delete-across-blocks-and-inlines.js
+++ b/packages/slate/test/changes/at-current-range/split-block/with-delete-across-blocks-and-inlines.js
@@ -7,7 +7,7 @@ export default function (change) {
}
export const input = (
-
+
wo rd
@@ -16,11 +16,11 @@ export const input = (
an other
-
+
)
export const output = (
-
+
wo
@@ -29,5 +29,5 @@ export const output = (
other
-
+
)
diff --git a/packages/slate/test/changes/at-current-range/split-block/with-delete-across-blocks.js b/packages/slate/test/changes/at-current-range/split-block/with-delete-across-blocks.js
index ba1b27c04..7c061ab58 100644
--- a/packages/slate/test/changes/at-current-range/split-block/with-delete-across-blocks.js
+++ b/packages/slate/test/changes/at-current-range/split-block/with-delete-across-blocks.js
@@ -7,19 +7,19 @@ export default function (change) {
}
export const input = (
-
+
wo rd
an other
-
+
)
export const output = (
-
+
wo
other
-
+
)
diff --git a/packages/slate/test/changes/at-current-range/split-block/with-delete.js b/packages/slate/test/changes/at-current-range/split-block/with-delete.js
index d4fb7f510..36e4232bd 100644
--- a/packages/slate/test/changes/at-current-range/split-block/with-delete.js
+++ b/packages/slate/test/changes/at-current-range/split-block/with-delete.js
@@ -7,18 +7,18 @@ export default function (change) {
}
export const input = (
-
+
w or d
-
+
)
export const output = (
-
+
w
d
-
+
)
diff --git a/packages/slate/test/changes/at-current-range/split-block/with-inline.js b/packages/slate/test/changes/at-current-range/split-block/with-inline.js
index d7ef5c08f..2a1d18a7d 100644
--- a/packages/slate/test/changes/at-current-range/split-block/with-inline.js
+++ b/packages/slate/test/changes/at-current-range/split-block/with-inline.js
@@ -7,17 +7,17 @@ export default function (change) {
}
export const input = (
-
+
wo rd
-
+
)
export const output = (
-
+
wo
@@ -26,5 +26,5 @@ export const output = (
rd
-
+
)
diff --git a/packages/slate/test/changes/at-current-range/split-inline/block-end.js b/packages/slate/test/changes/at-current-range/split-inline/block-end.js
index da76188a1..28bae6fd9 100644
--- a/packages/slate/test/changes/at-current-range/split-inline/block-end.js
+++ b/packages/slate/test/changes/at-current-range/split-inline/block-end.js
@@ -7,21 +7,21 @@ export default function (change) {
}
export const input = (
-
+
word
-
+
)
export const output = (
-
+
word
-
+
)
diff --git a/packages/slate/test/changes/at-current-range/split-inline/block-middle.js b/packages/slate/test/changes/at-current-range/split-inline/block-middle.js
index 0251049c5..5a8ff3fe5 100644
--- a/packages/slate/test/changes/at-current-range/split-inline/block-middle.js
+++ b/packages/slate/test/changes/at-current-range/split-inline/block-middle.js
@@ -7,21 +7,21 @@ export default function (change) {
}
export const input = (
-
+
wo rd
-
+
)
export const output = (
-
+
wo rd
-
+
)
diff --git a/packages/slate/test/changes/at-current-range/split-inline/block-start.js b/packages/slate/test/changes/at-current-range/split-inline/block-start.js
index ec89ab5ef..79a2308fe 100644
--- a/packages/slate/test/changes/at-current-range/split-inline/block-start.js
+++ b/packages/slate/test/changes/at-current-range/split-inline/block-start.js
@@ -7,21 +7,21 @@ export default function (change) {
}
export const input = (
-
+
word
-
+
)
export const output = (
-
+
word
-
+
)
diff --git a/packages/slate/test/changes/at-current-range/split-inline/depth.js b/packages/slate/test/changes/at-current-range/split-inline/depth.js
index 707288941..f019f74d3 100644
--- a/packages/slate/test/changes/at-current-range/split-inline/depth.js
+++ b/packages/slate/test/changes/at-current-range/split-inline/depth.js
@@ -7,21 +7,21 @@ export default function (change) {
}
export const input = (
-
+
wo rd
-
+
)
export const output = (
-
+
wo rd
-
+
)
diff --git a/packages/slate/test/changes/at-current-range/split-inline/with-delete.js b/packages/slate/test/changes/at-current-range/split-inline/with-delete.js
index 9aa94303d..208fe9675 100644
--- a/packages/slate/test/changes/at-current-range/split-inline/with-delete.js
+++ b/packages/slate/test/changes/at-current-range/split-inline/with-delete.js
@@ -7,21 +7,21 @@ export default function (change) {
}
export const input = (
-
+
w or d
-
+
)
export const output = (
-
+
w d
-
+
)
diff --git a/packages/slate/test/changes/at-current-range/split-inline/with-marks.js b/packages/slate/test/changes/at-current-range/split-inline/with-marks.js
index bb8e72423..794865a10 100644
--- a/packages/slate/test/changes/at-current-range/split-inline/with-marks.js
+++ b/packages/slate/test/changes/at-current-range/split-inline/with-marks.js
@@ -7,21 +7,21 @@ export default function (change) {
}
export const input = (
-
+
wo rd
-
+
)
export const output = (
-
+
wo rd
-
+
)
diff --git a/packages/slate/test/changes/at-current-range/toggle-mark/add-across-blocks.js b/packages/slate/test/changes/at-current-range/toggle-mark/add-across-blocks.js
index 082150d70..e16bd38d5 100644
--- a/packages/slate/test/changes/at-current-range/toggle-mark/add-across-blocks.js
+++ b/packages/slate/test/changes/at-current-range/toggle-mark/add-across-blocks.js
@@ -7,7 +7,7 @@ export default function (change) {
}
export const input = (
-
+
wo rd
@@ -16,11 +16,11 @@ export const input = (
an other
-
+
)
export const output = (
-
+
word
@@ -29,5 +29,5 @@ export const output = (
an other
-
+
)
diff --git a/packages/slate/test/changes/at-current-range/toggle-mark/add-across-inlines.js b/packages/slate/test/changes/at-current-range/toggle-mark/add-across-inlines.js
index a2087ff04..32464b636 100644
--- a/packages/slate/test/changes/at-current-range/toggle-mark/add-across-inlines.js
+++ b/packages/slate/test/changes/at-current-range/toggle-mark/add-across-inlines.js
@@ -7,7 +7,7 @@ export default function (change) {
}
export const input = (
-
+
wo rd
@@ -16,11 +16,11 @@ export const input = (
an other
-
+
)
export const output = (
-
+
word
@@ -31,5 +31,5 @@ export const output = (
-
+
)
diff --git a/packages/slate/test/changes/at-current-range/toggle-mark/add-collapsed-selection-beginning.js b/packages/slate/test/changes/at-current-range/toggle-mark/add-collapsed-selection-beginning.js
index 1cf06afd6..d3346c866 100644
--- a/packages/slate/test/changes/at-current-range/toggle-mark/add-collapsed-selection-beginning.js
+++ b/packages/slate/test/changes/at-current-range/toggle-mark/add-collapsed-selection-beginning.js
@@ -9,21 +9,21 @@ export default function (change) {
}
export const input = (
-
+
word
-
+
)
export const output = (
-
+
a word
-
+
)
diff --git a/packages/slate/test/changes/at-current-range/toggle-mark/add-collapsed-selection.js b/packages/slate/test/changes/at-current-range/toggle-mark/add-collapsed-selection.js
index 21ef38653..1e95ccea6 100644
--- a/packages/slate/test/changes/at-current-range/toggle-mark/add-collapsed-selection.js
+++ b/packages/slate/test/changes/at-current-range/toggle-mark/add-collapsed-selection.js
@@ -9,21 +9,21 @@ export default function (change) {
}
export const input = (
-
+
word
-
+
)
export const output = (
-
+
words
-
+
)
diff --git a/packages/slate/test/changes/at-current-range/toggle-mark/add-existing-marks-partially-marked.js b/packages/slate/test/changes/at-current-range/toggle-mark/add-existing-marks-partially-marked.js
index 7675c1280..810257fc1 100644
--- a/packages/slate/test/changes/at-current-range/toggle-mark/add-existing-marks-partially-marked.js
+++ b/packages/slate/test/changes/at-current-range/toggle-mark/add-existing-marks-partially-marked.js
@@ -7,21 +7,21 @@ export default function (change) {
}
export const input = (
-
+
a wo rd
-
+
)
export const output = (
-
+
awo rd
-
+
)
diff --git a/packages/slate/test/changes/at-current-range/toggle-mark/add-existing-marks.js b/packages/slate/test/changes/at-current-range/toggle-mark/add-existing-marks.js
index 330019292..725f383d1 100644
--- a/packages/slate/test/changes/at-current-range/toggle-mark/add-existing-marks.js
+++ b/packages/slate/test/changes/at-current-range/toggle-mark/add-existing-marks.js
@@ -7,21 +7,21 @@ export default function (change) {
}
export const input = (
-
+
wo rd
-
+
)
export const output = (
-
+
wo rd
-
+
)
diff --git a/packages/slate/test/changes/at-current-range/toggle-mark/add-first-character.js b/packages/slate/test/changes/at-current-range/toggle-mark/add-first-character.js
index c5ca60750..9f16f7123 100644
--- a/packages/slate/test/changes/at-current-range/toggle-mark/add-first-character.js
+++ b/packages/slate/test/changes/at-current-range/toggle-mark/add-first-character.js
@@ -7,21 +7,21 @@ export default function (change) {
}
export const input = (
-
+
w ord
-
+
)
export const output = (
-
+
w ord
-
+
)
diff --git a/packages/slate/test/changes/at-current-range/toggle-mark/add-last-character.js b/packages/slate/test/changes/at-current-range/toggle-mark/add-last-character.js
index 4f403014b..5ba5aefb3 100644
--- a/packages/slate/test/changes/at-current-range/toggle-mark/add-last-character.js
+++ b/packages/slate/test/changes/at-current-range/toggle-mark/add-last-character.js
@@ -7,21 +7,21 @@ export default function (change) {
}
export const input = (
-
+
wor d
-
+
)
export const output = (
-
+
word
-
+
)
diff --git a/packages/slate/test/changes/at-current-range/toggle-mark/add-middle-character.js b/packages/slate/test/changes/at-current-range/toggle-mark/add-middle-character.js
index 5ab4a5488..4d08d59bb 100644
--- a/packages/slate/test/changes/at-current-range/toggle-mark/add-middle-character.js
+++ b/packages/slate/test/changes/at-current-range/toggle-mark/add-middle-character.js
@@ -7,21 +7,21 @@ export default function (change) {
}
export const input = (
-
+
w o rd
-
+
)
export const output = (
-
+
wo rd
-
+
)
diff --git a/packages/slate/test/changes/at-current-range/toggle-mark/add-partially-marked.js b/packages/slate/test/changes/at-current-range/toggle-mark/add-partially-marked.js
index f0f28e402..2d6c5624f 100644
--- a/packages/slate/test/changes/at-current-range/toggle-mark/add-partially-marked.js
+++ b/packages/slate/test/changes/at-current-range/toggle-mark/add-partially-marked.js
@@ -7,21 +7,21 @@ export default function (change) {
}
export const input = (
-
+
aword
-
+
)
export const output = (
-
+
aword
-
+
)
diff --git a/packages/slate/test/changes/at-current-range/toggle-mark/add-whole-word.js b/packages/slate/test/changes/at-current-range/toggle-mark/add-whole-word.js
index 30c8e667a..c588c217f 100644
--- a/packages/slate/test/changes/at-current-range/toggle-mark/add-whole-word.js
+++ b/packages/slate/test/changes/at-current-range/toggle-mark/add-whole-word.js
@@ -7,21 +7,21 @@ export default function (change) {
}
export const input = (
-
+
word
-
+
)
export const output = (
-
+
word
-
+
)
diff --git a/packages/slate/test/changes/at-current-range/toggle-mark/add-with-mark-object.js b/packages/slate/test/changes/at-current-range/toggle-mark/add-with-mark-object.js
index bcd7fe940..4135fb288 100644
--- a/packages/slate/test/changes/at-current-range/toggle-mark/add-with-mark-object.js
+++ b/packages/slate/test/changes/at-current-range/toggle-mark/add-with-mark-object.js
@@ -11,21 +11,21 @@ export default function (change) {
}
export const input = (
-
+
w ord
-
+
)
export const output = (
-
+
w ord
-
+
)
diff --git a/packages/slate/test/changes/at-current-range/toggle-mark/add-with-plain-object.js b/packages/slate/test/changes/at-current-range/toggle-mark/add-with-plain-object.js
index 6ccebd392..f8f1d41c3 100644
--- a/packages/slate/test/changes/at-current-range/toggle-mark/add-with-plain-object.js
+++ b/packages/slate/test/changes/at-current-range/toggle-mark/add-with-plain-object.js
@@ -10,21 +10,21 @@ export default function (change) {
}
export const input = (
-
+
w ord
-
+
)
export const output = (
-
+
w ord
-
+
)
diff --git a/packages/slate/test/changes/at-current-range/toggle-mark/remove-across-blocks.js b/packages/slate/test/changes/at-current-range/toggle-mark/remove-across-blocks.js
index cca38656e..49d790969 100644
--- a/packages/slate/test/changes/at-current-range/toggle-mark/remove-across-blocks.js
+++ b/packages/slate/test/changes/at-current-range/toggle-mark/remove-across-blocks.js
@@ -7,7 +7,7 @@ export default function (change) {
}
export const input = (
-
+
word
@@ -16,11 +16,11 @@ export const input = (
an other
-
+
)
export const output = (
-
+
wo rd
@@ -29,5 +29,5 @@ export const output = (
an other
-
+
)
diff --git a/packages/slate/test/changes/at-current-range/toggle-mark/remove-across-inlines.js b/packages/slate/test/changes/at-current-range/toggle-mark/remove-across-inlines.js
index 222188393..ecb63424a 100644
--- a/packages/slate/test/changes/at-current-range/toggle-mark/remove-across-inlines.js
+++ b/packages/slate/test/changes/at-current-range/toggle-mark/remove-across-inlines.js
@@ -7,7 +7,7 @@ export default function (change) {
}
export const input = (
-
+
wo rd
@@ -16,11 +16,11 @@ export const input = (
an other
-
+
)
export const output = (
-
+
wo rd
@@ -29,5 +29,5 @@ export const output = (
an other
-
+
)
diff --git a/packages/slate/test/changes/at-current-range/toggle-mark/remove-collapsed-selection-beginning.js b/packages/slate/test/changes/at-current-range/toggle-mark/remove-collapsed-selection-beginning.js
index 6c29fe3a5..1767a558a 100644
--- a/packages/slate/test/changes/at-current-range/toggle-mark/remove-collapsed-selection-beginning.js
+++ b/packages/slate/test/changes/at-current-range/toggle-mark/remove-collapsed-selection-beginning.js
@@ -10,21 +10,21 @@ export default function (change) {
}
export const input = (
-
+
word
-
+
)
export const output = (
-
+
a word
-
+
)
diff --git a/packages/slate/test/changes/at-current-range/toggle-mark/remove-collapsed-selection.js b/packages/slate/test/changes/at-current-range/toggle-mark/remove-collapsed-selection.js
index 4998a918a..c55f7a572 100644
--- a/packages/slate/test/changes/at-current-range/toggle-mark/remove-collapsed-selection.js
+++ b/packages/slate/test/changes/at-current-range/toggle-mark/remove-collapsed-selection.js
@@ -10,21 +10,21 @@ export default function (change) {
}
export const input = (
-
+
word
-
+
)
export const output = (
-
+
words
-
+
)
diff --git a/packages/slate/test/changes/at-current-range/toggle-mark/remove-existing-marks.js b/packages/slate/test/changes/at-current-range/toggle-mark/remove-existing-marks.js
index 12a8ab1e7..b97bf3d73 100644
--- a/packages/slate/test/changes/at-current-range/toggle-mark/remove-existing-marks.js
+++ b/packages/slate/test/changes/at-current-range/toggle-mark/remove-existing-marks.js
@@ -7,21 +7,21 @@ export default function (change) {
}
export const input = (
-
+
wo rd
-
+
)
export const output = (
-
+
wo rd
-
+
)
diff --git a/packages/slate/test/changes/at-current-range/toggle-mark/remove-first-character.js b/packages/slate/test/changes/at-current-range/toggle-mark/remove-first-character.js
index 6066d3f85..c10cf3965 100644
--- a/packages/slate/test/changes/at-current-range/toggle-mark/remove-first-character.js
+++ b/packages/slate/test/changes/at-current-range/toggle-mark/remove-first-character.js
@@ -7,21 +7,21 @@ export default function (change) {
}
export const input = (
-
+
w ord
-
+
)
export const output = (
-
+
w ord
-
+
)
diff --git a/packages/slate/test/changes/at-current-range/toggle-mark/remove-last-character.js b/packages/slate/test/changes/at-current-range/toggle-mark/remove-last-character.js
index dfab1cde6..233d62e4c 100644
--- a/packages/slate/test/changes/at-current-range/toggle-mark/remove-last-character.js
+++ b/packages/slate/test/changes/at-current-range/toggle-mark/remove-last-character.js
@@ -7,21 +7,21 @@ export default function (change) {
}
export const input = (
-
+
word
-
+
)
export const output = (
-
+
wor d
-
+
)
diff --git a/packages/slate/test/changes/at-current-range/toggle-mark/remove-middle-character.js b/packages/slate/test/changes/at-current-range/toggle-mark/remove-middle-character.js
index b796b68f6..ac49b5fb1 100644
--- a/packages/slate/test/changes/at-current-range/toggle-mark/remove-middle-character.js
+++ b/packages/slate/test/changes/at-current-range/toggle-mark/remove-middle-character.js
@@ -7,21 +7,21 @@ export default function (change) {
}
export const input = (
-
+
wo rd
-
+
)
export const output = (
-
+
w o rd
-
+
)
diff --git a/packages/slate/test/changes/at-current-range/toggle-mark/remove-whole-word.js b/packages/slate/test/changes/at-current-range/toggle-mark/remove-whole-word.js
index 0a1e0eb46..bf06d4d3a 100644
--- a/packages/slate/test/changes/at-current-range/toggle-mark/remove-whole-word.js
+++ b/packages/slate/test/changes/at-current-range/toggle-mark/remove-whole-word.js
@@ -7,21 +7,21 @@ export default function (change) {
}
export const input = (
-
+
word
-
+
)
export const output = (
-
+
word
-
+
)
diff --git a/packages/slate/test/changes/at-current-range/toggle-mark/remove-with-mark-object.js b/packages/slate/test/changes/at-current-range/toggle-mark/remove-with-mark-object.js
index 23cbc9db1..2ba731cd5 100644
--- a/packages/slate/test/changes/at-current-range/toggle-mark/remove-with-mark-object.js
+++ b/packages/slate/test/changes/at-current-range/toggle-mark/remove-with-mark-object.js
@@ -11,21 +11,21 @@ export default function (change) {
}
export const input = (
-
+
w ord
-
+
)
export const output = (
-
+
w ord
-
+
)
diff --git a/packages/slate/test/changes/at-current-range/toggle-mark/remove-with-plain-object.js b/packages/slate/test/changes/at-current-range/toggle-mark/remove-with-plain-object.js
index f43c08da3..af5865a08 100644
--- a/packages/slate/test/changes/at-current-range/toggle-mark/remove-with-plain-object.js
+++ b/packages/slate/test/changes/at-current-range/toggle-mark/remove-with-plain-object.js
@@ -10,21 +10,21 @@ export default function (change) {
}
export const input = (
-
+
w ord
-
+
)
export const output = (
-
+
w ord
-
+
)
diff --git a/packages/slate/test/changes/at-current-range/unwrap-block/across-blocks.js b/packages/slate/test/changes/at-current-range/unwrap-block/across-blocks.js
index 4e3e915bd..f2be8c3ac 100644
--- a/packages/slate/test/changes/at-current-range/unwrap-block/across-blocks.js
+++ b/packages/slate/test/changes/at-current-range/unwrap-block/across-blocks.js
@@ -7,7 +7,7 @@ export default function (change) {
}
export const input = (
-
+
@@ -18,11 +18,11 @@ export const input = (
-
+
)
export const output = (
-
+
wo rd
@@ -31,5 +31,5 @@ export const output = (
an other
-
+
)
diff --git a/packages/slate/test/changes/at-current-range/unwrap-block/across-inlines.js b/packages/slate/test/changes/at-current-range/unwrap-block/across-inlines.js
index 62e5b6fe5..c87e53b17 100644
--- a/packages/slate/test/changes/at-current-range/unwrap-block/across-inlines.js
+++ b/packages/slate/test/changes/at-current-range/unwrap-block/across-inlines.js
@@ -7,7 +7,7 @@ export default function (change) {
}
export const input = (
-
+
@@ -18,11 +18,11 @@ export const input = (
-
+
)
export const output = (
-
+
wo rd
@@ -31,5 +31,5 @@ export const output = (
an other
-
+
)
diff --git a/packages/slate/test/changes/at-current-range/unwrap-block/ending-child-blocks.js b/packages/slate/test/changes/at-current-range/unwrap-block/ending-child-blocks.js
index ba1da67d5..c6be64551 100644
--- a/packages/slate/test/changes/at-current-range/unwrap-block/ending-child-blocks.js
+++ b/packages/slate/test/changes/at-current-range/unwrap-block/ending-child-blocks.js
@@ -7,7 +7,7 @@ export default function (change) {
}
export const input = (
-
+
@@ -30,11 +30,11 @@ export const input = (
-
+
)
export const output = (
-
+
@@ -57,5 +57,5 @@ export const output = (
six
-
+
)
diff --git a/packages/slate/test/changes/at-current-range/unwrap-block/middle-child-blocks.js b/packages/slate/test/changes/at-current-range/unwrap-block/middle-child-blocks.js
index dce090899..281a49342 100644
--- a/packages/slate/test/changes/at-current-range/unwrap-block/middle-child-blocks.js
+++ b/packages/slate/test/changes/at-current-range/unwrap-block/middle-child-blocks.js
@@ -7,7 +7,7 @@ export default function (change) {
}
export const input = (
-
+
@@ -30,11 +30,11 @@ export const input = (
-
+
)
export const output = (
-
+
@@ -59,5 +59,5 @@ export const output = (
-
+
)
diff --git a/packages/slate/test/changes/at-current-range/unwrap-block/nested-block.js b/packages/slate/test/changes/at-current-range/unwrap-block/nested-block.js
index e97b8375d..89226311f 100644
--- a/packages/slate/test/changes/at-current-range/unwrap-block/nested-block.js
+++ b/packages/slate/test/changes/at-current-range/unwrap-block/nested-block.js
@@ -7,7 +7,7 @@ export default function (change) {
}
export const input = (
-
+
@@ -17,11 +17,11 @@ export const input = (
-
+
)
export const output = (
-
+
@@ -29,5 +29,5 @@ export const output = (
-
+
)
diff --git a/packages/slate/test/changes/at-current-range/unwrap-block/single-block.js b/packages/slate/test/changes/at-current-range/unwrap-block/single-block.js
index cb38caa53..43bda4fbb 100644
--- a/packages/slate/test/changes/at-current-range/unwrap-block/single-block.js
+++ b/packages/slate/test/changes/at-current-range/unwrap-block/single-block.js
@@ -7,7 +7,7 @@ export default function (change) {
}
export const input = (
-
+
@@ -15,15 +15,15 @@ export const input = (
-
+
)
export const output = (
-
+
word
-
+
)
diff --git a/packages/slate/test/changes/at-current-range/unwrap-block/starting-child-blocks.js b/packages/slate/test/changes/at-current-range/unwrap-block/starting-child-blocks.js
index a98c0cecc..9ae1a7953 100644
--- a/packages/slate/test/changes/at-current-range/unwrap-block/starting-child-blocks.js
+++ b/packages/slate/test/changes/at-current-range/unwrap-block/starting-child-blocks.js
@@ -7,7 +7,7 @@ export default function (change) {
}
export const input = (
-
+
@@ -30,11 +30,11 @@ export const input = (
-
+
)
export const output = (
-
+
one
@@ -57,5 +57,5 @@ export const output = (
-
+
)
diff --git a/packages/slate/test/changes/at-current-range/unwrap-block/with-object.js b/packages/slate/test/changes/at-current-range/unwrap-block/with-object.js
index c94ad88d3..ea9de3cec 100644
--- a/packages/slate/test/changes/at-current-range/unwrap-block/with-object.js
+++ b/packages/slate/test/changes/at-current-range/unwrap-block/with-object.js
@@ -10,7 +10,7 @@ export default function (change) {
}
export const input = (
-
+
@@ -18,15 +18,15 @@ export const input = (
-
+
)
export const output = (
-
+
word
-
+
)
diff --git a/packages/slate/test/changes/at-current-range/unwrap-inline/across-blocks.js b/packages/slate/test/changes/at-current-range/unwrap-inline/across-blocks.js
index c07d1fe69..ba977008b 100644
--- a/packages/slate/test/changes/at-current-range/unwrap-inline/across-blocks.js
+++ b/packages/slate/test/changes/at-current-range/unwrap-inline/across-blocks.js
@@ -7,7 +7,7 @@ export default function (change) {
}
export const input = (
-
+
w ord
@@ -16,11 +16,11 @@ export const input = (
an ot her
-
+
)
export const output = (
-
+
w ord
@@ -29,5 +29,5 @@ export const output = (
anot her
-
+
)
diff --git a/packages/slate/test/changes/at-current-range/unwrap-inline/across-inlines-and-text.js b/packages/slate/test/changes/at-current-range/unwrap-inline/across-inlines-and-text.js
index 4daacd867..24838dc15 100644
--- a/packages/slate/test/changes/at-current-range/unwrap-inline/across-inlines-and-text.js
+++ b/packages/slate/test/changes/at-current-range/unwrap-inline/across-inlines-and-text.js
@@ -7,21 +7,21 @@ export default function (change) {
}
export const input = (
-
+
onetwo three
-
+
)
export const output = (
-
+
onetwothree
-
+
)
diff --git a/packages/slate/test/changes/at-current-range/unwrap-inline/across-inlines.js b/packages/slate/test/changes/at-current-range/unwrap-inline/across-inlines.js
index a5806872c..783474402 100644
--- a/packages/slate/test/changes/at-current-range/unwrap-inline/across-inlines.js
+++ b/packages/slate/test/changes/at-current-range/unwrap-inline/across-inlines.js
@@ -7,21 +7,21 @@ export default function (change) {
}
export const input = (
-
+
wo rd an ot her
-
+
)
export const output = (
-
+
wo rd an ot her
-
+
)
diff --git a/packages/slate/test/changes/at-current-range/unwrap-inline/nested-block.js b/packages/slate/test/changes/at-current-range/unwrap-inline/nested-block.js
index 415544297..97281a7e1 100644
--- a/packages/slate/test/changes/at-current-range/unwrap-inline/nested-block.js
+++ b/packages/slate/test/changes/at-current-range/unwrap-inline/nested-block.js
@@ -7,7 +7,7 @@ export default function (change) {
}
export const input = (
-
+
@@ -15,11 +15,11 @@ export const input = (
-
+
)
export const output = (
-
+
@@ -27,5 +27,5 @@ export const output = (
-
+
)
diff --git a/packages/slate/test/changes/at-current-range/unwrap-inline/only-one.js b/packages/slate/test/changes/at-current-range/unwrap-inline/only-one.js
index d891207c0..dc24412ff 100644
--- a/packages/slate/test/changes/at-current-range/unwrap-inline/only-one.js
+++ b/packages/slate/test/changes/at-current-range/unwrap-inline/only-one.js
@@ -7,20 +7,20 @@ export default function (change) {
}
export const input = (
-
+
hell o wor d
-
+
)
export const output = (
-
+
hell o wor d
-
+
)
diff --git a/packages/slate/test/changes/at-current-range/unwrap-inline/single-block.js b/packages/slate/test/changes/at-current-range/unwrap-inline/single-block.js
index 26876cbaf..c7410fdbb 100644
--- a/packages/slate/test/changes/at-current-range/unwrap-inline/single-block.js
+++ b/packages/slate/test/changes/at-current-range/unwrap-inline/single-block.js
@@ -7,19 +7,19 @@ export default function (change) {
}
export const input = (
-
+
wor d
-
+
)
export const output = (
-
+
w or d
-
+
)
diff --git a/packages/slate/test/changes/at-current-range/unwrap-inline/with-object.js b/packages/slate/test/changes/at-current-range/unwrap-inline/with-object.js
index cc385537b..b7786c9c8 100644
--- a/packages/slate/test/changes/at-current-range/unwrap-inline/with-object.js
+++ b/packages/slate/test/changes/at-current-range/unwrap-inline/with-object.js
@@ -10,21 +10,21 @@ export default function (change) {
}
export const input = (
-
+
w or d
-
+
)
export const output = (
-
+
w or d
-
+
)
diff --git a/packages/slate/test/changes/at-current-range/wrap-block/across-blocks.js b/packages/slate/test/changes/at-current-range/wrap-block/across-blocks.js
index e30f9bd51..1ec7e479c 100644
--- a/packages/slate/test/changes/at-current-range/wrap-block/across-blocks.js
+++ b/packages/slate/test/changes/at-current-range/wrap-block/across-blocks.js
@@ -7,7 +7,7 @@ export default function (change) {
}
export const input = (
-
+
wo rd
@@ -16,11 +16,11 @@ export const input = (
an other
-
+
)
export const output = (
-
+
@@ -31,5 +31,5 @@ export const output = (
-
+
)
diff --git a/packages/slate/test/changes/at-current-range/wrap-block/across-inlines.js b/packages/slate/test/changes/at-current-range/wrap-block/across-inlines.js
index ec1da465f..e39b3f23f 100644
--- a/packages/slate/test/changes/at-current-range/wrap-block/across-inlines.js
+++ b/packages/slate/test/changes/at-current-range/wrap-block/across-inlines.js
@@ -7,7 +7,7 @@ export default function (change) {
}
export const input = (
-
+
wo rd
@@ -16,11 +16,11 @@ export const input = (
an other
-
+
)
export const output = (
-
+
@@ -31,5 +31,5 @@ export const output = (
-
+
)
diff --git a/packages/slate/test/changes/at-current-range/wrap-block/nested-block.js b/packages/slate/test/changes/at-current-range/wrap-block/nested-block.js
index 479d1f01a..e9da0360f 100644
--- a/packages/slate/test/changes/at-current-range/wrap-block/nested-block.js
+++ b/packages/slate/test/changes/at-current-range/wrap-block/nested-block.js
@@ -7,7 +7,7 @@ export default function (change) {
}
export const input = (
-
+
@@ -15,11 +15,11 @@ export const input = (
-
+
)
export const output = (
-
+
@@ -29,5 +29,5 @@ export const output = (
-
+
)
diff --git a/packages/slate/test/changes/at-current-range/wrap-block/single-block.js b/packages/slate/test/changes/at-current-range/wrap-block/single-block.js
index 813774855..cb797bb90 100644
--- a/packages/slate/test/changes/at-current-range/wrap-block/single-block.js
+++ b/packages/slate/test/changes/at-current-range/wrap-block/single-block.js
@@ -7,17 +7,17 @@ export default function (change) {
}
export const input = (
-
+
word
-
+
)
export const output = (
-
+
@@ -25,5 +25,5 @@ export const output = (
-
+
)
diff --git a/packages/slate/test/changes/at-current-range/wrap-block/with-object.js b/packages/slate/test/changes/at-current-range/wrap-block/with-object.js
index 89fde9953..c0c708220 100644
--- a/packages/slate/test/changes/at-current-range/wrap-block/with-object.js
+++ b/packages/slate/test/changes/at-current-range/wrap-block/with-object.js
@@ -10,17 +10,17 @@ export default function (change) {
}
export const input = (
-
+
word
-
+
)
export const output = (
-
+
@@ -28,5 +28,5 @@ export const output = (
-
+
)
diff --git a/packages/slate/test/changes/at-current-range/wrap-inline/across-blocks.js b/packages/slate/test/changes/at-current-range/wrap-inline/across-blocks.js
index ca58f41fa..55b82da35 100644
--- a/packages/slate/test/changes/at-current-range/wrap-inline/across-blocks.js
+++ b/packages/slate/test/changes/at-current-range/wrap-inline/across-blocks.js
@@ -7,7 +7,7 @@ export default function (change) {
}
export const input = (
-
+
wo rd
@@ -16,11 +16,11 @@ export const input = (
an other
-
+
)
export const output = (
-
+
wo rd
@@ -29,5 +29,5 @@ export const output = (
an other
-
+
)
diff --git a/packages/slate/test/changes/at-current-range/wrap-inline/across-inlines.js b/packages/slate/test/changes/at-current-range/wrap-inline/across-inlines.js
index 389a4ee45..046af6f73 100644
--- a/packages/slate/test/changes/at-current-range/wrap-inline/across-inlines.js
+++ b/packages/slate/test/changes/at-current-range/wrap-inline/across-inlines.js
@@ -7,21 +7,21 @@ export default function (change) {
}
export const input = (
-
+
wo rd an other
-
+
)
export const output = (
-
+
wo rd an other
-
+
)
diff --git a/packages/slate/test/changes/at-current-range/wrap-inline/inline-void.js b/packages/slate/test/changes/at-current-range/wrap-inline/inline-void.js
index 43df65fa2..1aa2fb4df 100644
--- a/packages/slate/test/changes/at-current-range/wrap-inline/inline-void.js
+++ b/packages/slate/test/changes/at-current-range/wrap-inline/inline-void.js
@@ -9,17 +9,17 @@ export default function (change) {
}
export const input = (
-
+
{' '}
-
+
)
export const output = (
-
+
@@ -27,5 +27,5 @@ export const output = (
-
+
)
diff --git a/packages/slate/test/changes/at-current-range/wrap-inline/nested-block.js b/packages/slate/test/changes/at-current-range/wrap-inline/nested-block.js
index 4e9a33b3b..7a84583b3 100644
--- a/packages/slate/test/changes/at-current-range/wrap-inline/nested-block.js
+++ b/packages/slate/test/changes/at-current-range/wrap-inline/nested-block.js
@@ -7,7 +7,7 @@ export default function (change) {
}
export const input = (
-
+
@@ -15,11 +15,11 @@ export const input = (
-
+
)
export const output = (
-
+
@@ -27,5 +27,5 @@ export const output = (
-
+
)
diff --git a/packages/slate/test/changes/at-current-range/wrap-inline/single-block.js b/packages/slate/test/changes/at-current-range/wrap-inline/single-block.js
index 04cf3a5c8..e4d62e4ef 100644
--- a/packages/slate/test/changes/at-current-range/wrap-inline/single-block.js
+++ b/packages/slate/test/changes/at-current-range/wrap-inline/single-block.js
@@ -7,21 +7,21 @@ export default function (change) {
}
export const input = (
-
+
w or d
-
+
)
export const output = (
-
+
w or d
-
+
)
diff --git a/packages/slate/test/changes/at-current-range/wrap-inline/twice.js b/packages/slate/test/changes/at-current-range/wrap-inline/twice.js
index f23c27da1..4570bbc59 100644
--- a/packages/slate/test/changes/at-current-range/wrap-inline/twice.js
+++ b/packages/slate/test/changes/at-current-range/wrap-inline/twice.js
@@ -9,19 +9,19 @@ export default function (change) {
}
export const input = (
-
+
w or d
-
+
)
export const output = (
-
+
w or d
-
+
)
diff --git a/packages/slate/test/changes/at-current-range/wrap-inline/whole-block.js b/packages/slate/test/changes/at-current-range/wrap-inline/whole-block.js
index 2fe8a8ab8..60a62e80d 100644
--- a/packages/slate/test/changes/at-current-range/wrap-inline/whole-block.js
+++ b/packages/slate/test/changes/at-current-range/wrap-inline/whole-block.js
@@ -7,21 +7,21 @@ export default function (change) {
}
export const input = (
-
+
word
-
+
)
export const output = (
-
+
word
-
+
)
diff --git a/packages/slate/test/changes/at-current-range/wrap-inline/with-object.js b/packages/slate/test/changes/at-current-range/wrap-inline/with-object.js
index 6afa7c809..43ba0d9a6 100644
--- a/packages/slate/test/changes/at-current-range/wrap-inline/with-object.js
+++ b/packages/slate/test/changes/at-current-range/wrap-inline/with-object.js
@@ -10,21 +10,21 @@ export default function (change) {
}
export const input = (
-
+
w or d
-
+
)
export const output = (
-
+
w or d
-
+
)
diff --git a/packages/slate/test/changes/at-current-range/wrap-text/across-blocks.js b/packages/slate/test/changes/at-current-range/wrap-text/across-blocks.js
index cba7d8206..74a501d33 100644
--- a/packages/slate/test/changes/at-current-range/wrap-text/across-blocks.js
+++ b/packages/slate/test/changes/at-current-range/wrap-text/across-blocks.js
@@ -7,7 +7,7 @@ export default function (change) {
}
export const input = (
-
+
wo rd
@@ -16,11 +16,11 @@ export const input = (
an other
-
+
)
export const output = (
-
+
wo[[ rd
@@ -29,5 +29,5 @@ export const output = (
an ]]other
-
+
)
diff --git a/packages/slate/test/changes/at-current-range/wrap-text/across-inlines.js b/packages/slate/test/changes/at-current-range/wrap-text/across-inlines.js
index 6ab2dbc6b..c2320997e 100644
--- a/packages/slate/test/changes/at-current-range/wrap-text/across-inlines.js
+++ b/packages/slate/test/changes/at-current-range/wrap-text/across-inlines.js
@@ -7,23 +7,23 @@ export default function (change) {
}
export const input = (
-
+
wo rd
an other
-
+
)
export const output = (
-
+
wo[[ rd
an ]]other
-
+
)
diff --git a/packages/slate/test/changes/at-current-range/wrap-text/backwards-selection.js b/packages/slate/test/changes/at-current-range/wrap-text/backwards-selection.js
index 54f2c30c7..1b6697b3b 100644
--- a/packages/slate/test/changes/at-current-range/wrap-text/backwards-selection.js
+++ b/packages/slate/test/changes/at-current-range/wrap-text/backwards-selection.js
@@ -7,21 +7,21 @@ export default function (change) {
}
export const input = (
-
+
w or d
-
+
)
export const output = (
-
+
w[[ or ]]d
-
+
)
diff --git a/packages/slate/test/changes/at-current-range/wrap-text/empty-block.js b/packages/slate/test/changes/at-current-range/wrap-text/empty-block.js
index 15a0de5ca..9fbe18503 100644
--- a/packages/slate/test/changes/at-current-range/wrap-text/empty-block.js
+++ b/packages/slate/test/changes/at-current-range/wrap-text/empty-block.js
@@ -7,21 +7,21 @@ export default function (change) {
}
export const input = (
-
+
-
+
)
export const output = (
-
+
[[ ]]
-
+
)
diff --git a/packages/slate/test/changes/at-current-range/wrap-text/end-of-block.js b/packages/slate/test/changes/at-current-range/wrap-text/end-of-block.js
index 80e7aeb4d..2c75683f2 100644
--- a/packages/slate/test/changes/at-current-range/wrap-text/end-of-block.js
+++ b/packages/slate/test/changes/at-current-range/wrap-text/end-of-block.js
@@ -7,21 +7,21 @@ export default function (change) {
}
export const input = (
-
+
wo rd
-
+
)
export const output = (
-
+
wo[[ rd ]]
-
+
)
diff --git a/packages/slate/test/changes/at-current-range/wrap-text/middle-of-block.js b/packages/slate/test/changes/at-current-range/wrap-text/middle-of-block.js
index 58b451133..25f6ca058 100644
--- a/packages/slate/test/changes/at-current-range/wrap-text/middle-of-block.js
+++ b/packages/slate/test/changes/at-current-range/wrap-text/middle-of-block.js
@@ -7,21 +7,21 @@ export default function (change) {
}
export const input = (
-
+
w or d
-
+
)
export const output = (
-
+
w[[ or ]]d
-
+
)
diff --git a/packages/slate/test/changes/at-current-range/wrap-text/start-of-block.js b/packages/slate/test/changes/at-current-range/wrap-text/start-of-block.js
index 59ab3bcd7..547c4ad44 100644
--- a/packages/slate/test/changes/at-current-range/wrap-text/start-of-block.js
+++ b/packages/slate/test/changes/at-current-range/wrap-text/start-of-block.js
@@ -7,21 +7,21 @@ export default function (change) {
}
export const input = (
-
+
wo rd
-
+
)
export const output = (
-
+
[[ wo ]]rd
-
+
)
diff --git a/packages/slate/test/changes/at-current-range/wrap-text/whole-block.js b/packages/slate/test/changes/at-current-range/wrap-text/whole-block.js
index 995bb8358..4a166f107 100644
--- a/packages/slate/test/changes/at-current-range/wrap-text/whole-block.js
+++ b/packages/slate/test/changes/at-current-range/wrap-text/whole-block.js
@@ -7,21 +7,21 @@ export default function (change) {
}
export const input = (
-
+
word
-
+
)
export const output = (
-
+
[[ word ]]
-
+
)
diff --git a/packages/slate/test/changes/at-current-range/wrap-text/without-suffix.js b/packages/slate/test/changes/at-current-range/wrap-text/without-suffix.js
index b15d840da..c4557294a 100644
--- a/packages/slate/test/changes/at-current-range/wrap-text/without-suffix.js
+++ b/packages/slate/test/changes/at-current-range/wrap-text/without-suffix.js
@@ -7,21 +7,21 @@ export default function (change) {
}
export const input = (
-
+
w or d
-
+
)
export const output = (
-
+
w** or **d
-
+
)
diff --git a/packages/slate/test/changes/by-key/insert-fragment-by-key/end-of-target.js b/packages/slate/test/changes/by-key/insert-fragment-by-key/end-of-target.js
index a6e92044d..588455773 100644
--- a/packages/slate/test/changes/by-key/insert-fragment-by-key/end-of-target.js
+++ b/packages/slate/test/changes/by-key/insert-fragment-by-key/end-of-target.js
@@ -16,17 +16,17 @@ export default function (change) {
}
export const input = (
-
+
word
-
+
)
export const output = (
-
+
word
@@ -38,5 +38,5 @@ export const output = (
two
-
+
)
diff --git a/packages/slate/test/changes/by-key/insert-fragment-by-key/middle-of-target.js b/packages/slate/test/changes/by-key/insert-fragment-by-key/middle-of-target.js
index f25655ea5..69ebb3509 100644
--- a/packages/slate/test/changes/by-key/insert-fragment-by-key/middle-of-target.js
+++ b/packages/slate/test/changes/by-key/insert-fragment-by-key/middle-of-target.js
@@ -16,7 +16,7 @@ export default function (change) {
}
export const input = (
-
+
word
@@ -25,11 +25,11 @@ export const input = (
another
-
+
)
export const output = (
-
+
word
@@ -44,5 +44,5 @@ export const output = (
another
-
+
)
diff --git a/packages/slate/test/changes/by-key/insert-fragment-by-key/start-of-target.js b/packages/slate/test/changes/by-key/insert-fragment-by-key/start-of-target.js
index ee9add99b..3991696c1 100644
--- a/packages/slate/test/changes/by-key/insert-fragment-by-key/start-of-target.js
+++ b/packages/slate/test/changes/by-key/insert-fragment-by-key/start-of-target.js
@@ -16,17 +16,17 @@ export default function (change) {
}
export const input = (
-
+
word
-
+
)
export const output = (
-
+
one
@@ -38,5 +38,5 @@ export const output = (
word
-
+
)
diff --git a/packages/slate/test/changes/by-key/insert-node-by-key/block.js b/packages/slate/test/changes/by-key/insert-node-by-key/block.js
index 7cd9a6853..3c7d868bd 100644
--- a/packages/slate/test/changes/by-key/insert-node-by-key/block.js
+++ b/packages/slate/test/changes/by-key/insert-node-by-key/block.js
@@ -8,22 +8,22 @@ export default function (change) {
}
export const input = (
-
+
one
-
+
)
export const output = (
-
+
one
-
+
)
diff --git a/packages/slate/test/changes/by-key/insert-node-by-key/duplicate.js b/packages/slate/test/changes/by-key/insert-node-by-key/duplicate.js
index 27dcce67b..74ab65b02 100644
--- a/packages/slate/test/changes/by-key/insert-node-by-key/duplicate.js
+++ b/packages/slate/test/changes/by-key/insert-node-by-key/duplicate.js
@@ -3,22 +3,22 @@
import h from '../../../helpers/h'
export default function (change) {
- const node = change.state.document.getBlocks().first()
+ const node = change.value.document.getBlocks().first()
change.insertNodeByKey('a', 0, node)
}
export const input = (
-
+
one
-
+
)
export const output = (
-
+
one
@@ -27,5 +27,5 @@ export const output = (
one
-
+
)
diff --git a/packages/slate/test/changes/by-key/insert-node-by-key/inline.js b/packages/slate/test/changes/by-key/insert-node-by-key/inline.js
index 1563865c6..e111af245 100644
--- a/packages/slate/test/changes/by-key/insert-node-by-key/inline.js
+++ b/packages/slate/test/changes/by-key/insert-node-by-key/inline.js
@@ -11,7 +11,7 @@ export default function (change) {
}
export const input = (
-
+
one
@@ -20,11 +20,11 @@ export const input = (
two
-
+
)
export const output = (
-
+
one
@@ -33,5 +33,5 @@ export const output = (
two
-
+
)
diff --git a/packages/slate/test/changes/by-key/insert-text-by-key/selection-after.js b/packages/slate/test/changes/by-key/insert-text-by-key/selection-after.js
index 81f60d300..85dc4992a 100644
--- a/packages/slate/test/changes/by-key/insert-text-by-key/selection-after.js
+++ b/packages/slate/test/changes/by-key/insert-text-by-key/selection-after.js
@@ -7,21 +7,21 @@ export default function (change) {
}
export const input = (
-
+
w or d
-
+
)
export const output = (
-
+
w or dx
-
+
)
diff --git a/packages/slate/test/changes/by-key/insert-text-by-key/selection-before.js b/packages/slate/test/changes/by-key/insert-text-by-key/selection-before.js
index bb46c4b4f..f16e63e08 100644
--- a/packages/slate/test/changes/by-key/insert-text-by-key/selection-before.js
+++ b/packages/slate/test/changes/by-key/insert-text-by-key/selection-before.js
@@ -7,21 +7,21 @@ export default function (change) {
}
export const input = (
-
+
w or d
-
+
)
export const output = (
-
+
xw or d
-
+
)
diff --git a/packages/slate/test/changes/by-key/insert-text-by-key/selection-end.js b/packages/slate/test/changes/by-key/insert-text-by-key/selection-end.js
index 064a4c9f0..87b2baa20 100644
--- a/packages/slate/test/changes/by-key/insert-text-by-key/selection-end.js
+++ b/packages/slate/test/changes/by-key/insert-text-by-key/selection-end.js
@@ -7,21 +7,21 @@ export default function (change) {
}
export const input = (
-
+
w or d
-
+
)
export const output = (
-
+
w orx d
-
+
)
diff --git a/packages/slate/test/changes/by-key/insert-text-by-key/selection-middle.js b/packages/slate/test/changes/by-key/insert-text-by-key/selection-middle.js
index 34b1363de..b9a895065 100644
--- a/packages/slate/test/changes/by-key/insert-text-by-key/selection-middle.js
+++ b/packages/slate/test/changes/by-key/insert-text-by-key/selection-middle.js
@@ -7,21 +7,21 @@ export default function (change) {
}
export const input = (
-
+
w or d
-
+
)
export const output = (
-
+
w oxr d
-
+
)
diff --git a/packages/slate/test/changes/by-key/insert-text-by-key/selection-start.js b/packages/slate/test/changes/by-key/insert-text-by-key/selection-start.js
index 858c5351a..108509ba7 100644
--- a/packages/slate/test/changes/by-key/insert-text-by-key/selection-start.js
+++ b/packages/slate/test/changes/by-key/insert-text-by-key/selection-start.js
@@ -7,21 +7,21 @@ export default function (change) {
}
export const input = (
-
+
w or d
-
+
)
export const output = (
-
+
wx or d
-
+
)
diff --git a/packages/slate/test/changes/by-key/insert-text-by-key/start-text.js b/packages/slate/test/changes/by-key/insert-text-by-key/start-text.js
index 046fe78eb..06a6b252b 100644
--- a/packages/slate/test/changes/by-key/insert-text-by-key/start-text.js
+++ b/packages/slate/test/changes/by-key/insert-text-by-key/start-text.js
@@ -7,21 +7,21 @@ export default function (change) {
}
export const input = (
-
+
wo rd
-
+
)
export const output = (
-
+
awo rd
-
+
)
diff --git a/packages/slate/test/changes/by-key/insert-text-by-key/text-end.js b/packages/slate/test/changes/by-key/insert-text-by-key/text-end.js
index c2a339423..8e98e17bf 100644
--- a/packages/slate/test/changes/by-key/insert-text-by-key/text-end.js
+++ b/packages/slate/test/changes/by-key/insert-text-by-key/text-end.js
@@ -7,21 +7,21 @@ export default function (change) {
}
export const input = (
-
+
word
-
+
)
export const output = (
-
+
wordx
-
+
)
diff --git a/packages/slate/test/changes/by-key/insert-text-by-key/text-middle-with-marks.js b/packages/slate/test/changes/by-key/insert-text-by-key/text-middle-with-marks.js
index 27427afcd..7df1092a4 100644
--- a/packages/slate/test/changes/by-key/insert-text-by-key/text-middle-with-marks.js
+++ b/packages/slate/test/changes/by-key/insert-text-by-key/text-middle-with-marks.js
@@ -7,21 +7,21 @@ export default function (change) {
}
export const input = (
-
+
word
-
+
)
export const output = (
-
+
wox rd
-
+
)
diff --git a/packages/slate/test/changes/by-key/insert-text-by-key/text-middle.js b/packages/slate/test/changes/by-key/insert-text-by-key/text-middle.js
index 039629040..3c8866e47 100644
--- a/packages/slate/test/changes/by-key/insert-text-by-key/text-middle.js
+++ b/packages/slate/test/changes/by-key/insert-text-by-key/text-middle.js
@@ -7,21 +7,21 @@ export default function (change) {
}
export const input = (
-
+
word
-
+
)
export const output = (
-
+
woxrd
-
+
)
diff --git a/packages/slate/test/changes/by-key/merge-node-by-key/block.js b/packages/slate/test/changes/by-key/merge-node-by-key/block.js
index 274dc9c50..1c5eb1f89 100644
--- a/packages/slate/test/changes/by-key/merge-node-by-key/block.js
+++ b/packages/slate/test/changes/by-key/merge-node-by-key/block.js
@@ -7,7 +7,7 @@ export default function (change) {
}
export const input = (
-
+
one
@@ -16,15 +16,15 @@ export const input = (
two
-
+
)
export const output = (
-
+
onetwo
-
+
)
diff --git a/packages/slate/test/changes/by-key/move-node-by-key/block.js b/packages/slate/test/changes/by-key/move-node-by-key/block.js
index deb09cc38..2c7b8fdc1 100644
--- a/packages/slate/test/changes/by-key/move-node-by-key/block.js
+++ b/packages/slate/test/changes/by-key/move-node-by-key/block.js
@@ -7,7 +7,7 @@ export default function (change) {
}
export const input = (
-
+
one
@@ -16,11 +16,11 @@ export const input = (
two
-
+
)
export const output = (
-
+
two
@@ -29,5 +29,5 @@ export const output = (
one
-
+
)
diff --git a/packages/slate/test/changes/by-key/move-node-by-key/inline.js b/packages/slate/test/changes/by-key/move-node-by-key/inline.js
index b3e5f1fd2..dd525ff3d 100644
--- a/packages/slate/test/changes/by-key/move-node-by-key/inline.js
+++ b/packages/slate/test/changes/by-key/move-node-by-key/inline.js
@@ -7,23 +7,23 @@ export default function (change) {
}
export const input = (
-
+
one
two
-
+
)
export const output = (
-
+
two
one
-
+
)
diff --git a/packages/slate/test/changes/by-key/move-node-by-key/text.js b/packages/slate/test/changes/by-key/move-node-by-key/text.js
index 45b7bd007..f472bb894 100644
--- a/packages/slate/test/changes/by-key/move-node-by-key/text.js
+++ b/packages/slate/test/changes/by-key/move-node-by-key/text.js
@@ -7,7 +7,7 @@ export default function (change) {
}
export const input = (
-
+
one
@@ -16,16 +16,16 @@ export const input = (
two
-
+
)
export const output = (
-
+
onetwo
-
+
)
diff --git a/packages/slate/test/changes/by-key/move-node-by-key/to-sibling.js b/packages/slate/test/changes/by-key/move-node-by-key/to-sibling.js
index b85b1b2f0..1c0103c3f 100644
--- a/packages/slate/test/changes/by-key/move-node-by-key/to-sibling.js
+++ b/packages/slate/test/changes/by-key/move-node-by-key/to-sibling.js
@@ -7,7 +7,7 @@ export default function (change) {
}
export const input = (
-
+
one
@@ -18,11 +18,11 @@ export const input = (
-
+
)
export const output = (
-
+
@@ -33,5 +33,5 @@ export const output = (
-
+
)
diff --git a/packages/slate/test/changes/by-key/remove-node-by-key/block.js b/packages/slate/test/changes/by-key/remove-node-by-key/block.js
index 858f5566f..8490df57e 100644
--- a/packages/slate/test/changes/by-key/remove-node-by-key/block.js
+++ b/packages/slate/test/changes/by-key/remove-node-by-key/block.js
@@ -7,7 +7,7 @@ export default function (change) {
}
export const input = (
-
+
one
@@ -16,15 +16,15 @@ export const input = (
two
-
+
)
export const output = (
-
+
one
-
+
)
diff --git a/packages/slate/test/changes/by-key/remove-node-by-key/inline.js b/packages/slate/test/changes/by-key/remove-node-by-key/inline.js
index 2fd5159d5..46ec87fbf 100644
--- a/packages/slate/test/changes/by-key/remove-node-by-key/inline.js
+++ b/packages/slate/test/changes/by-key/remove-node-by-key/inline.js
@@ -7,7 +7,7 @@ export default function (change) {
}
export const input = (
-
+
one
@@ -16,16 +16,16 @@ export const input = (
two
-
+
)
export const output = (
-
+
two
-
+
)
diff --git a/packages/slate/test/changes/by-key/remove-node-by-key/selection-inside.js b/packages/slate/test/changes/by-key/remove-node-by-key/selection-inside.js
index d6ecb5628..eef73e3c4 100644
--- a/packages/slate/test/changes/by-key/remove-node-by-key/selection-inside.js
+++ b/packages/slate/test/changes/by-key/remove-node-by-key/selection-inside.js
@@ -7,7 +7,7 @@ export default function (change) {
}
export const input = (
-
+
one
@@ -16,16 +16,16 @@ export const input = (
t wo
-
+
)
export const output = (
-
+
one
-
+
)
diff --git a/packages/slate/test/changes/by-key/remove-node-by-key/text.js b/packages/slate/test/changes/by-key/remove-node-by-key/text.js
index d4a648d16..a114adfa7 100644
--- a/packages/slate/test/changes/by-key/remove-node-by-key/text.js
+++ b/packages/slate/test/changes/by-key/remove-node-by-key/text.js
@@ -7,7 +7,7 @@ export default function (change) {
}
export const input = (
-
+
one
@@ -16,16 +16,16 @@ export const input = (
two
-
+
)
export const output = (
-
+
two
-
+
)
diff --git a/packages/slate/test/changes/by-key/remove-text-by-key/adjacent-non-void-inlines.js b/packages/slate/test/changes/by-key/remove-text-by-key/adjacent-non-void-inlines.js
index 3e9078b7f..f6c2f6199 100644
--- a/packages/slate/test/changes/by-key/remove-text-by-key/adjacent-non-void-inlines.js
+++ b/packages/slate/test/changes/by-key/remove-text-by-key/adjacent-non-void-inlines.js
@@ -7,21 +7,21 @@ export default function (change) {
}
export const input = (
-
+
onea two
-
+
)
export const output = (
-
+
one two
-
+
)
diff --git a/packages/slate/test/changes/by-key/remove-text-by-key/inline-last-character.js b/packages/slate/test/changes/by-key/remove-text-by-key/inline-last-character.js
index 563a9885d..8824b6ae1 100644
--- a/packages/slate/test/changes/by-key/remove-text-by-key/inline-last-character.js
+++ b/packages/slate/test/changes/by-key/remove-text-by-key/inline-last-character.js
@@ -7,19 +7,19 @@ export default function (change) {
}
export const input = (
-
+
a
-
+
)
export const output = (
-
+
-
+
)
diff --git a/packages/slate/test/changes/by-key/remove-text-by-key/inline-nested-last-character.js b/packages/slate/test/changes/by-key/remove-text-by-key/inline-nested-last-character.js
index 9180bbb23..53eab291b 100644
--- a/packages/slate/test/changes/by-key/remove-text-by-key/inline-nested-last-character.js
+++ b/packages/slate/test/changes/by-key/remove-text-by-key/inline-nested-last-character.js
@@ -7,21 +7,21 @@ export default function (change) {
}
export const input = (
-
+
a
-
+
)
export const output = (
-
+
-
+
)
diff --git a/packages/slate/test/changes/by-key/remove-text-by-key/inline-void.js b/packages/slate/test/changes/by-key/remove-text-by-key/inline-void.js
index 292e4cbc5..1dbea7013 100644
--- a/packages/slate/test/changes/by-key/remove-text-by-key/inline-void.js
+++ b/packages/slate/test/changes/by-key/remove-text-by-key/inline-void.js
@@ -7,7 +7,7 @@ export default function (change) {
}
export const input = (
-
+
@@ -15,15 +15,15 @@ export const input = (
-
+
)
export const output = (
-
+
-
+
)
diff --git a/packages/slate/test/changes/by-key/remove-text-by-key/inline.js b/packages/slate/test/changes/by-key/remove-text-by-key/inline.js
index 0977f4c64..aa0fbae8c 100644
--- a/packages/slate/test/changes/by-key/remove-text-by-key/inline.js
+++ b/packages/slate/test/changes/by-key/remove-text-by-key/inline.js
@@ -7,21 +7,21 @@ export default function (change) {
}
export const input = (
-
+
word
-
+
)
export const output = (
-
+
wor
-
+
)
diff --git a/packages/slate/test/changes/by-key/remove-text-by-key/next-void-inline.js b/packages/slate/test/changes/by-key/remove-text-by-key/next-void-inline.js
index b695dbe21..5220c7202 100644
--- a/packages/slate/test/changes/by-key/remove-text-by-key/next-void-inline.js
+++ b/packages/slate/test/changes/by-key/remove-text-by-key/next-void-inline.js
@@ -7,21 +7,21 @@ export default function (change) {
}
export const input = (
-
+
onea
-
+
)
export const output = (
-
+
one
-
+
)
diff --git a/packages/slate/test/changes/by-key/remove-text-by-key/previous-void-inline.js b/packages/slate/test/changes/by-key/remove-text-by-key/previous-void-inline.js
index 7aa3f4391..32c996b46 100644
--- a/packages/slate/test/changes/by-key/remove-text-by-key/previous-void-inline.js
+++ b/packages/slate/test/changes/by-key/remove-text-by-key/previous-void-inline.js
@@ -7,21 +7,21 @@ export default function (change) {
}
export const input = (
-
+
a two
-
+
)
export const output = (
-
+
two
-
+
)
diff --git a/packages/slate/test/changes/by-key/remove-text-by-key/selection-after.js b/packages/slate/test/changes/by-key/remove-text-by-key/selection-after.js
index dac06afa9..79150ca94 100644
--- a/packages/slate/test/changes/by-key/remove-text-by-key/selection-after.js
+++ b/packages/slate/test/changes/by-key/remove-text-by-key/selection-after.js
@@ -7,21 +7,21 @@ export default function (change) {
}
export const input = (
-
+
w or d
-
+
)
export const output = (
-
+
w or
-
+
)
diff --git a/packages/slate/test/changes/by-key/remove-text-by-key/selection-before.js b/packages/slate/test/changes/by-key/remove-text-by-key/selection-before.js
index b4a66d3b2..eb0fc6eaf 100644
--- a/packages/slate/test/changes/by-key/remove-text-by-key/selection-before.js
+++ b/packages/slate/test/changes/by-key/remove-text-by-key/selection-before.js
@@ -7,21 +7,21 @@ export default function (change) {
}
export const input = (
-
+
w or d
-
+
)
export const output = (
-
+
or d
-
+
)
diff --git a/packages/slate/test/changes/by-key/remove-text-by-key/selection-middle.js b/packages/slate/test/changes/by-key/remove-text-by-key/selection-middle.js
index 5a7fb91e6..8bc9b0a88 100644
--- a/packages/slate/test/changes/by-key/remove-text-by-key/selection-middle.js
+++ b/packages/slate/test/changes/by-key/remove-text-by-key/selection-middle.js
@@ -7,21 +7,21 @@ export default function (change) {
}
export const input = (
-
+
word
-
+
)
export const output = (
-
+
wod
-
+
)
diff --git a/packages/slate/test/changes/by-key/remove-text-by-key/selection-start.js b/packages/slate/test/changes/by-key/remove-text-by-key/selection-start.js
index 859ad522d..de1cd2756 100644
--- a/packages/slate/test/changes/by-key/remove-text-by-key/selection-start.js
+++ b/packages/slate/test/changes/by-key/remove-text-by-key/selection-start.js
@@ -7,21 +7,21 @@ export default function (change) {
}
export const input = (
-
+
w or d
-
+
)
export const output = (
-
+
w o d
-
+
)
diff --git a/packages/slate/test/changes/by-key/remove-text-by-key/text.js b/packages/slate/test/changes/by-key/remove-text-by-key/text.js
index 764dd3b1a..4ea9405f4 100644
--- a/packages/slate/test/changes/by-key/remove-text-by-key/text.js
+++ b/packages/slate/test/changes/by-key/remove-text-by-key/text.js
@@ -7,21 +7,21 @@ export default function (change) {
}
export const input = (
-
+
word
-
+
)
export const output = (
-
+
wor
-
+
)
diff --git a/packages/slate/test/changes/by-key/replace-node-by-key/block.js b/packages/slate/test/changes/by-key/replace-node-by-key/block.js
index f0bab187c..ae9a59688 100644
--- a/packages/slate/test/changes/by-key/replace-node-by-key/block.js
+++ b/packages/slate/test/changes/by-key/replace-node-by-key/block.js
@@ -7,7 +7,7 @@ export default function (change) {
}
export const input = (
-
+
one
@@ -16,16 +16,16 @@ export const input = (
two
-
+
)
export const output = (
-
+
one
-
+
)
diff --git a/packages/slate/test/changes/by-key/replace-node-by-key/inline.js b/packages/slate/test/changes/by-key/replace-node-by-key/inline.js
index be1d11f87..c46ad81e0 100644
--- a/packages/slate/test/changes/by-key/replace-node-by-key/inline.js
+++ b/packages/slate/test/changes/by-key/replace-node-by-key/inline.js
@@ -7,21 +7,21 @@ export default function (change) {
}
export const input = (
-
+
one two
-
+
)
export const output = (
-
+
one
-
+
)
diff --git a/packages/slate/test/changes/by-key/replace-node-by-key/text.js b/packages/slate/test/changes/by-key/replace-node-by-key/text.js
index c1694b95d..eacc294f5 100644
--- a/packages/slate/test/changes/by-key/replace-node-by-key/text.js
+++ b/packages/slate/test/changes/by-key/replace-node-by-key/text.js
@@ -7,7 +7,7 @@ export default function (change) {
}
export const input = (
-
+
one
@@ -16,11 +16,11 @@ export const input = (
one
-
+
)
export const output = (
-
+
one
@@ -29,5 +29,5 @@ export const output = (
three
-
+
)
diff --git a/packages/slate/test/changes/by-key/set-mark-by-key/with-data.js b/packages/slate/test/changes/by-key/set-mark-by-key/with-data.js
index a4492543e..f483fb6da 100644
--- a/packages/slate/test/changes/by-key/set-mark-by-key/with-data.js
+++ b/packages/slate/test/changes/by-key/set-mark-by-key/with-data.js
@@ -12,21 +12,21 @@ export default function (change) {
}
export const input = (
-
+
word
-
+
)
export const output = (
-
+
wo rd
-
+
)
diff --git a/packages/slate/test/changes/by-key/set-node-by-key/block.js b/packages/slate/test/changes/by-key/set-node-by-key/block.js
index 6c5ff7fd0..05deb2d29 100644
--- a/packages/slate/test/changes/by-key/set-node-by-key/block.js
+++ b/packages/slate/test/changes/by-key/set-node-by-key/block.js
@@ -10,21 +10,21 @@ export default function (change) {
}
export const input = (
-
+
word
-
+
)
export const output = (
-
+
word
-
+
)
diff --git a/packages/slate/test/changes/by-key/set-node-by-key/inline-with-is-void.js b/packages/slate/test/changes/by-key/set-node-by-key/inline-with-is-void.js
index 39cadf561..dec228d55 100644
--- a/packages/slate/test/changes/by-key/set-node-by-key/inline-with-is-void.js
+++ b/packages/slate/test/changes/by-key/set-node-by-key/inline-with-is-void.js
@@ -10,21 +10,21 @@ export default function (change) {
}
export const input = (
-
+
word
-
+
)
export const output = (
-
+
-
+
)
diff --git a/packages/slate/test/changes/by-key/set-node-by-key/string-shorthand.js b/packages/slate/test/changes/by-key/set-node-by-key/string-shorthand.js
index bafd1f488..682eb8c96 100644
--- a/packages/slate/test/changes/by-key/set-node-by-key/string-shorthand.js
+++ b/packages/slate/test/changes/by-key/set-node-by-key/string-shorthand.js
@@ -7,21 +7,21 @@ export default function (change) {
}
export const input = (
-
+
word
-
+
)
export const output = (
-
+
word
-
+
)
diff --git a/packages/slate/test/changes/by-key/split-descendants-by-key/block-with-selection.js b/packages/slate/test/changes/by-key/split-descendants-by-key/block-with-selection.js
index 363791e40..2b3b368e5 100644
--- a/packages/slate/test/changes/by-key/split-descendants-by-key/block-with-selection.js
+++ b/packages/slate/test/changes/by-key/split-descendants-by-key/block-with-selection.js
@@ -7,17 +7,17 @@ export default function (change) {
}
export const input = (
-
+
w or d
-
+
)
export const output = (
-
+
w o
@@ -26,5 +26,5 @@ export const output = (
r d
-
+
)
diff --git a/packages/slate/test/changes/by-key/split-descendants-by-key/block.js b/packages/slate/test/changes/by-key/split-descendants-by-key/block.js
index 0a0f6f168..9356b91cb 100644
--- a/packages/slate/test/changes/by-key/split-descendants-by-key/block.js
+++ b/packages/slate/test/changes/by-key/split-descendants-by-key/block.js
@@ -7,17 +7,17 @@ export default function (change) {
}
export const input = (
-
+
word
-
+
)
export const output = (
-
+
wo
@@ -26,5 +26,5 @@ export const output = (
rd
-
+
)
diff --git a/packages/slate/test/changes/by-key/split-node-by-key/block-with-selection.js b/packages/slate/test/changes/by-key/split-node-by-key/block-with-selection.js
index bce0c8866..512b1c47e 100644
--- a/packages/slate/test/changes/by-key/split-node-by-key/block-with-selection.js
+++ b/packages/slate/test/changes/by-key/split-node-by-key/block-with-selection.js
@@ -7,17 +7,17 @@ export default function (change) {
}
export const input = (
-
+
o ne tw o
-
+
)
export const output = (
-
+
o ne
@@ -26,5 +26,5 @@ export const output = (
tw o
-
+
)
diff --git a/packages/slate/test/changes/by-key/split-node-by-key/block.js b/packages/slate/test/changes/by-key/split-node-by-key/block.js
index 58c413d4a..9e0ffb3a3 100644
--- a/packages/slate/test/changes/by-key/split-node-by-key/block.js
+++ b/packages/slate/test/changes/by-key/split-node-by-key/block.js
@@ -7,17 +7,17 @@ export default function (change) {
}
export const input = (
-
+
one two
-
+
)
export const output = (
-
+
one
@@ -26,5 +26,5 @@ export const output = (
two
-
+
)
diff --git a/packages/slate/test/changes/by-key/unwrap-block-by-key/single-block.js b/packages/slate/test/changes/by-key/unwrap-block-by-key/single-block.js
index 4b9785261..fbfd704f8 100644
--- a/packages/slate/test/changes/by-key/unwrap-block-by-key/single-block.js
+++ b/packages/slate/test/changes/by-key/unwrap-block-by-key/single-block.js
@@ -7,7 +7,7 @@ export default function (change) {
}
export const input = (
-
+
@@ -20,11 +20,11 @@ export const input = (
-
+
)
export const output = (
-
+
word
@@ -35,5 +35,5 @@ export const output = (
-
+
)
diff --git a/packages/slate/test/changes/by-key/unwrap-inline-by-key/single-block.js b/packages/slate/test/changes/by-key/unwrap-inline-by-key/single-block.js
index 844146892..8d7cda31d 100644
--- a/packages/slate/test/changes/by-key/unwrap-inline-by-key/single-block.js
+++ b/packages/slate/test/changes/by-key/unwrap-inline-by-key/single-block.js
@@ -7,21 +7,21 @@ export default function (change) {
}
export const input = (
-
+
w ord another
-
+
)
export const output = (
-
+
word another
-
+
)
diff --git a/packages/slate/test/changes/by-key/unwrap-node-by-key/block.js b/packages/slate/test/changes/by-key/unwrap-node-by-key/block.js
index eb2f8a4a2..86aeaad32 100644
--- a/packages/slate/test/changes/by-key/unwrap-node-by-key/block.js
+++ b/packages/slate/test/changes/by-key/unwrap-node-by-key/block.js
@@ -7,7 +7,7 @@ export default function (change) {
}
export const input = (
-
+
@@ -15,15 +15,15 @@ export const input = (
-
+
)
export const output = (
-
+
word
-
+
)
diff --git a/packages/slate/test/changes/by-key/unwrap-node-by-key/first-block.js b/packages/slate/test/changes/by-key/unwrap-node-by-key/first-block.js
index baf0e3b3e..71c7a8f4c 100644
--- a/packages/slate/test/changes/by-key/unwrap-node-by-key/first-block.js
+++ b/packages/slate/test/changes/by-key/unwrap-node-by-key/first-block.js
@@ -7,7 +7,7 @@ export default function (change) {
}
export const input = (
-
+
@@ -18,11 +18,11 @@ export const input = (
-
+
)
export const output = (
-
+
one
@@ -33,5 +33,5 @@ export const output = (
-
+
)
diff --git a/packages/slate/test/changes/by-key/unwrap-node-by-key/last-block.js b/packages/slate/test/changes/by-key/unwrap-node-by-key/last-block.js
index ec61650ba..67d244f16 100644
--- a/packages/slate/test/changes/by-key/unwrap-node-by-key/last-block.js
+++ b/packages/slate/test/changes/by-key/unwrap-node-by-key/last-block.js
@@ -7,7 +7,7 @@ export default function (change) {
}
export const input = (
-
+
@@ -18,11 +18,11 @@ export const input = (
-
+
)
export const output = (
-
+
@@ -33,5 +33,5 @@ export const output = (
two
-
+
)
diff --git a/packages/slate/test/changes/by-key/unwrap-node-by-key/middle-block.js b/packages/slate/test/changes/by-key/unwrap-node-by-key/middle-block.js
index cb2ccd4bb..b1cc95036 100644
--- a/packages/slate/test/changes/by-key/unwrap-node-by-key/middle-block.js
+++ b/packages/slate/test/changes/by-key/unwrap-node-by-key/middle-block.js
@@ -7,7 +7,7 @@ export default function (change) {
}
export const input = (
-
+
@@ -21,11 +21,11 @@ export const input = (
-
+
)
export const output = (
-
+
@@ -41,5 +41,5 @@ export const output = (
-
+
)
diff --git a/packages/slate/test/changes/by-key/wrap-block-by-key/block.js b/packages/slate/test/changes/by-key/wrap-block-by-key/block.js
index 556007507..33c485a1c 100644
--- a/packages/slate/test/changes/by-key/wrap-block-by-key/block.js
+++ b/packages/slate/test/changes/by-key/wrap-block-by-key/block.js
@@ -7,17 +7,17 @@ export default function (change) {
}
export const input = (
-
+
word
-
+
)
export const output = (
-
+
@@ -25,5 +25,5 @@ export const output = (
-
+
)
diff --git a/packages/slate/test/changes/by-key/wrap-block-by-key/text.js b/packages/slate/test/changes/by-key/wrap-block-by-key/text.js
index 49ee24553..29818b822 100644
--- a/packages/slate/test/changes/by-key/wrap-block-by-key/text.js
+++ b/packages/slate/test/changes/by-key/wrap-block-by-key/text.js
@@ -7,17 +7,17 @@ export default function (change) {
}
export const input = (
-
+
word
-
+
)
export const output = (
-
+
@@ -25,5 +25,5 @@ export const output = (
-
+
)
diff --git a/packages/slate/test/changes/general/call/call-no-arguments.js b/packages/slate/test/changes/general/call/call-no-arguments.js
index c67101f71..dc7b83493 100644
--- a/packages/slate/test/changes/general/call/call-no-arguments.js
+++ b/packages/slate/test/changes/general/call/call-no-arguments.js
@@ -14,7 +14,7 @@ export default function (change) {
}
export const input = (
-
+
one
@@ -23,11 +23,11 @@ export const input = (
two
-
+
)
export const output = (
-
+
{' '}
@@ -39,5 +39,5 @@ export const output = (
two
-
+
)
diff --git a/packages/slate/test/changes/general/call/call-with-arguments.js b/packages/slate/test/changes/general/call/call-with-arguments.js
index 15a60fc6c..b825f7fab 100644
--- a/packages/slate/test/changes/general/call/call-with-arguments.js
+++ b/packages/slate/test/changes/general/call/call-with-arguments.js
@@ -14,7 +14,7 @@ export default function (change) {
}
export const input = (
-
+
one
@@ -23,11 +23,11 @@ export const input = (
two
-
+
)
export const output = (
-
+
{' '}
@@ -39,5 +39,5 @@ export const output = (
two
-
+
)
diff --git a/packages/slate/test/changes/index.js b/packages/slate/test/changes/index.js
index ea4f07ebd..963fcf11c 100644
--- a/packages/slate/test/changes/index.js
+++ b/packages/slate/test/changes/index.js
@@ -30,7 +30,7 @@ describe('changes', async () => {
const change = input.change()
fn(change)
const opts = { preserveSelection: true, preserveData: true }
- const actual = change.state.toJSON(opts)
+ const actual = change.value.toJSON(opts)
const expected = output.toJSON(opts)
assert.deepEqual(actual, expected)
})
diff --git a/packages/slate/test/changes/on-selection/blur/basic.js b/packages/slate/test/changes/on-selection/blur/basic.js
index 5cae0f0a2..6ed2def84 100644
--- a/packages/slate/test/changes/on-selection/blur/basic.js
+++ b/packages/slate/test/changes/on-selection/blur/basic.js
@@ -7,21 +7,21 @@ export default function (change) {
}
export const input = (
-
+
one
-
+
)
export const output = (
-
+
one
-
+
)
diff --git a/packages/slate/test/changes/on-selection/collapse-to-anchor/already-collapsed.js b/packages/slate/test/changes/on-selection/collapse-to-anchor/already-collapsed.js
index abfbd7fdb..0f76bd508 100644
--- a/packages/slate/test/changes/on-selection/collapse-to-anchor/already-collapsed.js
+++ b/packages/slate/test/changes/on-selection/collapse-to-anchor/already-collapsed.js
@@ -7,21 +7,21 @@ export default function (change) {
}
export const input = (
-
+
on e
-
+
)
export const output = (
-
+
on e
-
+
)
diff --git a/packages/slate/test/changes/on-selection/collapse-to-anchor/basic.js b/packages/slate/test/changes/on-selection/collapse-to-anchor/basic.js
index 1bb9eb033..4a90c4938 100644
--- a/packages/slate/test/changes/on-selection/collapse-to-anchor/basic.js
+++ b/packages/slate/test/changes/on-selection/collapse-to-anchor/basic.js
@@ -7,21 +7,21 @@ export default function (change) {
}
export const input = (
-
+
one
-
+
)
export const output = (
-
+
one
-
+
)
diff --git a/packages/slate/test/changes/on-selection/collapse-to-end/already-collapsed.js b/packages/slate/test/changes/on-selection/collapse-to-end/already-collapsed.js
index d1232421b..8ccdf4c7f 100644
--- a/packages/slate/test/changes/on-selection/collapse-to-end/already-collapsed.js
+++ b/packages/slate/test/changes/on-selection/collapse-to-end/already-collapsed.js
@@ -7,21 +7,21 @@ export default function (change) {
}
export const input = (
-
+
on e
-
+
)
export const output = (
-
+
on e
-
+
)
diff --git a/packages/slate/test/changes/on-selection/collapse-to-end/basic.js b/packages/slate/test/changes/on-selection/collapse-to-end/basic.js
index 3a79a7d2e..19a7b94d6 100644
--- a/packages/slate/test/changes/on-selection/collapse-to-end/basic.js
+++ b/packages/slate/test/changes/on-selection/collapse-to-end/basic.js
@@ -7,21 +7,21 @@ export default function (change) {
}
export const input = (
-
+
one
-
+
)
export const output = (
-
+
one
-
+
)
diff --git a/packages/slate/test/changes/on-selection/collapse-to-end/void.js b/packages/slate/test/changes/on-selection/collapse-to-end/void.js
index b3c1f1581..1cc1d95e8 100644
--- a/packages/slate/test/changes/on-selection/collapse-to-end/void.js
+++ b/packages/slate/test/changes/on-selection/collapse-to-end/void.js
@@ -7,21 +7,21 @@ export default function (change) {
}
export const input = (
-
+
{' '}
-
+
)
export const output = (
-
+
{' '}
-
+
)
diff --git a/packages/slate/test/changes/on-selection/collapse-to-focus/already-collapsed.js b/packages/slate/test/changes/on-selection/collapse-to-focus/already-collapsed.js
index b993ea655..c3bd182fb 100644
--- a/packages/slate/test/changes/on-selection/collapse-to-focus/already-collapsed.js
+++ b/packages/slate/test/changes/on-selection/collapse-to-focus/already-collapsed.js
@@ -7,21 +7,21 @@ export default function (change) {
}
export const input = (
-
+
one
-
+
)
export const output = (
-
+
one
-
+
)
diff --git a/packages/slate/test/changes/on-selection/collapse-to-focus/basic.js b/packages/slate/test/changes/on-selection/collapse-to-focus/basic.js
index 5980f1f22..4be87eef7 100644
--- a/packages/slate/test/changes/on-selection/collapse-to-focus/basic.js
+++ b/packages/slate/test/changes/on-selection/collapse-to-focus/basic.js
@@ -7,21 +7,21 @@ export default function (change) {
}
export const input = (
-
+
one
-
+
)
export const output = (
-
+
one
-
+
)
diff --git a/packages/slate/test/changes/on-selection/collapse-to-start/already-collapsed.js b/packages/slate/test/changes/on-selection/collapse-to-start/already-collapsed.js
index 1eb2d57aa..fcb0b5cda 100644
--- a/packages/slate/test/changes/on-selection/collapse-to-start/already-collapsed.js
+++ b/packages/slate/test/changes/on-selection/collapse-to-start/already-collapsed.js
@@ -7,21 +7,21 @@ export default function (change) {
}
export const input = (
-
+
on e
-
+
)
export const output = (
-
+
on e
-
+
)
diff --git a/packages/slate/test/changes/on-selection/collapse-to-start/basic.js b/packages/slate/test/changes/on-selection/collapse-to-start/basic.js
index 49c6f8d8c..c65b82702 100644
--- a/packages/slate/test/changes/on-selection/collapse-to-start/basic.js
+++ b/packages/slate/test/changes/on-selection/collapse-to-start/basic.js
@@ -7,21 +7,21 @@ export default function (change) {
}
export const input = (
-
+
one
-
+
)
export const output = (
-
+
one
-
+
)
diff --git a/packages/slate/test/changes/on-selection/collapse-to-start/void.js b/packages/slate/test/changes/on-selection/collapse-to-start/void.js
index 600b311a0..edb61f401 100644
--- a/packages/slate/test/changes/on-selection/collapse-to-start/void.js
+++ b/packages/slate/test/changes/on-selection/collapse-to-start/void.js
@@ -7,21 +7,21 @@ export default function (change) {
}
export const input = (
-
+
{' '}
-
+
)
export const output = (
-
+
{' '}
-
+
)
diff --git a/packages/slate/test/changes/on-selection/focus/basic.js b/packages/slate/test/changes/on-selection/focus/basic.js
index d2df21a1d..9c9d920d8 100644
--- a/packages/slate/test/changes/on-selection/focus/basic.js
+++ b/packages/slate/test/changes/on-selection/focus/basic.js
@@ -7,17 +7,17 @@ export default function (change) {
}
export const input = (
-
+
one
-
+
)
export const output = (
-
+
one
-
+
)
diff --git a/packages/slate/test/changes/on-selection/move-to/with-object.js b/packages/slate/test/changes/on-selection/move-to/with-object.js
index 9ca60a573..b4e26bf7d 100644
--- a/packages/slate/test/changes/on-selection/move-to/with-object.js
+++ b/packages/slate/test/changes/on-selection/move-to/with-object.js
@@ -3,8 +3,8 @@
import h from '../../../helpers/h'
export default function (change) {
- const { state } = change
- const { startText } = state
+ const { value } = change
+ const { startText } = value
change.select({
anchorKey: startText.key,
anchorOffset: 0,
@@ -14,21 +14,21 @@ export default function (change) {
}
export const input = (
-
+
one
-
+
)
export const output = (
-
+
one
-
+
)
diff --git a/packages/slate/test/changes/on-selection/move-to/with-selection.js b/packages/slate/test/changes/on-selection/move-to/with-selection.js
index a78c1eb3f..349b3fbeb 100644
--- a/packages/slate/test/changes/on-selection/move-to/with-selection.js
+++ b/packages/slate/test/changes/on-selection/move-to/with-selection.js
@@ -3,8 +3,8 @@
import h from '../../../helpers/h'
export default function (change) {
- const { state } = change
- const { selection, startText } = state
+ const { value } = change
+ const { selection, startText } = value
const range = selection.merge({
anchorKey: startText.key,
anchorOffset: 0,
@@ -16,21 +16,21 @@ export default function (change) {
}
export const input = (
-
+
one
-
+
)
export const output = (
-
+
one
-
+
)
diff --git a/packages/slate/test/changes/on-selection/select-all/basic.js b/packages/slate/test/changes/on-selection/select-all/basic.js
index 694735cd9..43ff220d1 100644
--- a/packages/slate/test/changes/on-selection/select-all/basic.js
+++ b/packages/slate/test/changes/on-selection/select-all/basic.js
@@ -7,7 +7,7 @@ export default function (change) {
}
export const input = (
-
+
one
@@ -19,11 +19,11 @@ export const input = (
three
-
+
)
export const output = (
-
+
one
@@ -35,5 +35,5 @@ export const output = (
three
-
+
)
diff --git a/packages/slate/test/changes/on-state/set-data/simple.js b/packages/slate/test/changes/on-state/set-data/simple.js
index db8d1e37a..580e3b0f0 100644
--- a/packages/slate/test/changes/on-state/set-data/simple.js
+++ b/packages/slate/test/changes/on-state/set-data/simple.js
@@ -3,11 +3,11 @@
import h from '../../../helpers/h'
export default function (change) {
- change.setState({ data: { thing: 'value' }})
+ change.setValue({ data: { thing: 'value' }})
}
export const input = (
-
+
word
@@ -16,11 +16,11 @@ export const input = (
another
-
+
)
export const output = (
-
+
word
@@ -29,5 +29,5 @@ export const output = (
another
-
+
)
diff --git a/packages/slate/test/history/undo/add-mark-across-blocks.js b/packages/slate/test/history/undo/add-mark-across-blocks.js
index 8de23eb7e..ee08000c5 100644
--- a/packages/slate/test/history/undo/add-mark-across-blocks.js
+++ b/packages/slate/test/history/undo/add-mark-across-blocks.js
@@ -2,18 +2,18 @@
import h from '../../helpers/h'
-export default function (state) {
- return state
+export default function (value) {
+ return value
.change()
.addMark('bold')
- .state
+ .value
.change()
.undo()
- .state
+ .value
}
export const input = (
-
+
o ne
@@ -22,7 +22,7 @@ export const input = (
tw o
-
+
)
export const output = input
diff --git a/packages/slate/test/history/undo/add-mark-across-marks.js b/packages/slate/test/history/undo/add-mark-across-marks.js
index 0c2801502..459f72dc6 100644
--- a/packages/slate/test/history/undo/add-mark-across-marks.js
+++ b/packages/slate/test/history/undo/add-mark-across-marks.js
@@ -2,24 +2,24 @@
import h from '../../helpers/h'
-export default function (state) {
- return state
+export default function (value) {
+ return value
.change()
.addMark('bold')
- .state
+ .value
.change()
.undo()
- .state
+ .value
}
export const input = (
-
+
w o r d
-
+
)
export const output = input
diff --git a/packages/slate/test/history/undo/add-mark-across-same-mark.js b/packages/slate/test/history/undo/add-mark-across-same-mark.js
index 5cb20e303..3013aad83 100644
--- a/packages/slate/test/history/undo/add-mark-across-same-mark.js
+++ b/packages/slate/test/history/undo/add-mark-across-same-mark.js
@@ -2,24 +2,24 @@
import h from '../../helpers/h'
-export default function (state) {
- return state
+export default function (value) {
+ return value
.change()
.addMark('bold')
- .state
+ .value
.change()
.undo()
- .state
+ .value
}
export const input = (
-
+
w o r d
-
+
)
export const output = input
diff --git a/packages/slate/test/history/undo/add-mark.js b/packages/slate/test/history/undo/add-mark.js
index 86327eaaf..4311baca8 100644
--- a/packages/slate/test/history/undo/add-mark.js
+++ b/packages/slate/test/history/undo/add-mark.js
@@ -2,24 +2,24 @@
import h from '../../helpers/h'
-export default function (state) {
- return state
+export default function (value) {
+ return value
.change()
.addMark('bold')
- .state
+ .value
.change()
.undo()
- .state
+ .value
}
export const input = (
-
+
wo rd
-
+
)
export const output = input
diff --git a/packages/slate/test/history/undo/delete-across-blocks.js b/packages/slate/test/history/undo/delete-across-blocks.js
index 91c2157a6..40fa3db58 100644
--- a/packages/slate/test/history/undo/delete-across-blocks.js
+++ b/packages/slate/test/history/undo/delete-across-blocks.js
@@ -2,18 +2,18 @@
import h from '../../helpers/h'
-export default function (state) {
- return state
+export default function (value) {
+ return value
.change()
.delete()
- .state
+ .value
.change()
.undo()
- .state
+ .value
}
export const input = (
-
+
o ne
@@ -22,7 +22,7 @@ export const input = (
tw o
-
+
)
export const output = input
diff --git a/packages/slate/test/history/undo/delete-across-inlines.js b/packages/slate/test/history/undo/delete-across-inlines.js
index 6e66a2959..483df4994 100644
--- a/packages/slate/test/history/undo/delete-across-inlines.js
+++ b/packages/slate/test/history/undo/delete-across-inlines.js
@@ -2,18 +2,18 @@
import h from '../../helpers/h'
-export default function (state) {
- return state
+export default function (value) {
+ return value
.change()
.delete()
- .state
+ .value
.change()
.undo()
- .state
+ .value
}
export const input = (
-
+
o ne
@@ -22,7 +22,7 @@ export const input = (
tw o
-
+
)
export const output = input
diff --git a/packages/slate/test/history/undo/delete-across-marks.js b/packages/slate/test/history/undo/delete-across-marks.js
index 4a120a62a..f53a6a656 100644
--- a/packages/slate/test/history/undo/delete-across-marks.js
+++ b/packages/slate/test/history/undo/delete-across-marks.js
@@ -2,24 +2,24 @@
import h from '../../helpers/h'
-export default function (state) {
- return state
+export default function (value) {
+ return value
.change()
.delete()
- .state
+ .value
.change()
.undo()
- .state
+ .value
}
export const input = (
-
+
on e tw o
-
+
)
export const output = input
diff --git a/packages/slate/test/history/undo/delete.js b/packages/slate/test/history/undo/delete.js
index cc0ca97e7..213208773 100644
--- a/packages/slate/test/history/undo/delete.js
+++ b/packages/slate/test/history/undo/delete.js
@@ -2,24 +2,24 @@
import h from '../../helpers/h'
-export default function (state) {
- return state
+export default function (value) {
+ return value
.change()
.delete()
- .state
+ .value
.change()
.undo()
- .state
+ .value
}
export const input = (
-
+
wo rd
-
+
)
export const output = input
diff --git a/packages/slate/test/history/undo/insert-block.js b/packages/slate/test/history/undo/insert-block.js
index b8da6bc1d..40c2bcc4c 100644
--- a/packages/slate/test/history/undo/insert-block.js
+++ b/packages/slate/test/history/undo/insert-block.js
@@ -2,22 +2,22 @@
import h from '../../helpers/h'
-export default function (state) {
- return state
+export default function (value) {
+ return value
.change()
.insertBlock('quote')
- .state
+ .value
.change()
.undo()
- .state
+ .value
}
export const input = (
-
+
one
-
+
)
export const output = input
diff --git a/packages/slate/test/history/undo/insert-text-contiguous.js b/packages/slate/test/history/undo/insert-text-contiguous.js
index 10cc1437b..7b9e2453c 100644
--- a/packages/slate/test/history/undo/insert-text-contiguous.js
+++ b/packages/slate/test/history/undo/insert-text-contiguous.js
@@ -2,28 +2,28 @@
import h from '../../helpers/h'
-export default function (state) {
- return state
+export default function (value) {
+ return value
.change()
.insertText('t')
- .state
+ .value
.change()
.insertText('w')
- .state
+ .value
.change()
.insertText('o')
- .state
+ .value
.change()
.undo()
- .state
+ .value
}
export const input = (
-
+
one
-
+
)
export const output = input
diff --git a/packages/slate/test/history/undo/insert-text-not-contiguous.js b/packages/slate/test/history/undo/insert-text-not-contiguous.js
index 6f53312b6..bb0c821f6 100644
--- a/packages/slate/test/history/undo/insert-text-not-contiguous.js
+++ b/packages/slate/test/history/undo/insert-text-not-contiguous.js
@@ -2,36 +2,36 @@
import h from '../../helpers/h'
-export default function (state) {
- return state
+export default function (value) {
+ return value
.change()
.insertText('t')
- .state
+ .value
.change()
.move(-1)
.insertText('w')
- .state
+ .value
.change()
.move(-1)
.insertText('o')
- .state
+ .value
.change()
.undo()
- .state
+ .value
}
export const input = (
-
+
one
-
+
)
export const output = (
-
+
onew t
-
+
)
diff --git a/packages/slate/test/history/undo/insert-text.js b/packages/slate/test/history/undo/insert-text.js
index 465bff82c..a6429f5a6 100644
--- a/packages/slate/test/history/undo/insert-text.js
+++ b/packages/slate/test/history/undo/insert-text.js
@@ -2,24 +2,24 @@
import h from '../../helpers/h'
-export default function (state) {
- return state
+export default function (value) {
+ return value
.change()
.insertText('text')
- .state
+ .value
.change()
.undo()
- .state
+ .value
}
export const input = (
-
+
one
-
+
)
export const output = input
diff --git a/packages/slate/test/history/undo/move-node-by-key.js b/packages/slate/test/history/undo/move-node-by-key.js
index 481bb3029..f32c2c0b8 100644
--- a/packages/slate/test/history/undo/move-node-by-key.js
+++ b/packages/slate/test/history/undo/move-node-by-key.js
@@ -2,18 +2,18 @@
import h from '../../helpers/h'
-export default function (state) {
- return state
+export default function (value) {
+ return value
.change()
.moveNodeByKey('b', 'a', 1)
- .state
+ .value
.change()
.undo()
- .state
+ .value
}
export const input = (
-
+
one
@@ -22,7 +22,7 @@ export const input = (
two
-
+
)
export const output = input
diff --git a/packages/slate/test/history/undo/remove-mark.js b/packages/slate/test/history/undo/remove-mark.js
index e80fb7ac8..760a1956e 100644
--- a/packages/slate/test/history/undo/remove-mark.js
+++ b/packages/slate/test/history/undo/remove-mark.js
@@ -2,24 +2,24 @@
import h from '../../helpers/h'
-export default function (state) {
- return state
+export default function (value) {
+ return value
.change()
.removeMark('bold')
- .state
+ .value
.change()
.undo()
- .state
+ .value
}
export const input = (
-
+
one
-
+
)
export const output = input
diff --git a/packages/slate/test/history/undo/remove-node-by-key.js b/packages/slate/test/history/undo/remove-node-by-key.js
index 2a239e694..160f0a51d 100644
--- a/packages/slate/test/history/undo/remove-node-by-key.js
+++ b/packages/slate/test/history/undo/remove-node-by-key.js
@@ -2,24 +2,24 @@
import h from '../../helpers/h'
-export default function (state) {
- return state
+export default function (value) {
+ return value
.change()
.removeNodeByKey('a')
- .state
+ .value
.change()
.undo()
- .state
+ .value
}
export const input = (
-
+
one
-
+
)
export const output = input
diff --git a/packages/slate/test/history/undo/set-node-by-key-with-data.js b/packages/slate/test/history/undo/set-node-by-key-with-data.js
index 85349e38b..719161842 100644
--- a/packages/slate/test/history/undo/set-node-by-key-with-data.js
+++ b/packages/slate/test/history/undo/set-node-by-key-with-data.js
@@ -2,26 +2,26 @@
import h from '../../helpers/h'
-export default function (state) {
- return state
+export default function (value) {
+ return value
.change()
.setNodeByKey('a', {
data: { thing: 'value' }
})
- .state
+ .value
.change()
.undo()
- .state
+ .value
}
export const input = (
-
+
one
-
+
)
export const output = input
diff --git a/packages/slate/test/history/undo/split-node-by-key-block.js b/packages/slate/test/history/undo/split-node-by-key-block.js
index a724ed350..dc5ce92a1 100644
--- a/packages/slate/test/history/undo/split-node-by-key-block.js
+++ b/packages/slate/test/history/undo/split-node-by-key-block.js
@@ -2,24 +2,24 @@
import h from '../../helpers/h'
-export default function (state) {
- return state
+export default function (value) {
+ return value
.change()
.splitNodeByKey('a', 2)
- .state
+ .value
.change()
.undo()
- .state
+ .value
}
export const input = (
-
+
one two
-
+
)
export const output = input
diff --git a/packages/slate/test/history/undo/unwrap-node-by-key.js b/packages/slate/test/history/undo/unwrap-node-by-key.js
index 6d5f359d4..2bb60fb74 100644
--- a/packages/slate/test/history/undo/unwrap-node-by-key.js
+++ b/packages/slate/test/history/undo/unwrap-node-by-key.js
@@ -2,18 +2,18 @@
import h from '../../helpers/h'
-export default function (state) {
- return state
+export default function (value) {
+ return value
.change()
.unwrapNodeByKey('a')
- .state
+ .value
.change()
.undo()
- .state
+ .value
}
export const input = (
-
+
@@ -27,7 +27,7 @@ export const input = (
-
+
)
export const output = input
diff --git a/packages/slate/test/index.js b/packages/slate/test/index.js
index 27495f1cf..6871abd08 100644
--- a/packages/slate/test/index.js
+++ b/packages/slate/test/index.js
@@ -23,7 +23,7 @@ describe('slate', () => {
})
/**
- * Reset Slate's internal state before each text.
+ * Reset Slate's internal key generator state before each text.
*/
beforeEach(() => {
diff --git a/packages/slate/test/schema/core/block-create-text.js b/packages/slate/test/schema/core/block-create-text.js
index 5bb6d0117..89fcd4b97 100644
--- a/packages/slate/test/schema/core/block-create-text.js
+++ b/packages/slate/test/schema/core/block-create-text.js
@@ -5,15 +5,15 @@ import h from '../../helpers/h'
export const schema = {}
export const input = (
-
+
-
+
)
export const output = {
- kind: 'state',
+ kind: 'value',
document: {
kind: 'document',
data: {},
diff --git a/packages/slate/test/schema/core/document-no-inline-children.js b/packages/slate/test/schema/core/document-no-inline-children.js
index 394af4229..d68f4d019 100644
--- a/packages/slate/test/schema/core/document-no-inline-children.js
+++ b/packages/slate/test/schema/core/document-no-inline-children.js
@@ -5,7 +5,7 @@ import h from '../../helpers/h'
export const schema = {}
export const input = (
-
+
one
@@ -14,11 +14,11 @@ export const input = (
two
-
+
)
export const output = {
- kind: 'state',
+ kind: 'value',
document: {
kind: 'document',
data: {},
diff --git a/packages/slate/test/schema/core/document-no-text-children.js b/packages/slate/test/schema/core/document-no-text-children.js
index aee967957..e6dc485ca 100644
--- a/packages/slate/test/schema/core/document-no-text-children.js
+++ b/packages/slate/test/schema/core/document-no-text-children.js
@@ -5,18 +5,18 @@ import h from '../../helpers/h'
export const schema = {}
export const input = (
-
+
one
two
-
+
)
export const output = {
- kind: 'state',
+ kind: 'value',
document: {
kind: 'document',
data: {},
diff --git a/packages/slate/test/schema/core/inline-no-block-children.js b/packages/slate/test/schema/core/inline-no-block-children.js
index b6fb6bdfd..3239d387e 100644
--- a/packages/slate/test/schema/core/inline-no-block-children.js
+++ b/packages/slate/test/schema/core/inline-no-block-children.js
@@ -5,7 +5,7 @@ import h from '../../helpers/h'
export const schema = {}
export const input = (
-
+
@@ -16,11 +16,11 @@ export const input = (
-
+
)
export const output = {
- kind: 'state',
+ kind: 'value',
document: {
kind: 'document',
data: {},
diff --git a/packages/slate/test/schema/core/inline-text-around.js b/packages/slate/test/schema/core/inline-text-around.js
index 9d30711ce..24b6efefd 100644
--- a/packages/slate/test/schema/core/inline-text-around.js
+++ b/packages/slate/test/schema/core/inline-text-around.js
@@ -5,7 +5,7 @@ import h from '../../helpers/h'
export const schema = {}
export const input = (
-
+
@@ -18,11 +18,11 @@ export const input = (
-
+
)
export const output = {
- kind: 'state',
+ kind: 'value',
document: {
kind: 'document',
data: {},
diff --git a/packages/slate/test/schema/core/remove-empty-inline.js b/packages/slate/test/schema/core/remove-empty-inline.js
index d61454d5d..525ea3221 100644
--- a/packages/slate/test/schema/core/remove-empty-inline.js
+++ b/packages/slate/test/schema/core/remove-empty-inline.js
@@ -5,17 +5,17 @@ import h from '../../helpers/h'
export const schema = {}
export const input = (
-
+
-
+
)
export const output = {
- kind: 'state',
+ kind: 'value',
document: {
kind: 'document',
data: {},
diff --git a/packages/slate/test/schema/custom/child-kind-invalid-custom.js b/packages/slate/test/schema/custom/child-kind-invalid-custom.js
index 75bf810cb..15449f938 100644
--- a/packages/slate/test/schema/custom/child-kind-invalid-custom.js
+++ b/packages/slate/test/schema/custom/child-kind-invalid-custom.js
@@ -19,17 +19,17 @@ export const schema = {
}
export const input = (
-
+
text
-
+
)
export const output = (
-
+
@@ -37,5 +37,5 @@ export const output = (
-
+
)
diff --git a/packages/slate/test/schema/custom/child-kind-invalid-default.js b/packages/slate/test/schema/custom/child-kind-invalid-default.js
index dfea71580..0d8fd65cc 100644
--- a/packages/slate/test/schema/custom/child-kind-invalid-default.js
+++ b/packages/slate/test/schema/custom/child-kind-invalid-default.js
@@ -14,19 +14,19 @@ export const schema = {
}
export const input = (
-
+
text
-
+
)
export const output = (
-
+
-
+
)
diff --git a/packages/slate/test/schema/custom/child-required-custom.js b/packages/slate/test/schema/custom/child-required-custom.js
index 8619890e5..41377860d 100644
--- a/packages/slate/test/schema/custom/child-required-custom.js
+++ b/packages/slate/test/schema/custom/child-required-custom.js
@@ -19,22 +19,22 @@ export const schema = {
}
export const input = (
-
+
-
+
)
export const output = (
-
+
-
+
)
diff --git a/packages/slate/test/schema/custom/child-required-default.js b/packages/slate/test/schema/custom/child-required-default.js
index a075c0696..d63afe74a 100644
--- a/packages/slate/test/schema/custom/child-required-default.js
+++ b/packages/slate/test/schema/custom/child-required-default.js
@@ -14,15 +14,15 @@ export const schema = {
}
export const input = (
-
+
-
+
)
export const output = (
-
+
-
+
)
diff --git a/packages/slate/test/schema/custom/child-type-invalid-custom.js b/packages/slate/test/schema/custom/child-type-invalid-custom.js
index 0811a750f..c6d26a648 100644
--- a/packages/slate/test/schema/custom/child-type-invalid-custom.js
+++ b/packages/slate/test/schema/custom/child-type-invalid-custom.js
@@ -19,17 +19,17 @@ export const schema = {
}
export const input = (
-
+
-
+
)
export const output = (
-
+
@@ -37,5 +37,5 @@ export const output = (
-
+
)
diff --git a/packages/slate/test/schema/custom/child-type-invalid-default.js b/packages/slate/test/schema/custom/child-type-invalid-default.js
index c76c9bb1a..6176a3c01 100644
--- a/packages/slate/test/schema/custom/child-type-invalid-default.js
+++ b/packages/slate/test/schema/custom/child-type-invalid-default.js
@@ -14,17 +14,17 @@ export const schema = {
}
export const input = (
-
+
-
+
)
export const output = (
-
+
-
+
)
diff --git a/packages/slate/test/schema/custom/child-unknown-custom.js b/packages/slate/test/schema/custom/child-unknown-custom.js
index 92f3dae9b..89457c3ef 100644
--- a/packages/slate/test/schema/custom/child-unknown-custom.js
+++ b/packages/slate/test/schema/custom/child-unknown-custom.js
@@ -22,7 +22,7 @@ export const schema = {
}
export const input = (
-
+
@@ -33,11 +33,11 @@ export const input = (
-
+
)
export const output = (
-
+
@@ -45,5 +45,5 @@ export const output = (
-
+
)
diff --git a/packages/slate/test/schema/custom/child-unknown-default.js b/packages/slate/test/schema/custom/child-unknown-default.js
index 3f9ac15ca..d3eae3716 100644
--- a/packages/slate/test/schema/custom/child-unknown-default.js
+++ b/packages/slate/test/schema/custom/child-unknown-default.js
@@ -14,7 +14,7 @@ export const schema = {
}
export const input = (
-
+
@@ -25,11 +25,11 @@ export const input = (
-
+
)
export const output = (
-
+
@@ -37,5 +37,5 @@ export const output = (
-
+
)
diff --git a/packages/slate/test/schema/custom/node-data-invalid-custom.js b/packages/slate/test/schema/custom/node-data-invalid-custom.js
index a11e6b4d8..8c3df4d80 100644
--- a/packages/slate/test/schema/custom/node-data-invalid-custom.js
+++ b/packages/slate/test/schema/custom/node-data-invalid-custom.js
@@ -18,17 +18,17 @@ export const schema = {
}
export const input = (
-
+
-
+
)
export const output = (
-
+
-
+
)
diff --git a/packages/slate/test/schema/custom/node-data-invalid-default-undefined.js b/packages/slate/test/schema/custom/node-data-invalid-default-undefined.js
index 60b9fb0c1..fcbd43d28 100644
--- a/packages/slate/test/schema/custom/node-data-invalid-default-undefined.js
+++ b/packages/slate/test/schema/custom/node-data-invalid-default-undefined.js
@@ -13,15 +13,15 @@ export const schema = {
}
export const input = (
-
+
-
+
)
export const output = (
-
+
-
+
)
diff --git a/packages/slate/test/schema/custom/node-data-invalid-default.js b/packages/slate/test/schema/custom/node-data-invalid-default.js
index 7ffc0bc4d..3af86f2dd 100644
--- a/packages/slate/test/schema/custom/node-data-invalid-default.js
+++ b/packages/slate/test/schema/custom/node-data-invalid-default.js
@@ -13,17 +13,17 @@ export const schema = {
}
export const input = (
-
+
-
+
)
export const output = (
-
+
-
+
)
diff --git a/packages/slate/test/schema/custom/node-is-void-invalid-custom.js b/packages/slate/test/schema/custom/node-is-void-invalid-custom.js
index d3ce966bc..a425bd7cd 100644
--- a/packages/slate/test/schema/custom/node-is-void-invalid-custom.js
+++ b/packages/slate/test/schema/custom/node-is-void-invalid-custom.js
@@ -16,15 +16,15 @@ export const schema = {
}
export const input = (
-
+
-
+
)
export const output = (
-
+
-
+
)
diff --git a/packages/slate/test/schema/custom/node-is-void-invalid-default.js b/packages/slate/test/schema/custom/node-is-void-invalid-default.js
index 7d637392d..05caea513 100644
--- a/packages/slate/test/schema/custom/node-is-void-invalid-default.js
+++ b/packages/slate/test/schema/custom/node-is-void-invalid-default.js
@@ -11,19 +11,19 @@ export const schema = {
}
export const input = (
-
+
-
+
)
export const output = (
-
+
{' '}
-
+
)
diff --git a/packages/slate/test/schema/custom/node-mark-invalid-custom.js b/packages/slate/test/schema/custom/node-mark-invalid-custom.js
index a9f47c508..7fd86f9ee 100644
--- a/packages/slate/test/schema/custom/node-mark-invalid-custom.js
+++ b/packages/slate/test/schema/custom/node-mark-invalid-custom.js
@@ -16,19 +16,19 @@ export const schema = {
}
export const input = (
-
+
one two three
-
+
)
export const output = (
-
+
-
+
)
diff --git a/packages/slate/test/schema/custom/node-mark-invalid-default.js b/packages/slate/test/schema/custom/node-mark-invalid-default.js
index 4d8d36436..a791e095c 100644
--- a/packages/slate/test/schema/custom/node-mark-invalid-default.js
+++ b/packages/slate/test/schema/custom/node-mark-invalid-default.js
@@ -11,21 +11,21 @@ export const schema = {
}
export const input = (
-
+
one two three
-
+
)
export const output = (
-
+
one two three
-
+
)
diff --git a/packages/slate/test/schema/custom/node-text-invalid-custom.js b/packages/slate/test/schema/custom/node-text-invalid-custom.js
index caa949fa6..02c5874a4 100644
--- a/packages/slate/test/schema/custom/node-text-invalid-custom.js
+++ b/packages/slate/test/schema/custom/node-text-invalid-custom.js
@@ -16,19 +16,19 @@ export const schema = {
}
export const input = (
-
+
invalid
-
+
)
export const output = (
-
+
-
+
)
diff --git a/packages/slate/test/schema/custom/node-text-invalid-default.js b/packages/slate/test/schema/custom/node-text-invalid-default.js
index 843bddbbc..b2d325ffc 100644
--- a/packages/slate/test/schema/custom/node-text-invalid-default.js
+++ b/packages/slate/test/schema/custom/node-text-invalid-default.js
@@ -11,17 +11,17 @@ export const schema = {
}
export const input = (
-
+
invalid
-
+
)
export const output = (
-
+
-
+
)
diff --git a/packages/slate/test/schema/custom/parent-kind-invalid-custom.js b/packages/slate/test/schema/custom/parent-kind-invalid-custom.js
index e00172110..63a425a0b 100644
--- a/packages/slate/test/schema/custom/parent-kind-invalid-custom.js
+++ b/packages/slate/test/schema/custom/parent-kind-invalid-custom.js
@@ -16,21 +16,21 @@ export const schema = {
}
export const input = (
-
+
one
-
+
)
export const output = (
-
+
one
-
+
)
diff --git a/packages/slate/test/schema/custom/parent-kind-invalid-default.js b/packages/slate/test/schema/custom/parent-kind-invalid-default.js
index e62820345..ce60c4f27 100644
--- a/packages/slate/test/schema/custom/parent-kind-invalid-default.js
+++ b/packages/slate/test/schema/custom/parent-kind-invalid-default.js
@@ -11,19 +11,19 @@ export const schema = {
}
export const input = (
-
+
one
-
+
)
export const output = (
-
+
-
+
)
diff --git a/packages/slate/test/schema/custom/parent-type-invalid-custom.js b/packages/slate/test/schema/custom/parent-type-invalid-custom.js
index 97e8d319c..5ae4953b6 100644
--- a/packages/slate/test/schema/custom/parent-type-invalid-custom.js
+++ b/packages/slate/test/schema/custom/parent-type-invalid-custom.js
@@ -17,17 +17,17 @@ export const schema = {
}
export const input = (
-
+
-
+
)
export const output = (
-
+
@@ -35,5 +35,5 @@ export const output = (
-
+
)
diff --git a/packages/slate/test/schema/custom/parent-type-invalid-default.js b/packages/slate/test/schema/custom/parent-type-invalid-default.js
index 6dc540a31..2f1b7b157 100644
--- a/packages/slate/test/schema/custom/parent-type-invalid-default.js
+++ b/packages/slate/test/schema/custom/parent-type-invalid-default.js
@@ -12,19 +12,19 @@ export const schema = {
}
export const input = (
-
+
-
+
)
export const output = (
-
+
-
+
)
diff --git a/packages/slate/test/schema/index.js b/packages/slate/test/schema/index.js
index 5811513cf..91ff67dd3 100644
--- a/packages/slate/test/schema/index.js
+++ b/packages/slate/test/schema/index.js
@@ -21,9 +21,9 @@ describe('schema', () => {
const expected = output
const actual = input
.change()
- .setState({ schema: s })
+ .setValue({ schema: s })
.normalize()
- .state.toJSON()
+ .value.toJSON()
assert.deepEqual(actual, expected)
})
@@ -42,9 +42,9 @@ describe('schema', () => {
const expected = output.toJSON()
const actual = input
.change()
- .setState({ schema: s })
+ .setValue({ schema: s })
.normalize()
- .state.toJSON()
+ .value.toJSON()
assert.deepEqual(actual, expected)
})
diff --git a/packages/slate/test/serializers/index.js b/packages/slate/test/serializers/index.js
index 3168ffc38..a9e30e582 100644
--- a/packages/slate/test/serializers/index.js
+++ b/packages/slate/test/serializers/index.js
@@ -1,7 +1,7 @@
import assert from 'assert'
import fs from 'fs'
-import { State } from '../..'
+import { Value } from '../..'
import { basename, extname, resolve } from 'path'
/**
@@ -18,7 +18,7 @@ describe('serializers', () => {
it(test, async () => {
const module = require(resolve(dir, test))
const { input, output, options } = module
- const actual = State.fromJSON(input, options).toJSON()
+ const actual = Value.fromJSON(input, options).toJSON()
const expected = output.toJSON()
assert.deepEqual(actual, expected)
})
diff --git a/packages/slate/test/serializers/raw/deserialize/block-nested.js b/packages/slate/test/serializers/raw/deserialize/block-nested.js
index 0f3724f35..6290da1bd 100644
--- a/packages/slate/test/serializers/raw/deserialize/block-nested.js
+++ b/packages/slate/test/serializers/raw/deserialize/block-nested.js
@@ -3,7 +3,7 @@
import h from '../../../helpers/h'
export const input = {
- kind: 'state',
+ kind: 'value',
document: {
kind: 'document',
data: {},
@@ -39,7 +39,7 @@ export const input = {
}
export const output = (
-
+
@@ -47,5 +47,5 @@ export const output = (
-
+
)
diff --git a/packages/slate/test/serializers/raw/deserialize/block-with-data.js b/packages/slate/test/serializers/raw/deserialize/block-with-data.js
index e98de5405..709f1ce34 100644
--- a/packages/slate/test/serializers/raw/deserialize/block-with-data.js
+++ b/packages/slate/test/serializers/raw/deserialize/block-with-data.js
@@ -3,7 +3,7 @@
import h from '../../../helpers/h'
export const input = {
- kind: 'state',
+ kind: 'value',
document: {
kind: 'document',
data: {},
@@ -33,11 +33,11 @@ export const input = {
}
export const output = (
-
+
one
-
+
)
diff --git a/packages/slate/test/serializers/raw/deserialize/block-with-is-void.js b/packages/slate/test/serializers/raw/deserialize/block-with-is-void.js
index b24da3928..09738ac12 100644
--- a/packages/slate/test/serializers/raw/deserialize/block-with-is-void.js
+++ b/packages/slate/test/serializers/raw/deserialize/block-with-is-void.js
@@ -3,7 +3,7 @@
import h from '../../../helpers/h'
export const input = {
- kind: 'state',
+ kind: 'value',
document: {
kind: 'document',
data: {},
@@ -31,9 +31,9 @@ export const input = {
}
export const output = (
-
+
-
+
)
diff --git a/packages/slate/test/serializers/raw/deserialize/block.js b/packages/slate/test/serializers/raw/deserialize/block.js
index 85ade93f8..621898fd3 100644
--- a/packages/slate/test/serializers/raw/deserialize/block.js
+++ b/packages/slate/test/serializers/raw/deserialize/block.js
@@ -3,7 +3,7 @@
import h from '../../../helpers/h'
export const input = {
- kind: 'state',
+ kind: 'value',
document: {
kind: 'document',
data: {},
@@ -31,11 +31,11 @@ export const input = {
}
export const output = (
-
+
one
-
+
)
diff --git a/packages/slate/test/serializers/raw/deserialize/inline-nested.js b/packages/slate/test/serializers/raw/deserialize/inline-nested.js
index 873042000..e55d260b4 100644
--- a/packages/slate/test/serializers/raw/deserialize/inline-nested.js
+++ b/packages/slate/test/serializers/raw/deserialize/inline-nested.js
@@ -3,7 +3,7 @@
import h from '../../../helpers/h'
export const input = {
- kind: 'state',
+ kind: 'value',
document: {
kind: 'document',
data: {},
@@ -87,7 +87,7 @@ export const input = {
}
export const output = (
-
+
@@ -97,5 +97,5 @@ export const output = (
-
+
)
diff --git a/packages/slate/test/serializers/raw/deserialize/inline-with-data.js b/packages/slate/test/serializers/raw/deserialize/inline-with-data.js
index 33b545159..d754d9cef 100644
--- a/packages/slate/test/serializers/raw/deserialize/inline-with-data.js
+++ b/packages/slate/test/serializers/raw/deserialize/inline-with-data.js
@@ -3,7 +3,7 @@
import h from '../../../helpers/h'
export const input = {
- kind: 'state',
+ kind: 'value',
document: {
kind: 'document',
data: {},
@@ -61,7 +61,7 @@ export const input = {
}
export const output = (
-
+
@@ -69,5 +69,5 @@ export const output = (
-
+
)
diff --git a/packages/slate/test/serializers/raw/deserialize/inline-with-is-void.js b/packages/slate/test/serializers/raw/deserialize/inline-with-is-void.js
index 43d952ff8..608f16fc6 100644
--- a/packages/slate/test/serializers/raw/deserialize/inline-with-is-void.js
+++ b/packages/slate/test/serializers/raw/deserialize/inline-with-is-void.js
@@ -3,7 +3,7 @@
import h from '../../../helpers/h'
export const input = {
- kind: 'state',
+ kind: 'value',
document: {
kind: 'document',
data: {},
@@ -59,11 +59,11 @@ export const input = {
}
export const output = (
-
+
-
+
)
diff --git a/packages/slate/test/serializers/raw/deserialize/inline.js b/packages/slate/test/serializers/raw/deserialize/inline.js
index 897e55cf8..b93be7bb3 100644
--- a/packages/slate/test/serializers/raw/deserialize/inline.js
+++ b/packages/slate/test/serializers/raw/deserialize/inline.js
@@ -3,7 +3,7 @@
import h from '../../../helpers/h'
export const input = {
- kind: 'state',
+ kind: 'value',
document: {
kind: 'document',
data: {},
@@ -59,7 +59,7 @@ export const input = {
}
export const output = (
-
+
@@ -67,5 +67,5 @@ export const output = (
-
+
)
diff --git a/packages/slate/test/serializers/raw/deserialize/range-with-mark.js b/packages/slate/test/serializers/raw/deserialize/range-with-mark.js
index 81349670f..7aec5f345 100644
--- a/packages/slate/test/serializers/raw/deserialize/range-with-mark.js
+++ b/packages/slate/test/serializers/raw/deserialize/range-with-mark.js
@@ -3,7 +3,7 @@
import h from '../../../helpers/h'
export const input = {
- kind: 'state',
+ kind: 'value',
document: {
kind: 'document',
data: {},
@@ -47,11 +47,11 @@ export const input = {
}
export const output = (
-
+
on e
-
+
)
diff --git a/packages/slate/test/serializers/raw/serialize/block-nested.js b/packages/slate/test/serializers/raw/serialize/block-nested.js
index 9e82886c4..378055ad2 100644
--- a/packages/slate/test/serializers/raw/serialize/block-nested.js
+++ b/packages/slate/test/serializers/raw/serialize/block-nested.js
@@ -3,7 +3,7 @@
import h from '../../../helpers/h'
export const input = (
-
+
@@ -11,11 +11,11 @@ export const input = (
-
+
)
export const output = {
- kind: 'state',
+ kind: 'value',
document: {
kind: 'document',
data: {},
diff --git a/packages/slate/test/serializers/raw/serialize/block-with-data.js b/packages/slate/test/serializers/raw/serialize/block-with-data.js
index 78e919f52..9f4aad8f0 100644
--- a/packages/slate/test/serializers/raw/serialize/block-with-data.js
+++ b/packages/slate/test/serializers/raw/serialize/block-with-data.js
@@ -3,17 +3,17 @@
import h from '../../../helpers/h'
export const input = (
-
+
one
-
+
)
export const output = {
- kind: 'state',
+ kind: 'value',
document: {
kind: 'document',
data: {},
diff --git a/packages/slate/test/serializers/raw/serialize/block-with-is-void.js b/packages/slate/test/serializers/raw/serialize/block-with-is-void.js
index 453af3f1f..fb5a082dc 100644
--- a/packages/slate/test/serializers/raw/serialize/block-with-is-void.js
+++ b/packages/slate/test/serializers/raw/serialize/block-with-is-void.js
@@ -3,15 +3,15 @@
import h from '../../../helpers/h'
export const input = (
-
+
-
+
)
export const output = {
- kind: 'state',
+ kind: 'value',
document: {
kind: 'document',
data: {},
diff --git a/packages/slate/test/serializers/raw/serialize/block.js b/packages/slate/test/serializers/raw/serialize/block.js
index f3c8ed7f6..cc375998a 100644
--- a/packages/slate/test/serializers/raw/serialize/block.js
+++ b/packages/slate/test/serializers/raw/serialize/block.js
@@ -3,17 +3,17 @@
import h from '../../../helpers/h'
export const input = (
-
+
one
-
+
)
export const output = {
- kind: 'state',
+ kind: 'value',
document: {
kind: 'document',
data: {},
diff --git a/packages/slate/test/serializers/raw/serialize/inline-nested.js b/packages/slate/test/serializers/raw/serialize/inline-nested.js
index c28f10968..c735bf50e 100644
--- a/packages/slate/test/serializers/raw/serialize/inline-nested.js
+++ b/packages/slate/test/serializers/raw/serialize/inline-nested.js
@@ -3,7 +3,7 @@
import h from '../../../helpers/h'
export const input = (
-
+
@@ -13,11 +13,11 @@ export const input = (
-
+
)
export const output = {
- kind: 'state',
+ kind: 'value',
document: {
kind: 'document',
data: {},
diff --git a/packages/slate/test/serializers/raw/serialize/inline-with-data.js b/packages/slate/test/serializers/raw/serialize/inline-with-data.js
index b366dc6d0..552f57c2d 100644
--- a/packages/slate/test/serializers/raw/serialize/inline-with-data.js
+++ b/packages/slate/test/serializers/raw/serialize/inline-with-data.js
@@ -3,7 +3,7 @@
import h from '../../../helpers/h'
export const input = (
-
+
@@ -11,11 +11,11 @@ export const input = (
-
+
)
export const output = {
- kind: 'state',
+ kind: 'value',
document: {
kind: 'document',
data: {},
diff --git a/packages/slate/test/serializers/raw/serialize/inline-with-is-void.js b/packages/slate/test/serializers/raw/serialize/inline-with-is-void.js
index 33092489b..c6fb1f036 100644
--- a/packages/slate/test/serializers/raw/serialize/inline-with-is-void.js
+++ b/packages/slate/test/serializers/raw/serialize/inline-with-is-void.js
@@ -3,17 +3,17 @@
import h from '../../../helpers/h'
export const input = (
-
+
-
+
)
export const output = {
- kind: 'state',
+ kind: 'value',
document: {
kind: 'document',
data: {},
diff --git a/packages/slate/test/serializers/raw/serialize/inline.js b/packages/slate/test/serializers/raw/serialize/inline.js
index d20606c94..a6a27821c 100644
--- a/packages/slate/test/serializers/raw/serialize/inline.js
+++ b/packages/slate/test/serializers/raw/serialize/inline.js
@@ -3,7 +3,7 @@
import h from '../../../helpers/h'
export const input = (
-
+
@@ -11,11 +11,11 @@ export const input = (
-
+
)
export const output = {
- kind: 'state',
+ kind: 'value',
document: {
kind: 'document',
data: {},
diff --git a/packages/slate/test/serializers/raw/serialize/preserve-data.js b/packages/slate/test/serializers/raw/serialize/preserve-data.js
index a3212a31e..4c12940ef 100644
--- a/packages/slate/test/serializers/raw/serialize/preserve-data.js
+++ b/packages/slate/test/serializers/raw/serialize/preserve-data.js
@@ -3,17 +3,17 @@
import h from '../../../helpers/h'
export const input = (
-
+
one
-
+
)
export const output = {
- kind: 'state',
+ kind: 'value',
data: {},
document: {
kind: 'document',
diff --git a/packages/slate/test/serializers/raw/serialize/preserve-keys.js b/packages/slate/test/serializers/raw/serialize/preserve-keys.js
index f579932cc..bb98fd263 100644
--- a/packages/slate/test/serializers/raw/serialize/preserve-keys.js
+++ b/packages/slate/test/serializers/raw/serialize/preserve-keys.js
@@ -3,17 +3,17 @@
import h from '../../../helpers/h'
export const input = (
-
+
one
-
+
)
export const output = {
- kind: 'state',
+ kind: 'value',
document: {
kind: 'document',
key: '4',
diff --git a/packages/slate/test/serializers/raw/serialize/preserve-selection-and-keys.js b/packages/slate/test/serializers/raw/serialize/preserve-selection-and-keys.js
index 20c2040b7..9e794a784 100644
--- a/packages/slate/test/serializers/raw/serialize/preserve-selection-and-keys.js
+++ b/packages/slate/test/serializers/raw/serialize/preserve-selection-and-keys.js
@@ -3,17 +3,17 @@
import h from '../../../helpers/h'
export const input = (
-
+
one
-
+
)
export const output = {
- kind: 'state',
+ kind: 'value',
document: {
kind: 'document',
key: '4',
diff --git a/packages/slate/test/serializers/raw/serialize/preserve-selection.js b/packages/slate/test/serializers/raw/serialize/preserve-selection.js
index 6d95afdf3..d9c340d75 100644
--- a/packages/slate/test/serializers/raw/serialize/preserve-selection.js
+++ b/packages/slate/test/serializers/raw/serialize/preserve-selection.js
@@ -3,17 +3,17 @@
import h from '../../../helpers/h'
export const input = (
-
+
one
-
+
)
export const output = {
- kind: 'state',
+ kind: 'value',
document: {
kind: 'document',
data: {},
diff --git a/packages/slate/test/serializers/raw/serialize/range-with-mark.js b/packages/slate/test/serializers/raw/serialize/range-with-mark.js
index 42b55c4db..e2a1db400 100644
--- a/packages/slate/test/serializers/raw/serialize/range-with-mark.js
+++ b/packages/slate/test/serializers/raw/serialize/range-with-mark.js
@@ -3,17 +3,17 @@
import h from '../../../helpers/h'
export const input = (
-
+
on e
-
+
)
export const output = {
- kind: 'state',
+ kind: 'value',
document: {
kind: 'document',
data: {},