From 1350266f146063688fd8b0724e9e49d285d08e83 Mon Sep 17 00:00:00 2001 From: Alexander Ebert Date: Sat, 28 May 2022 14:40:49 +0200 Subject: [PATCH] Bad access the editor from within a dialog See https://www.woltlab.com/community/thread/295640-%C3%BCber-medien-hinzugef%C3%BCgtes-bild-l%C3%A4sst-sich-nach-der-entfernung-nicht-direkt-erneu/ --- ts/WoltLabSuite/Core/Media/Manager/Editor.ts | 14 ++++++++++---- .../js/WoltLabSuite/Core/Media/Manager/Editor.js | 8 ++++++-- 2 files changed, 16 insertions(+), 6 deletions(-) diff --git a/ts/WoltLabSuite/Core/Media/Manager/Editor.ts b/ts/WoltLabSuite/Core/Media/Manager/Editor.ts index be26f19e56..82172a174d 100644 --- a/ts/WoltLabSuite/Core/Media/Manager/Editor.ts +++ b/ts/WoltLabSuite/Core/Media/Manager/Editor.ts @@ -266,11 +266,17 @@ class MediaManagerEditor extends MediaManager { link = media[thumbnailSize + "ThumbnailLink"]; } - this._options.editor!.insert.html( - ``, - ); + Core.interactWithRedactor(() => { + this._options.editor!.insert.html( + ``, + ); + }); } else { - this._options.editor!.insert.text(`[wsm='${media.mediaID}'][/wsm]`); + Core.interactWithRedactor(() => { + this._options.editor!.insert.text(`[wsm='${media.mediaID}'][/wsm]`); + }); } } diff --git a/wcfsetup/install/files/js/WoltLabSuite/Core/Media/Manager/Editor.js b/wcfsetup/install/files/js/WoltLabSuite/Core/Media/Manager/Editor.js index 38a612e5aa..e97a0f042f 100644 --- a/wcfsetup/install/files/js/WoltLabSuite/Core/Media/Manager/Editor.js +++ b/wcfsetup/install/files/js/WoltLabSuite/Core/Media/Manager/Editor.js @@ -205,10 +205,14 @@ define(["require", "exports", "tslib", "./Base", "../../Core", "../../Event/Hand if (thumbnailSize !== "original") { link = media[thumbnailSize + "ThumbnailLink"]; } - this._options.editor.insert.html(``); + Core.interactWithRedactor(() => { + this._options.editor.insert.html(``); + }); } else { - this._options.editor.insert.text(`[wsm='${media.mediaID}'][/wsm]`); + Core.interactWithRedactor(() => { + this._options.editor.insert.text(`[wsm='${media.mediaID}'][/wsm]`); + }); } } /** -- 2.20.1