From 58b72f8c99792579780c424936bb59b13b663c73 Mon Sep 17 00:00:00 2001 From: Alexander Ebert Date: Sun, 7 May 2023 15:20:52 +0200 Subject: [PATCH] The media bbcode button is injected by the bbcode plugin Fixes WoltLab/editor#48 --- .../Core/Component/Ckeditor/Configuration.ts | 13 +++++++------ .../Core/Component/Ckeditor/Configuration.js | 12 ++++++------ 2 files changed, 13 insertions(+), 12 deletions(-) diff --git a/ts/WoltLabSuite/Core/Component/Ckeditor/Configuration.ts b/ts/WoltLabSuite/Core/Component/Ckeditor/Configuration.ts index 786b85dfa0..2ca76e50d1 100644 --- a/ts/WoltLabSuite/Core/Component/Ckeditor/Configuration.ts +++ b/ts/WoltLabSuite/Core/Component/Ckeditor/Configuration.ts @@ -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(); } 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 2b11a0ee77..45a9f935b9 100644 --- a/wcfsetup/install/files/js/WoltLabSuite/Core/Component/Ckeditor/Configuration.js +++ b/wcfsetup/install/files/js/WoltLabSuite/Core/Component/Ckeditor/Configuration.js @@ -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() { -- 2.20.1