Fix the detection of message tab menus
authorAlexander Ebert <ebert@woltlab.com>
Fri, 11 Aug 2023 14:03:17 +0000 (16:03 +0200)
committerAlexander Ebert <ebert@woltlab.com>
Fri, 11 Aug 2023 14:03:17 +0000 (16:03 +0200)
Fixes #5609

ts/WoltLabSuite/Core/Component/Ckeditor/Attachment.ts
wcfsetup/install/files/js/WoltLabSuite/Core/Component/Ckeditor/Attachment.js

index 12add01a88480e371fbda77a8d3de094f72d9c31..16dbc95e311398733005abe1a7e04892f7384d8a 100644 (file)
@@ -76,8 +76,10 @@ function setupRemoveAttachment(ckeditor: CKEditor): void {
 }
 
 function getInlineImageIds(element: HTMLElement): number[] {
-  const messageTabMenu = element.nextElementSibling;
-  if (!messageTabMenu || !messageTabMenu.classList.contains("messageTabMenu")) {
+  const messageTabMenu = document.querySelector<HTMLElement>(
+    `.messageTabMenu[data-wysiwyg-container-id="${element.id}"]`,
+  );
+  if (!messageTabMenu) {
     return [];
   }
 
index 689c48165c927a6f0310884ed42b65c6c9a85e17..d9d728f9c8946e0cdd764e060dd74733986442ed 100644 (file)
@@ -42,8 +42,8 @@ define(["require", "exports", "./Event"], function (require, exports, Event_1) {
         });
     }
     function getInlineImageIds(element) {
-        const messageTabMenu = element.nextElementSibling;
-        if (!messageTabMenu || !messageTabMenu.classList.contains("messageTabMenu")) {
+        const messageTabMenu = document.querySelector(`.messageTabMenu[data-wysiwyg-container-id="${element.id}"]`);
+        if (!messageTabMenu) {
             return [];
         }
         const attachmentList = messageTabMenu.querySelector(".formAttachmentContent > .formAttachmentList");