mirror of
https://github.com/TriliumNext/Notes.git
synced 2025-07-28 10:32:27 +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() {
|
show() {
|
||||||
this.$widget.show();
|
this.$widget.show();
|
||||||
this.#updateBackgroundColor();
|
this.updateBackgroundColor();
|
||||||
}
|
}
|
||||||
|
|
||||||
focus() {
|
focus() {
|
||||||
@ -98,7 +98,7 @@ export default class AbstractCodeTypeWidget extends TypeWidget {
|
|||||||
this.codeEditor.setText("");
|
this.codeEditor.setText("");
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
this.#updateBackgroundColor("unset");
|
this.updateBackgroundColor("unset");
|
||||||
}
|
}
|
||||||
|
|
||||||
async executeWithCodeEditorEvent({ resolve, ntxId }: EventData<"executeWithCodeEditor">) {
|
async executeWithCodeEditorEvent({ resolve, ntxId }: EventData<"executeWithCodeEditor">) {
|
||||||
@ -119,7 +119,7 @@ export default class AbstractCodeTypeWidget extends TypeWidget {
|
|||||||
if (theme) {
|
if (theme) {
|
||||||
await this.codeEditor.setTheme(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);
|
const $editorEl = $(this.codeEditor.dom);
|
||||||
this.$widget.closest(".scrolling-container").css("background-color", color ?? $editorEl.css("background-color"));
|
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 {
|
.note-detail-split-preview-col {
|
||||||
position: relative;
|
position: relative;
|
||||||
background: var(--main-background-color);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.note-detail-split .note-detail-split-editor {
|
.note-detail-split .note-detail-split-editor {
|
||||||
@ -132,6 +131,7 @@ export default abstract class AbstractSplitTypeWidget extends TypeWidget {
|
|||||||
constructor() {
|
constructor() {
|
||||||
super();
|
super();
|
||||||
this.editorTypeWidget = new EditableCodeTypeWidget();
|
this.editorTypeWidget = new EditableCodeTypeWidget();
|
||||||
|
this.editorTypeWidget.updateBackgroundColor = () => {};
|
||||||
this.editorTypeWidget.isEnabled = () => true;
|
this.editorTypeWidget.isEnabled = () => true;
|
||||||
|
|
||||||
const defaultOptions = this.editorTypeWidget.getExtraOpts();
|
const defaultOptions = this.editorTypeWidget.getExtraOpts();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user