fixup! delay colorview for invisible CMs

This commit is contained in:
tophf 2020-11-13 22:01:53 +03:00
parent 3905722cdf
commit d0bb996e1e

View File

@ -73,6 +73,11 @@
const height = cm.display.lastWrapHeight; const height = cm.display.lastWrapHeight;
if (!height || !textHeight) return; if (!height || !textHeight) return;
maxRenderChunkSize = Math.max(20, Math.ceil(height / textHeight)); maxRenderChunkSize = Math.max(20, Math.ceil(height / textHeight));
const state = cm.state.colorpicker;
if (state.colorizeOnUpdate) {
state.colorizeOnUpdate = false;
colorizeAll(state);
}
cm.off('update', CM_EVENTS.update); cm.off('update', CM_EVENTS.update);
}, },
mousedown(cm, event) { mousedown(cm, event) {
@ -166,7 +171,7 @@
const {cm} = state; const {cm} = state;
const {viewFrom, viewTo} = cm.display; const {viewFrom, viewTo} = cm.display;
if (!viewTo) { if (!viewTo) {
requestAnimationFrame(() => colorizeAll(state)); state.colorizeOnUpdate = true;
return; return;
} }
const {curOp} = cm; const {curOp} = cm;