Build your personal knowledge base with Trilium Notes
TypeScript electronelectron-appknowledge-baseknowledge-graphknowledge-managementknowledge-management-graphlocal-firstnote-managmentnote-takernote-takingnotebooknotesnotes-apppersonal-knowledge-basepersonal-wikiscriptableself-hostedself-hostingwiki
refactor(client): use different approach for disabling code background
Elian Doran844fb3cfb7ab
diff --git a/apps/client/src/widgets/type_widgets/abstract_code_type_widget.ts b/apps/client/src/widgets/type_widgets/abstract_code_type_widget.tsindex 2db3e00314..7343455ade 100644--- a/apps/client/src/widgets/type_widgets/abstract_code_type_widget.ts+++ b/apps/client/src/widgets/type_widgets/abstract_code_type_widget.ts@@ -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"));}diff --git a/apps/client/src/widgets/type_widgets/abstract_split_type_widget.ts b/apps/client/src/widgets/type_widgets/abstract_split_type_widget.tsindex 70081283a3..23a4da942a 100644--- a/apps/client/src/widgets/type_widgets/abstract_split_type_widget.ts+++ b/apps/client/src/widgets/type_widgets/abstract_split_type_widget.ts@@ -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();