From 112b7c84069f57cf8e69fd4a59fc5866953dd6cd Mon Sep 17 00:00:00 2001 From: Samy Pesse Date: Sat, 22 Oct 2016 20:04:54 +0200 Subject: [PATCH] Don't normalize document when selection is changing --- src/models/transform.js | 5 +++-- src/plugins/core.js | 4 +++- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/src/models/transform.js b/src/models/transform.js index 856135c46..b7b62cf1a 100644 --- a/src/models/transform.js +++ b/src/models/transform.js @@ -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 diff --git a/src/plugins/core.js b/src/plugins/core.js index 5220818c8..b2a65082c 100644 --- a/src/plugins/core.js +++ b/src/plugins/core.js @@ -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 }) } /**