From 16270c605abfbb45ad9df61197b001e99a3f9eb4 Mon Sep 17 00:00:00 2001 From: Alexander Ebert Date: Thu, 27 Apr 2023 17:15:04 +0200 Subject: [PATCH] Add the phrase for the spoiler button See WoltLab/editor#35 --- com.woltlab.wcf/templates/wysiwyg.tpl | 1 + ts/WoltLabSuite/Core/Component/Ckeditor/Configuration.ts | 3 +++ wcfsetup/install/files/acp/templates/wysiwyg.tpl | 1 + .../js/WoltLabSuite/Core/Component/Ckeditor/Configuration.js | 2 ++ 4 files changed, 7 insertions(+) diff --git a/com.woltlab.wcf/templates/wysiwyg.tpl b/com.woltlab.wcf/templates/wysiwyg.tpl index 6d44038537..df4ebee570 100644 --- a/com.woltlab.wcf/templates/wysiwyg.tpl +++ b/com.woltlab.wcf/templates/wysiwyg.tpl @@ -12,6 +12,7 @@ {jsphrase name='wcf.editor.button.group.block'} {jsphrase name='wcf.editor.button.group.format'} {jsphrase name='wcf.editor.button.group.list'} + {jsphrase name='wcf.editor.button.spoiler'} {jsphrase name='wcf.editor.restoreDraft'} const element = document.getElementById('{$wysiwygSelector|encodeJS}'); diff --git a/ts/WoltLabSuite/Core/Component/Ckeditor/Configuration.ts b/ts/WoltLabSuite/Core/Component/Ckeditor/Configuration.ts index 3c06171ff3..fb5eebc37a 100644 --- a/ts/WoltLabSuite/Core/Component/Ckeditor/Configuration.ts +++ b/ts/WoltLabSuite/Core/Component/Ckeditor/Configuration.ts @@ -242,6 +242,9 @@ class ConfigurationBuilder { toConfig(): EditorConfig { const language = Object.keys(window.CKEDITOR_TRANSLATIONS).find((language) => language !== "en"); + const key = language ? language : "en"; + window.CKEDITOR_TRANSLATIONS[key].dictionary["Spoiler"] = getPhrase("wcf.editor.button.spoiler"); + // TODO: The typings are both incompleted and outdated. return { alignment: { diff --git a/wcfsetup/install/files/acp/templates/wysiwyg.tpl b/wcfsetup/install/files/acp/templates/wysiwyg.tpl index 6d44038537..df4ebee570 100644 --- a/wcfsetup/install/files/acp/templates/wysiwyg.tpl +++ b/wcfsetup/install/files/acp/templates/wysiwyg.tpl @@ -12,6 +12,7 @@ {jsphrase name='wcf.editor.button.group.block'} {jsphrase name='wcf.editor.button.group.format'} {jsphrase name='wcf.editor.button.group.list'} + {jsphrase name='wcf.editor.button.spoiler'} {jsphrase name='wcf.editor.restoreDraft'} const element = document.getElementById('{$wysiwygSelector|encodeJS}'); 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 8205f37ec5..bbf535d360 100644 --- a/wcfsetup/install/files/js/WoltLabSuite/Core/Component/Ckeditor/Configuration.js +++ b/wcfsetup/install/files/js/WoltLabSuite/Core/Component/Ckeditor/Configuration.js @@ -209,6 +209,8 @@ define(["require", "exports", "../../Language"], function (require, exports, Lan } toConfig() { const language = Object.keys(window.CKEDITOR_TRANSLATIONS).find((language) => language !== "en"); + const key = language ? language : "en"; + window.CKEDITOR_TRANSLATIONS[key].dictionary["Spoiler"] = (0, Language_1.getPhrase)("wcf.editor.button.spoiler"); // TODO: The typings are both incompleted and outdated. return { alignment: { -- 2.20.1