From 11f927f3aedb813086a5671a3c404d13f3f097b5 Mon Sep 17 00:00:00 2001 From: Cyperghost Date: Thu, 19 Dec 2024 08:55:47 +0100 Subject: [PATCH] Set active editor to past the quote --- ts/WoltLabSuite/Core/Component/Quote/List.ts | 12 +++++++----- .../js/WoltLabSuite/Core/Component/Quote/List.js | 11 ++++++----- 2 files changed, 13 insertions(+), 10 deletions(-) diff --git a/ts/WoltLabSuite/Core/Component/Quote/List.ts b/ts/WoltLabSuite/Core/Component/Quote/List.ts index a83d633b2c..0768878da3 100644 --- a/ts/WoltLabSuite/Core/Component/Quote/List.ts +++ b/ts/WoltLabSuite/Core/Component/Quote/List.ts @@ -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); + } + }); }); } diff --git a/wcfsetup/install/files/js/WoltLabSuite/Core/Component/Quote/List.js b/wcfsetup/install/files/js/WoltLabSuite/Core/Component/Quote/List.js index 179fa611ef..b3ff4a52a5 100644 --- a/wcfsetup/install/files/js/WoltLabSuite/Core/Component/Quote/List.js +++ b/wcfsetup/install/files/js/WoltLabSuite/Core/Component/Quote/List.js @@ -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); + } + }); }); } }); -- 2.20.1