From a24c486130034cd195a6bf8df279b0e83eccfcba Mon Sep 17 00:00:00 2001 From: Alexander Ebert Date: Wed, 5 Apr 2023 19:23:17 +0200 Subject: [PATCH] Skip the mention plugins when disabled --- ts/WoltLabSuite/Core/Component/Ckeditor/Configuration.ts | 8 ++++++++ .../WoltLabSuite/Core/Component/Ckeditor/Configuration.js | 6 ++++++ 2 files changed, 14 insertions(+) diff --git a/ts/WoltLabSuite/Core/Component/Ckeditor/Configuration.ts b/ts/WoltLabSuite/Core/Component/Ckeditor/Configuration.ts index 10edf00c83..e6d032651b 100644 --- a/ts/WoltLabSuite/Core/Component/Ckeditor/Configuration.ts +++ b/ts/WoltLabSuite/Core/Component/Ckeditor/Configuration.ts @@ -183,6 +183,12 @@ class ConfigurationBuilder { this.#toolbar.push(this.#divider); } + #setupMention(): void { + if (!this.#features.mention) { + this.#removePlugins.push("Mention", "WoltlabMention"); + } + } + #getToolbar(): ToolbarConfig { let allowDivider = false; const toolbar = this.#toolbar.filter((item) => { @@ -225,6 +231,8 @@ class ConfigurationBuilder { this.#setupBlocks(); this.#insertDivider(); + + this.#setupMention(); } toConfig(): EditorConfig { diff --git a/wcfsetup/install/files/js/WoltLabSuite/Core/Component/Ckeditor/Configuration.js b/wcfsetup/install/files/js/WoltLabSuite/Core/Component/Ckeditor/Configuration.js index 92bbcf431e..215b9dafe7 100644 --- a/wcfsetup/install/files/js/WoltLabSuite/Core/Component/Ckeditor/Configuration.js +++ b/wcfsetup/install/files/js/WoltLabSuite/Core/Component/Ckeditor/Configuration.js @@ -167,6 +167,11 @@ define(["require", "exports", "../../Language"], function (require, exports, Lan #insertDivider() { this.#toolbar.push(this.#divider); } + #setupMention() { + if (!this.#features.mention) { + this.#removePlugins.push("Mention", "WoltlabMention"); + } + } #getToolbar() { let allowDivider = false; const toolbar = this.#toolbar.filter((item) => { @@ -197,6 +202,7 @@ define(["require", "exports", "../../Language"], function (require, exports, Lan this.#setupImage(); this.#setupBlocks(); this.#insertDivider(); + this.#setupMention(); } toConfig() { // TODO: The typings are both incompleted and outdated. -- 2.20.1