refactor(client): use different approach for disabling code background

This commit is contained in:
Elian Doran 2025-05-29 14:45:55 +03:00
parent e29e711861
commit 844fb3cfb7
No known key found for this signature in database
2 changed files with 5 additions and 5 deletions

View File

@ -80,7 +80,7 @@ export default class AbstractCodeTypeWidget extends TypeWidget {
show() {
this.$widget.show();
this.#updateBackgroundColor();
this.updateBackgroundColor();
}
focus() {
@ -98,7 +98,7 @@ export default class AbstractCodeTypeWidget extends TypeWidget {
this.codeEditor.setText("");
});
}
this.#updateBackgroundColor("unset");
this.updateBackgroundColor("unset");
}
async executeWithCodeEditorEvent({ resolve, ntxId }: EventData<"executeWithCodeEditor">) {
@ -119,7 +119,7 @@ export default class AbstractCodeTypeWidget extends TypeWidget {
if (theme) {
await this.codeEditor.setTheme(theme);
}
this.#updateBackgroundColor();
this.updateBackgroundColor();
}
}
@ -128,7 +128,7 @@ export default class AbstractCodeTypeWidget extends TypeWidget {
}
}
#updateBackgroundColor(color?: string) {
updateBackgroundColor(color?: string) {
const $editorEl = $(this.codeEditor.dom);
this.$widget.closest(".scrolling-container").css("background-color", color ?? $editorEl.css("background-color"));
}

View File

@ -34,7 +34,6 @@ const TPL = /*html*/`\
.note-detail-split-preview-col {
position: relative;
background: var(--main-background-color);
}
.note-detail-split .note-detail-split-editor {
@ -132,6 +131,7 @@ export default abstract class AbstractSplitTypeWidget extends TypeWidget {
constructor() {
super();
this.editorTypeWidget = new EditableCodeTypeWidget();
this.editorTypeWidget.updateBackgroundColor = () => {};
this.editorTypeWidget.isEnabled = () => true;
const defaultOptions = this.editorTypeWidget.getExtraOpts();