diff --git a/panels/strudel.html b/panels/strudel.html
index 69bea11..12940e7 100644
--- a/panels/strudel.html
+++ b/panels/strudel.html
@@ -17,13 +17,7 @@
const strudel = new StrudelSession({
onError: (...args) => send('onError', args),
- onHighlight: (docId, phase, haps) => {
- const settings = window.parent.getSettings();
- if (!settings.strudelHighlightsEnabled) {
- return;
- }
- highlightMiniLocations(editorViews.get(docId), phase, haps);
- },
+ onHighlight: (docId, phase, haps) => highlightMiniLocations(editorViews.get(docId), phase, haps),
onUpdateMiniLocations: (docId, miniLocations) => updateMiniLocations(editorViews.get(docId), miniLocations),
});
diff --git a/src/settings.js b/src/settings.js
index 3a22e7b..1162104 100644
--- a/src/settings.js
+++ b/src/settings.js
@@ -75,7 +75,6 @@ const pastingModeCheckbox = document.querySelector('#settings-pasting-mode');
const fontFamilySelect = document.querySelector('#settings-font-family');
const strudelHighlightsEnabledCheckbox = document.querySelector('#settings-strudel-highlights-enabled');
-console.log(strudelCheckbox.checked);
function inferSettingsFromDom() {
const inferredSettings = {
username: usernameInput?.value ?? defaultSettings.username,
@@ -198,8 +197,11 @@ export async function applySettingsToNudel(settings = getSettings()) {
// Clear all active strudel highlights if the setting is turned off
if (isSettingChanged('strudelHighlightsEnabled', diff)) {
- if (!next.strudelHighlightsEnabled) {
+ if (next.strudelHighlightsEnabled) {
+ window.strudel?.framer?.start();
+ } else {
clearStrudelHighlights();
+ window.strudel?.framer?.stop();
}
}
diff --git a/src/strudel.js b/src/strudel.js
index f21784d..89177a8 100644
--- a/src/strudel.js
+++ b/src/strudel.js
@@ -110,7 +110,15 @@ export class StrudelSession {
console.error('[strudel] draw error', err);
},
);
- this.framer.start(); // tbd allow disabling highlighting
+
+ const settings = window.parent.getSettings?.();
+ if (!settings) {
+ throw new Error(`Couldn't get nudel settings within strudel`);
+ }
+
+ if (settings.strudelHighlightsEnabled) {
+ this.framer.start();
+ }
}
hush() {