uberf-7755: fix image toolbar visibility (#6208)

Signed-off-by: Alexey Zinoviev <alexey.zinoviev@xored.com>
This commit is contained in:
Alexey Zinoviev 2024-08-01 07:56:55 +04:00 committed by GitHub
parent 868556471d
commit 0bb4bb04ac
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 6 additions and 1 deletions

View File

@ -416,6 +416,7 @@
toolbar: { toolbar: {
element: imageToolbarElement, element: imageToolbarElement,
boundary, boundary,
appendTo: () => boundary ?? element,
isHidden: () => !showToolbar isHidden: () => !showToolbar
} }
} }

View File

@ -41,6 +41,7 @@ export interface EditorKitOptions extends DefaultKitOptions {
toolbar?: { toolbar?: {
element: HTMLElement element: HTMLElement
boundary?: HTMLElement boundary?: HTMLElement
appendTo?: HTMLElement | (() => HTMLElement)
isHidden?: () => boolean isHidden?: () => boolean
} }
}) })
@ -232,7 +233,10 @@ async function buildEditorKit (): Promise<Extension<EditorKitOptions, any>> {
if (this.options.image?.toolbar !== undefined) { if (this.options.image?.toolbar !== undefined) {
imageOptions.toolbar = { imageOptions.toolbar = {
...this.options.image?.toolbar, ...this.options.image?.toolbar,
tippyOptions: getTippyOptions(this.options.image?.toolbar?.boundary) tippyOptions: getTippyOptions(
this.options.image?.toolbar?.boundary,
this.options.image?.toolbar?.appendTo
)
} }
} }