client: Hide ribbon tab when classic editor is off

This commit is contained in:
Elian Doran 2024-11-09 14:54:04 +02:00
parent c421e75f55
commit 6e0a10cf2c
No known key found for this signature in database

View File

@ -1,4 +1,5 @@
import { t } from "../../services/i18n.js"; import { t } from "../../services/i18n.js";
import options from "../../services/options.js";
import NoteContextAwareWidget from "../note_context_aware_widget.js"; import NoteContextAwareWidget from "../note_context_aware_widget.js";
const TPL = `\ const TPL = `\
@ -26,6 +27,9 @@ const TPL = `\
* Handles the editing toolbar when the CKEditor is in decoupled mode. * Handles the editing toolbar when the CKEditor is in decoupled mode.
* *
* <p> * <p>
* This toolbar is only enabled if the user has selected the classic CKEditor.
*
* <p>
* The ribbon item is active by default for text notes, as long as they are not in read-only mode. * The ribbon item is active by default for text notes, as long as they are not in read-only mode.
*/ */
export default class ClassicEditorToolbar extends NoteContextAwareWidget { export default class ClassicEditorToolbar extends NoteContextAwareWidget {
@ -48,6 +52,10 @@ export default class ClassicEditorToolbar extends NoteContextAwareWidget {
} }
async #shouldDisplay() { async #shouldDisplay() {
if (options.get("textNoteEditorType") !== "ckeditor-classic") {
return false;
}
if (this.note.type !== "text") { if (this.note.type !== "text") {
return false; return false;
} }