1
0
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:
Samy Pesse
2016-10-22 20:04:54 +02:00
parent f31ac63e97
commit 112b7c8406
2 changed files with 6 additions and 3 deletions

View File

@@ -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

View File

@@ -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 })
}
/**