mirror of
https://github.com/ianstormtaylor/slate.git
synced 2025-08-22 06:53:25 +02:00
Don't normalize document when selection is changing
This commit is contained in:
@@ -47,16 +47,17 @@ class Transform {
|
|||||||
* @property {Boolean} isNative
|
* @property {Boolean} isNative
|
||||||
* @property {Boolean} merge
|
* @property {Boolean} merge
|
||||||
* @property {Boolean} save
|
* @property {Boolean} save
|
||||||
|
* @property {Boolean} normalize
|
||||||
* @return {State} state
|
* @return {State} state
|
||||||
*/
|
*/
|
||||||
|
|
||||||
apply(options = {}) {
|
apply(options = {}) {
|
||||||
let transform = this
|
let transform = this
|
||||||
|
let { merge, save, isNative = false, normalize = true } = options
|
||||||
|
|
||||||
// Ensure that the state is normalized.
|
// Ensure that the state is normalized.
|
||||||
transform = transform.normalize()
|
if (normalize) transform = transform.normalize()
|
||||||
|
|
||||||
let { merge, save, isNative = false } = options
|
|
||||||
let { state, operations } = transform
|
let { state, operations } = transform
|
||||||
let { history } = state
|
let { history } = state
|
||||||
let { undos, redos } = history
|
let { undos, redos } = history
|
||||||
|
@@ -681,7 +681,9 @@ function Plugin(options = {}) {
|
|||||||
return state
|
return state
|
||||||
.transform()
|
.transform()
|
||||||
.moveTo(selection)
|
.moveTo(selection)
|
||||||
.apply()
|
// Since the document has not changed, We only normalize the selection
|
||||||
|
.normalizeSelection()
|
||||||
|
.apply({ normalize: false })
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Reference in New Issue
Block a user