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 + ) } }