From: Alexander Ebert Date: Mon, 8 May 2023 17:10:37 +0000 (+0200) Subject: Upcast `[wsm]` BBCode X-Git-Tag: 6.0.0_Alpha_1~135 X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=991278b53ca647d4388bc7ada498a167208a0325;p=GitHub%2FWoltLab%2FWCF.git Upcast `[wsm]` BBCode See WoltLab/editor#47 --- diff --git a/ts/WoltLabSuite/Core/Component/Ckeditor/Media.ts b/ts/WoltLabSuite/Core/Component/Ckeditor/Media.ts index 169c41ba04..7e03fb0db1 100644 --- a/ts/WoltLabSuite/Core/Component/Ckeditor/Media.ts +++ b/ts/WoltLabSuite/Core/Component/Ckeditor/Media.ts @@ -45,6 +45,17 @@ function uploadMedia(element: HTMLElement, file: File, abortController?: AbortCo export function setup(element: HTMLElement): void { listenToCkeditor(element) .setupConfiguration(({ configuration, features }) => { + (configuration as any).woltlabMedia = { + resolveMediaUrl(mediaId: number, mediaSize: string) { + let thumbnail = ""; + if (mediaSize !== "original") { + thumbnail = `&thumbnail=${mediaSize}`; + } + + return `${window.WSC_API_URL}index.php?media/${mediaId}/${thumbnail}`; + }, + }; + if (features.attachment || !features.media) { return; } diff --git a/wcfsetup/install/files/js/WoltLabSuite/Core/Component/Ckeditor/Media.js b/wcfsetup/install/files/js/WoltLabSuite/Core/Component/Ckeditor/Media.js index d765e5ec70..43e90320e5 100644 --- a/wcfsetup/install/files/js/WoltLabSuite/Core/Component/Ckeditor/Media.js +++ b/wcfsetup/install/files/js/WoltLabSuite/Core/Component/Ckeditor/Media.js @@ -47,6 +47,15 @@ define(["require", "exports", "./Event"], function (require, exports, Event_1) { function setup(element) { (0, Event_1.listenToCkeditor)(element) .setupConfiguration(({ configuration, features }) => { + configuration.woltlabMedia = { + resolveMediaUrl(mediaId, mediaSize) { + let thumbnail = ""; + if (mediaSize !== "original") { + thumbnail = `&thumbnail=${mediaSize}`; + } + return `${window.WSC_API_URL}index.php?media/${mediaId}/${thumbnail}`; + }, + }; if (features.attachment || !features.media) { return; }