From: Cyperghost Date: Mon, 7 Oct 2024 06:44:39 +0000 (+0200) Subject: Disable some editor features for comments X-Git-Tag: 6.1.0_RC_1~10^2~1^2 X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=9b174b7ac0008e9d596b495933229e5fd5034372;p=GitHub%2FWoltLab%2FWCF.git Disable some editor features for comments --- diff --git a/com.woltlab.wcf/templates/commentEditor.tpl b/com.woltlab.wcf/templates/commentEditor.tpl index 3584ef3768..cd031b7b15 100644 --- a/com.woltlab.wcf/templates/commentEditor.tpl +++ b/com.woltlab.wcf/templates/commentEditor.tpl @@ -3,7 +3,7 @@ data-disable-attachments="true" data-support-mention="true" >{$comment->message} -{include file='messageFormTabsInline'} +{include file='messageFormTabsInline' wysiwygContainerID=$wysiwygSelector wysiwygSelector=$wysiwygSelector}
@@ -13,4 +13,10 @@
-{include file='wysiwyg'} + + +{include file='wysiwyg' wysiwygSelector=$wysiwygSelector} diff --git a/com.woltlab.wcf/templates/commentResponseEditor.tpl b/com.woltlab.wcf/templates/commentResponseEditor.tpl index 6ff740e259..732b971e4d 100644 --- a/com.woltlab.wcf/templates/commentResponseEditor.tpl +++ b/com.woltlab.wcf/templates/commentResponseEditor.tpl @@ -3,7 +3,7 @@ data-disable-attachments="true" data-support-mention="true" >{$response->message} -{include file='messageFormTabsInline'} +{include file='messageFormTabsInline' wysiwygContainerID=$wysiwygSelector wysiwygSelector=$wysiwygSelector}
@@ -13,4 +13,10 @@
-{include file='wysiwyg'} + + +{include file='wysiwyg' wysiwygSelector=$wysiwygSelector} diff --git a/ts/WoltLabSuite/Core/Component/Comment/Add.ts b/ts/WoltLabSuite/Core/Component/Comment/Add.ts index d01fa5f2ec..879ed19aa0 100644 --- a/ts/WoltLabSuite/Core/Component/Comment/Add.ts +++ b/ts/WoltLabSuite/Core/Component/Comment/Add.ts @@ -70,12 +70,7 @@ export class CommentAdd { void this.#submit(); }); - listenToCkeditor(this.#textarea).setupFeatures(({ features }) => { - features.heading = false; - features.quoteBlock = false; - features.spoiler = false; - features.table = false; - }); + setCommentEditorFeatures(this.#textarea); } /** @@ -237,3 +232,12 @@ export class CommentAdd { } } } + +export function setCommentEditorFeatures(textarea: HTMLTextAreaElement): void { + listenToCkeditor(textarea).setupFeatures(({ features }) => { + features.heading = false; + features.quoteBlock = false; + features.spoiler = false; + features.table = false; + }); +} diff --git a/wcfsetup/install/files/js/WoltLabSuite/Core/Component/Comment/Add.js b/wcfsetup/install/files/js/WoltLabSuite/Core/Component/Comment/Add.js index f2911b7855..5f6867540e 100644 --- a/wcfsetup/install/files/js/WoltLabSuite/Core/Component/Comment/Add.js +++ b/wcfsetup/install/files/js/WoltLabSuite/Core/Component/Comment/Add.js @@ -9,7 +9,7 @@ define(["require", "exports", "tslib", "../../Ajax", "../../Ui/Scroll", "../../Ui/Notification", "../../Language", "../../Event/Handler", "../../Dom/Util", "./GuestDialog", "../../Core", "../Ckeditor", "../Ckeditor/Event"], function (require, exports, tslib_1, Ajax_1, UiScroll, UiNotification, Language_1, EventHandler, Util_1, GuestDialog_1, Core, Ckeditor_1, Event_1) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); - exports.CommentAdd = void 0; + exports.setCommentEditorFeatures = exports.CommentAdd = void 0; UiScroll = tslib_1.__importStar(UiScroll); UiNotification = tslib_1.__importStar(UiNotification); EventHandler = tslib_1.__importStar(EventHandler); @@ -52,12 +52,7 @@ define(["require", "exports", "tslib", "../../Ajax", "../../Ui/Scroll", "../../U event.preventDefault(); void this.#submit(); }); - (0, Event_1.listenToCkeditor)(this.#textarea).setupFeatures(({ features }) => { - features.heading = false; - features.quoteBlock = false; - features.spoiler = false; - features.table = false; - }); + setCommentEditorFeatures(this.#textarea); } /** * Scrolls the editor into view and sets the caret to the end of the editor. @@ -194,4 +189,13 @@ define(["require", "exports", "tslib", "../../Ajax", "../../Ui/Scroll", "../../U } } exports.CommentAdd = CommentAdd; + function setCommentEditorFeatures(textarea) { + (0, Event_1.listenToCkeditor)(textarea).setupFeatures(({ features }) => { + features.heading = false; + features.quoteBlock = false; + features.spoiler = false; + features.table = false; + }); + } + exports.setCommentEditorFeatures = setCommentEditorFeatures; });