mirror of
https://github.com/ianstormtaylor/slate.git
synced 2025-08-21 22:45:18 +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} merge
|
||||
* @property {Boolean} save
|
||||
* @property {Boolean} normalize
|
||||
* @return {State} state
|
||||
*/
|
||||
|
||||
apply(options = {}) {
|
||||
let transform = this
|
||||
let { merge, save, isNative = false, normalize = true } = options
|
||||
|
||||
// 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 { history } = state
|
||||
let { undos, redos } = history
|
||||
|
@@ -681,7 +681,9 @@ function Plugin(options = {}) {
|
||||
return state
|
||||
.transform()
|
||||
.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