Skip to content

Build your personal knowledge base with Trilium Notes

fix(popup_editor): classic editor toolbar displayed when it shouldn't

Elian Doran63dc5697ddd4
diff --git a/apps/client/src/widgets/ribbon_widgets/classic_editor_toolbar.ts b/apps/client/src/widgets/ribbon_widgets/classic_editor_toolbar.ts
index 43d6a3d2db..a4974ff244 100644
--- a/apps/client/src/widgets/ribbon_widgets/classic_editor_toolbar.ts
+++ b/apps/client/src/widgets/ribbon_widgets/classic_editor_toolbar.ts
@@ -48,6 +48,18 @@ export default class ClassicEditorToolbar extends NoteContextAwareWidget {
this.contentSized();
}
+ isEnabled(): boolean | null | undefined {
+ if (options.get("textNoteEditorType") !== "ckeditor-classic") {
+ return false;
+ }
+
+ if (!this.note || this.note.type !== "text") {
+ return false;
+ }
+
+ return true;
+ }
+
async getTitle() {
return {
show: await this.#shouldDisplay(),
@@ -58,11 +70,7 @@ export default class ClassicEditorToolbar extends NoteContextAwareWidget {
}
async #shouldDisplay() {
- if (options.get("textNoteEditorType") !== "ckeditor-classic") {
- return false;
- }
-
- if (!this.note || this.note.type !== "text") {
+ if (!this.isEnabled()) {
return false;
}