From 0bb4bb04acf9745462d056b223ddc1983b8d3524 Mon Sep 17 00:00:00 2001 From: Alexey Zinoviev Date: Thu, 1 Aug 2024 07:56:55 +0400 Subject: [PATCH] uberf-7755: fix image toolbar visibility (#6208) Signed-off-by: Alexey Zinoviev --- .../src/components/CollaborativeTextEditor.svelte | 1 + plugins/text-editor-resources/src/kits/editor-kit.ts | 6 +++++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/plugins/text-editor-resources/src/components/CollaborativeTextEditor.svelte b/plugins/text-editor-resources/src/components/CollaborativeTextEditor.svelte index 5f366b89ad..5ff66638b8 100644 --- a/plugins/text-editor-resources/src/components/CollaborativeTextEditor.svelte +++ b/plugins/text-editor-resources/src/components/CollaborativeTextEditor.svelte @@ -416,6 +416,7 @@ toolbar: { element: imageToolbarElement, boundary, + appendTo: () => boundary ?? element, isHidden: () => !showToolbar } } diff --git a/plugins/text-editor-resources/src/kits/editor-kit.ts b/plugins/text-editor-resources/src/kits/editor-kit.ts index a9b639fe23..558345f2ba 100644 --- a/plugins/text-editor-resources/src/kits/editor-kit.ts +++ b/plugins/text-editor-resources/src/kits/editor-kit.ts @@ -41,6 +41,7 @@ export interface EditorKitOptions extends DefaultKitOptions { toolbar?: { element: HTMLElement boundary?: HTMLElement + appendTo?: HTMLElement | (() => HTMLElement) isHidden?: () => boolean } }) @@ -232,7 +233,10 @@ async function buildEditorKit (): Promise> { if (this.options.image?.toolbar !== undefined) { imageOptions.toolbar = { ...this.options.image?.toolbar, - tippyOptions: getTippyOptions(this.options.image?.toolbar?.boundary) + tippyOptions: getTippyOptions( + this.options.image?.toolbar?.boundary, + this.options.image?.toolbar?.appendTo + ) } }