mirror of
https://github.com/ianstormtaylor/slate.git
synced 2025-09-01 03:11:44 +02:00
add moveToOffsets transform, fixes #70
This commit is contained in:
@@ -456,6 +456,22 @@ class Selection extends new Record(DEFAULTS) {
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* Move the selection to `anchor` and `focus` offsets.
|
||||
*
|
||||
* @param {Number} anchor
|
||||
* @param {Number} focus (optional)
|
||||
* @return {Selection} selection
|
||||
*/
|
||||
|
||||
moveToOffsets(anchor, focus = anchor) {
|
||||
return this.merge({
|
||||
anchorOffset: anchor,
|
||||
focusOffset: focus,
|
||||
isBackward: null
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* Extend the focus point forward `n` characters.
|
||||
*
|
||||
|
@@ -61,6 +61,7 @@ const SELECTION_TRANSFORMS = [
|
||||
'moveToEnd',
|
||||
'moveToEndOf',
|
||||
'moveToFocus',
|
||||
'moveToOffsets',
|
||||
'moveToRangeOf',
|
||||
'moveToStart',
|
||||
'moveToStartOf'
|
||||
|
Reference in New Issue
Block a user