mirror of
https://github.com/TriliumNext/Notes.git
synced 2025-07-27 10:02:59 +08:00
refactor(client): use different approach for disabling code background
This commit is contained in:
parent
e29e711861
commit
844fb3cfb7
@ -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"));
|
||||
}
|
||||
|
@ -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();
|
||||
|
Loading…
x
Reference in New Issue
Block a user