mirror of
https://github.com/ianstormtaylor/slate.git
synced 2025-08-29 01:50:06 +02:00
change selectAll to not focus, and add docs
This commit is contained in:
@@ -49,6 +49,7 @@ Transform methods can either operate on the [`Document`](./document.md), the [`S
|
|||||||
- [`moveOffsetsTo`](#moveoffsetsto)
|
- [`moveOffsetsTo`](#moveoffsetsto)
|
||||||
- [`moveToRangeOf`](#movetorangeof)
|
- [`moveToRangeOf`](#movetorangeof)
|
||||||
- [`moveTo`](#moveto)
|
- [`moveTo`](#moveto)
|
||||||
|
- [`selectAll`](#selectall)
|
||||||
- [Node Transforms](#node-transforms)
|
- [Node Transforms](#node-transforms)
|
||||||
- [`addMarkByKey`](#addmarkbykey)
|
- [`addMarkByKey`](#addmarkbykey)
|
||||||
- [`insertNodeByKey`](#insertnodebykey)
|
- [`insertNodeByKey`](#insertnodebykey)
|
||||||
@@ -285,15 +286,20 @@ Move the current selection's offsets by `n`.
|
|||||||
|
|
||||||
Move the current selection's offsets to a new `anchorOffset` and `focusOffset`.
|
Move the current selection's offsets to a new `anchorOffset` and `focusOffset`.
|
||||||
|
|
||||||
|
### `moveTo`
|
||||||
|
`moveTo(properties: Selection || Object) => Transform`
|
||||||
|
|
||||||
|
Move the current selection to a selection with merged `properties`. The `properties` can either be a [`Selection`](./selection.md) object or a plain Javascript object of selection properties.
|
||||||
|
|
||||||
### `moveToRangeOf`
|
### `moveToRangeOf`
|
||||||
`moveToRangeOf(node: Node) => Transform`
|
`moveToRangeOf(node: Node) => Transform`
|
||||||
|
|
||||||
Move the current selection's anchor point to the start of a `node` and its focus point to the end of the `node`.
|
Move the current selection's anchor point to the start of a `node` and its focus point to the end of the `node`.
|
||||||
|
|
||||||
### `moveTo`
|
### `selectAll`
|
||||||
`moveTo(properties: Selection || Object) => Transform`
|
`selectAll() => Transform`
|
||||||
|
|
||||||
Move the current selection to a selection with merged `properties`. The `properties` can either be a [`Selection`](./selection.md) object or a plain Javascript object of selection properties.
|
Select the entire document and focus the selection.
|
||||||
|
|
||||||
|
|
||||||
## Node Transforms
|
## Node Transforms
|
||||||
|
@@ -30,9 +30,7 @@ Transforms.select = (transform, properties) => {
|
|||||||
Transforms.selectAll = (transform) => {
|
Transforms.selectAll = (transform) => {
|
||||||
const { state } = transform
|
const { state } = transform
|
||||||
const { document, selection } = state
|
const { document, selection } = state
|
||||||
const next = selection
|
const next = selection.moveToRangeOf(document)
|
||||||
.moveToRangeOf(document)
|
|
||||||
.focus()
|
|
||||||
transform.setSelectionOperation(next)
|
transform.setSelectionOperation(next)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -14,7 +14,6 @@ export default function (state) {
|
|||||||
anchorOffset: 0,
|
anchorOffset: 0,
|
||||||
focusKey: '4',
|
focusKey: '4',
|
||||||
focusOffset: 5,
|
focusOffset: 5,
|
||||||
isFocused: true
|
|
||||||
})
|
})
|
||||||
|
|
||||||
assert.deepEqual(
|
assert.deepEqual(
|
||||||
|
Reference in New Issue
Block a user