The media bbcode button is injected by the bbcode plugin
authorAlexander Ebert <ebert@woltlab.com>
Sun, 7 May 2023 13:20:52 +0000 (15:20 +0200)
committerAlexander Ebert <ebert@woltlab.com>
Sun, 7 May 2023 13:20:52 +0000 (15:20 +0200)
Fixes WoltLab/editor#48

ts/WoltLabSuite/Core/Component/Ckeditor/Configuration.ts
wcfsetup/install/files/js/WoltLabSuite/Core/Component/Ckeditor/Configuration.js

index 786b85dfa04883d7c092d339757fbdd09966bdbb..2ca76e50d1471f3585c28549e6891c43bfb88572 100644 (file)
@@ -186,12 +186,6 @@ class ConfigurationBuilder {
       this.#removePlugins.push("HtmlEmbed");
     }
 
-    if (this.#features.media) {
-      items.push("woltlabBbcode_media");
-    } else {
-      this.#removePlugins.push("WoltlabMedia");
-    }
-
     if (items.length > 0) {
       this.#toolbar.push({
         label: getPhrase("wcf.editor.button.group.block"),
@@ -205,6 +199,12 @@ class ConfigurationBuilder {
     this.#toolbar.push(this.#divider);
   }
 
+  #setupMedia(): void {
+    if (!this.#features.media) {
+      this.#removePlugins.push("WoltlabMedia");
+    }
+  }
+
   #setupMention(): void {
     if (!this.#features.mention) {
       this.#removePlugins.push("Mention", "WoltlabMention");
@@ -254,6 +254,7 @@ class ConfigurationBuilder {
 
     this.#insertDivider();
 
+    this.#setupMedia();
     this.#setupMention();
   }
 
index 2b11a0ee77186c063fd9be56f90725b6da0d4b27..45a9f935b9fcafa1c91c98590eff433e1a334535 100644 (file)
@@ -171,12 +171,6 @@ define(["require", "exports", "../../Language"], function (require, exports, Lan
             else {
                 this.#removePlugins.push("HtmlEmbed");
             }
-            if (this.#features.media) {
-                items.push("woltlabBbcode_media");
-            }
-            else {
-                this.#removePlugins.push("WoltlabMedia");
-            }
             if (items.length > 0) {
                 this.#toolbar.push({
                     label: (0, Language_1.getPhrase)("wcf.editor.button.group.block"),
@@ -188,6 +182,11 @@ define(["require", "exports", "../../Language"], function (require, exports, Lan
         #insertDivider() {
             this.#toolbar.push(this.#divider);
         }
+        #setupMedia() {
+            if (!this.#features.media) {
+                this.#removePlugins.push("WoltlabMedia");
+            }
+        }
         #setupMention() {
             if (!this.#features.mention) {
                 this.#removePlugins.push("Mention", "WoltlabMention");
@@ -223,6 +222,7 @@ define(["require", "exports", "../../Language"], function (require, exports, Lan
             this.#setupImage();
             this.#setupBlocks();
             this.#insertDivider();
+            this.#setupMedia();
             this.#setupMention();
         }
         toConfig() {