Skip the mention plugins when disabled
authorAlexander Ebert <ebert@woltlab.com>
Wed, 5 Apr 2023 17:23:17 +0000 (19:23 +0200)
committerAlexander Ebert <ebert@woltlab.com>
Wed, 5 Apr 2023 17:23:17 +0000 (19:23 +0200)
ts/WoltLabSuite/Core/Component/Ckeditor/Configuration.ts
wcfsetup/install/files/js/WoltLabSuite/Core/Component/Ckeditor/Configuration.js

index 10edf00c8304ed232a2f70d56d69a5a82ed7ae17..e6d032651b31cfd7d6bcfca16b26f60c0834491d 100644 (file)
@@ -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 {
index 92bbcf431e537eeb1d08c4ba2c2bec6b3f6c5138..215b9dafe70024c168488ba082a5e00670302343 100644 (file)
@@ -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.