import type { InsertQuoteEventPayload } from "./Quote";
const enum EventNames {
+ CollectMetaData = "ckeditor5:collect-meta-data",
Destroy = "ckeditor5:destroy",
DiscardRecoveredData = "ckeditor5:discard-recovered-data",
InsertAttachment = "ckeditor5:insert-attachment",
UploadAttachment = "ckeditor5:upload-attachment",
UploadMedia = "ckeditor5:upload-media",
}
-
+type CollectMetaDataEventPayload = {
+ metaData: Record<string, unknown>;
+};
type ReadyEventPayload = {
ckeditor: CKEditor;
};
this.#element = element;
}
+ collectMetaData(payload: CollectMetaDataEventPayload): void {
+ this.#element.dispatchEvent(
+ new CustomEvent<CollectMetaDataEventPayload>(EventNames.CollectMetaData, {
+ detail: payload,
+ }),
+ );
+ }
+
destroy(): void {
this.#element.dispatchEvent(new CustomEvent<void>(EventNames.Destroy));
}
this.#element = element;
}
+ collectMetaData(callback: (payload: CollectMetaDataEventPayload) => void): this {
+ this.#element.addEventListener(EventNames.CollectMetaData, (event: CustomEvent<CollectMetaDataEventPayload>) => {
+ callback(event.detail);
+ });
+
+ return this;
+ }
+
destroy(callback: () => void): this {
this.#element.addEventListener(EventNames.Destroy, () => {
callback();
* @license GNU Lesser General Public License <http://opensource.org/licenses/lgpl-license.php>
*/
+import { dispatchToCkeditor } from "WoltLabSuite/Core/Component/Ckeditor/Event";
import * as Ajax from "../../Ajax";
import { AjaxCallbackObject, AjaxCallbackSetup, ResponseData } from "../../Ajax/Data";
import { getCkeditorById } from "../../Component/Ckeditor";
(validateResult as Promise<void[]>).then(
() => {
- EventHandler.fire("com.woltlab.wcf.ckeditor5", `submit_${id}`, parameters);
+ dispatchToCkeditor(ckeditor.sourceElement).collectMetaData({ metaData: parameters });
Ajax.api(this, {
actionName: "save",
import * as UiScroll from "../Scroll";
import { CKEditor, getCkeditor } from "../../Component/Ckeditor";
+import { dispatchToCkeditor } from "WoltLabSuite/Core/Component/Ckeditor/Event";
interface MessageReplyOptions {
ajax: {
});
}
- EventHandler.fire("com.woltlab.wcf.ckeditor5", "submit_text", parameters.data as any);
+ dispatchToCkeditor(this._textarea).collectMetaData({ metaData: parameters.data as Record<string, unknown> });
if (!User.userId && !additionalParameters) {
parameters.requireGuestDialog = true;
})
.discardRecoveredData(() => {
discardAllAttachments();
+ })
+ .collectMetaData((payload) => {
+ if (this._tmpHash) {
+ payload.metaData.tmpHash = this._tmpHash;
+ }
});
const ckeditor = getCkeditor(this._sourceElement);
constructor(element) {
this.#element = element;
}
+ collectMetaData(payload) {
+ this.#element.dispatchEvent(new CustomEvent("ckeditor5:collect-meta-data" /* EventNames.CollectMetaData */, {
+ detail: payload,
+ }));
+ }
destroy() {
this.#element.dispatchEvent(new CustomEvent("ckeditor5:destroy" /* EventNames.Destroy */));
}
constructor(element) {
this.#element = element;
}
+ collectMetaData(callback) {
+ this.#element.addEventListener("ckeditor5:collect-meta-data" /* EventNames.CollectMetaData */, (event) => {
+ callback(event.detail);
+ });
+ return this;
+ }
destroy(callback) {
this.#element.addEventListener("ckeditor5:destroy" /* EventNames.Destroy */, () => {
callback();
* @copyright 2001-2021 WoltLab GmbH
* @license GNU Lesser General Public License <http://opensource.org/licenses/lgpl-license.php>
*/
-define(["require", "exports", "tslib", "../../Ajax", "../../Component/Ckeditor", "../../Core", "../../Dom/Change/Listener", "../../Dom/Util", "../../Event/Handler", "../../Language", "../Dropdown/Reusable", "../Notification", "../Screen", "../Scroll"], function (require, exports, tslib_1, Ajax, Ckeditor_1, Core, Listener_1, Util_1, EventHandler, Language, UiDropdownReusable, UiNotification, UiScreen, UiScroll) {
+define(["require", "exports", "tslib", "WoltLabSuite/Core/Component/Ckeditor/Event", "../../Ajax", "../../Component/Ckeditor", "../../Core", "../../Dom/Change/Listener", "../../Dom/Util", "../../Event/Handler", "../../Language", "../Dropdown/Reusable", "../Notification", "../Screen", "../Scroll"], function (require, exports, tslib_1, Event_1, Ajax, Ckeditor_1, Core, Listener_1, Util_1, EventHandler, Language, UiDropdownReusable, UiNotification, UiScreen, UiScroll) {
"use strict";
Ajax = tslib_1.__importStar(Ajax);
Core = tslib_1.__importStar(Core);
}
}
validateResult.then(() => {
- EventHandler.fire("com.woltlab.wcf.ckeditor5", `submit_${id}`, parameters);
+ (0, Event_1.dispatchToCkeditor)(ckeditor.sourceElement).collectMetaData({ metaData: parameters });
Ajax.api(this, {
actionName: "save",
parameters: parameters,
* @license GNU Lesser General Public License <http://opensource.org/licenses/lgpl-license.php>
* @woltlabExcludeBundle tiny
*/
-define(["require", "exports", "tslib", "../../Ajax", "../../Core", "../../Event/Handler", "../../Language", "../../Dom/Change/Listener", "../../Dom/Util", "../Dialog", "../Notification", "../../User", "../../Controller/Captcha", "../Scroll", "../../Component/Ckeditor"], function (require, exports, tslib_1, Ajax, Core, EventHandler, Language, Listener_1, Util_1, Dialog_1, UiNotification, User_1, Captcha_1, UiScroll, Ckeditor_1) {
+define(["require", "exports", "tslib", "../../Ajax", "../../Core", "../../Event/Handler", "../../Language", "../../Dom/Change/Listener", "../../Dom/Util", "../Dialog", "../Notification", "../../User", "../../Controller/Captcha", "../Scroll", "../../Component/Ckeditor", "WoltLabSuite/Core/Component/Ckeditor/Event"], function (require, exports, tslib_1, Ajax, Core, EventHandler, Language, Listener_1, Util_1, Dialog_1, UiNotification, User_1, Captcha_1, UiScroll, Ckeditor_1, Event_1) {
"use strict";
Ajax = tslib_1.__importStar(Ajax);
Core = tslib_1.__importStar(Core);
parameters[name] = element.value.trim();
});
}
- EventHandler.fire("com.woltlab.wcf.ckeditor5", "submit_text", parameters.data);
+ (0, Event_1.dispatchToCkeditor)(this._textarea).collectMetaData({ metaData: parameters.data });
if (!User_1.default.userId && !additionalParameters) {
parameters.requireGuestDialog = true;
}