Add option to turn it on/off

This commit is contained in:
2023-10-29 23:09:09 +01:00
parent a105028f10
commit 32368f73ca
7 changed files with 39 additions and 11 deletions

View File

@ -21,6 +21,7 @@ import { loadSamples } from "./API";
import { tryEvaluate } from "./Evaluator";
import { inlineHoveringTips } from "./documentation/inlineHelp";
import { lineNumbers } from "@codemirror/view";
import { jsCompletions } from "./EditorSetup";
export const installInterfaceLogic = (app: Editor) => {
(app.interface.line_numbers_checkbox as HTMLInputElement).checked =
@ -28,6 +29,8 @@ export const installInterfaceLogic = (app: Editor) => {
(app.interface.time_position_checkbox as HTMLInputElement).checked =
app.settings.time_position;
(app.interface.tips_checkbox as HTMLInputElement).checked = app.settings.tips;
(app.interface.completion_checkbox as HTMLInputElement).checked = app.settings.completions;
(app.interface.midi_clock_checkbox as HTMLInputElement).checked =
app.settings.send_clock;
(app.interface.midi_channels_scripts as HTMLInputElement).checked =
@ -378,6 +381,18 @@ export const installInterfaceLogic = (app: Editor) => {
});
});
app.interface.completion_checkbox.addEventListener("change", () => {
let checked = (app.interface.completion_checkbox as HTMLInputElement).checked
? true
: false;
app.settings.completions = checked;
app.view.dispatch({
effects: app.completionsCompartment.reconfigure(
checked ? jsCompletions : []
),
});
});
app.interface.midi_clock_checkbox.addEventListener("change", () => {
let checked = (app.interface.midi_clock_checkbox as HTMLInputElement)
.checked