diff --git a/packages/text-editor/src/components/CollaboratorEditor.svelte b/packages/text-editor/src/components/CollaboratorEditor.svelte index 72c493bb2f..942ec71d7d 100644 --- a/packages/text-editor/src/components/CollaboratorEditor.svelte +++ b/packages/text-editor/src/components/CollaboratorEditor.svelte @@ -69,6 +69,7 @@ export let boundary: HTMLElement | undefined = undefined export let attachFile: FileAttachFunction | undefined = undefined + export let canShowPopups = true let element: HTMLElement @@ -262,6 +263,7 @@ $: updateEditor(editor, field, comparedVersion) $: if (editor) dispatch('editor', editor) + $: isStyleToolbarSupported = (!readonly || textNodeActions.length > 0) && canShowPopups $: tippyOptions = { zIndex: 100000, @@ -304,7 +306,7 @@ InlineStyleToolbarExtension.configure({ tippyOptions, element: textToolbarElement, - isSupported: () => !readonly, + isSupported: () => isStyleToolbarSupported, isSelectionOnly: () => false }), InlinePopupExtension.configure({ @@ -315,7 +317,7 @@ appendTo: () => boundary ?? element }, shouldShow: () => { - if (!visible && !readonly) { + if (!visible || !readonly || !canShowPopups) { return false } return editor?.isActive('image') @@ -448,27 +450,31 @@ bind:this={textToolbarElement} style="visibility: hidden;" > - { - needFocus = true - }} - on:action={(event) => { - dispatch('action', event.detail) - needFocus = true - }} - /> + {#if isStyleToolbarSupported} + { + needFocus = true + }} + on:action={(event) => { + dispatch('action', event.detail) + needFocus = true + }} + /> + {/if}