Set active editor to past the quote
authorCyperghost <olaf_schmitz_1@t-online.de>
Thu, 19 Dec 2024 07:55:47 +0000 (08:55 +0100)
committerAlexander Ebert <ebert@woltlab.com>
Wed, 8 Jan 2025 16:25:19 +0000 (17:25 +0100)
ts/WoltLabSuite/Core/Component/Quote/List.ts
wcfsetup/install/files/js/WoltLabSuite/Core/Component/Quote/List.js

index a83d633b2cc842ca23ef11bc2569427dddaef096..0768878da38ef3f61d8a4db34c7c6a71aa34aa50 100644 (file)
@@ -71,12 +71,14 @@ export function setup(editorId: string): void {
   listenToCkeditor(editor).ready(({ ckeditor }) => {
     if (ckeditor.features.quoteBlock) {
       quoteLists.set(editorId, new QuoteList(editorId, ckeditor));
-
-      setActiveEditor(ckeditor, true);
-    } else {
-      setActiveEditor(ckeditor, false);
     }
 
-    //TODO handle active editor changed
+    setActiveEditor(ckeditor, ckeditor.features.quoteBlock);
+
+    ckeditor.focusTracker.on("change:isFocused", (_evt: unknown, _name: unknown, isFocused: boolean) => {
+      if (isFocused) {
+        setActiveEditor(ckeditor, ckeditor.features.quoteBlock);
+      }
+    });
   });
 }
index 179fa611efe376f67411b37b391e4ac2de6b0289..b3ff4a52a5766b01ba4cf62b2957269b5b9ca91d 100644 (file)
@@ -58,12 +58,13 @@ define(["require", "exports", "tslib", "WoltLabSuite/Core/Core", "WoltLabSuite/C
         (0, Event_1.listenToCkeditor)(editor).ready(({ ckeditor }) => {
             if (ckeditor.features.quoteBlock) {
                 quoteLists.set(editorId, new QuoteList(editorId, ckeditor));
-                (0, Message_1.setActiveEditor)(ckeditor, true);
             }
-            else {
-                (0, Message_1.setActiveEditor)(ckeditor, false);
-            }
-            //TODO handle active editor changed
+            (0, Message_1.setActiveEditor)(ckeditor, ckeditor.features.quoteBlock);
+            ckeditor.focusTracker.on("change:isFocused", () => {
+                if (ckeditor.focusTracker.isFocused) {
+                    (0, Message_1.setActiveEditor)(ckeditor, ckeditor.features.quoteBlock);
+                }
+            });
         });
     }
 });