From c030f456c3d06c4be604d20bd0d26dc74651f42f Mon Sep 17 00:00:00 2001 From: Felix Roos Date: Fri, 3 Nov 2023 13:50:18 +0100 Subject: [PATCH] widget support --- packages/codemirror/codemirror.mjs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/packages/codemirror/codemirror.mjs b/packages/codemirror/codemirror.mjs index 57a81fb86..a6721543e 100644 --- a/packages/codemirror/codemirror.mjs +++ b/packages/codemirror/codemirror.mjs @@ -11,6 +11,7 @@ import { flash, isFlashEnabled } from './flash.mjs'; import { highlightMiniLocations, isPatternHighlightingEnabled, updateMiniLocations } from './highlight.mjs'; import { keybindings } from './keybindings.mjs'; import { theme } from './themes.mjs'; +import { updateWidgets } from './slider.mjs'; const extensions = { isLineWrappingEnabled: (on) => (on ? EditorView.lineWrapping : []), @@ -87,6 +88,7 @@ export class StrudelMirror { this.code = initialCode; this.root = root; this.miniLocations = []; + this.widgets = []; this.painters = []; this.onDraw = onDraw; const self = this; @@ -127,6 +129,8 @@ export class StrudelMirror { afterEval: (options) => { // remember for when highlighting is toggled on this.miniLocations = options.meta?.miniLocations; + this.widgets = options.meta?.widgets; + updateWidgets(this.editor, this.widgets); updateMiniLocations(this.editor, this.miniLocations); replOptions?.afterEval?.(options); this.drawer.invalidate();