From 463c3b5139124bffcc7e6551de2c864195c9fb9b Mon Sep 17 00:00:00 2001 From: tophf Date: Tue, 8 Dec 2020 14:40:57 +0300 Subject: [PATCH] fix subsequent clicks in colorpicker seems like new CodeMirror modifies the position object --- vendor-overwrites/colorpicker/colorview.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/vendor-overwrites/colorpicker/colorview.js b/vendor-overwrites/colorpicker/colorview.js index e96890a0..6aea3c2f 100644 --- a/vendor-overwrites/colorpicker/colorview.js +++ b/vendor-overwrites/colorpicker/colorview.js @@ -555,8 +555,9 @@ } const {cm, line, ch, embedderCallback} = this; const to = {line, ch: ch + this.prevColor.length}; - if (cm.getRange(this, to) !== newColor) { - cm.replaceRange(newColor, this, to, '*colorpicker'); + const from = {line, ch}; + if (cm.getRange(from, to) !== newColor) { + cm.replaceRange(newColor, from, to, '*colorpicker'); this.prevColor = newColor; } if (typeof embedderCallback === 'function') {