mirror of
https://github.com/hcengineering/platform.git
synced 2025-04-25 09:50:19 +00:00
EZQMS-393: Add CollaboratorEditor prop to hide popups (#4051)
Signed-off-by: Anna No <anna.no@xored.com>
This commit is contained in:
parent
d83b1a92b9
commit
6f37f276e2
packages/text-editor/src/components
@ -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;"
|
||||
>
|
||||
<TextEditorStyleToolbar
|
||||
textEditor={editor}
|
||||
textFormatCategories={[
|
||||
TextFormatCategory.Heading,
|
||||
TextFormatCategory.TextDecoration,
|
||||
TextFormatCategory.Link,
|
||||
TextFormatCategory.List,
|
||||
TextFormatCategory.Quote,
|
||||
TextFormatCategory.Code,
|
||||
TextFormatCategory.Table
|
||||
]}
|
||||
formatButtonSize={buttonSize}
|
||||
{textNodeActions}
|
||||
on:focus={() => {
|
||||
needFocus = true
|
||||
}}
|
||||
on:action={(event) => {
|
||||
dispatch('action', event.detail)
|
||||
needFocus = true
|
||||
}}
|
||||
/>
|
||||
{#if isStyleToolbarSupported}
|
||||
<TextEditorStyleToolbar
|
||||
textEditor={editor}
|
||||
textFormatCategories={readonly
|
||||
? []
|
||||
: [
|
||||
TextFormatCategory.Heading,
|
||||
TextFormatCategory.TextDecoration,
|
||||
TextFormatCategory.Link,
|
||||
TextFormatCategory.List,
|
||||
TextFormatCategory.Quote,
|
||||
TextFormatCategory.Code,
|
||||
TextFormatCategory.Table
|
||||
]}
|
||||
formatButtonSize={buttonSize}
|
||||
{textNodeActions}
|
||||
on:focus={() => {
|
||||
needFocus = true
|
||||
}}
|
||||
on:action={(event) => {
|
||||
dispatch('action', event.detail)
|
||||
needFocus = true
|
||||
}}
|
||||
/>
|
||||
{/if}
|
||||
</div>
|
||||
|
||||
<div
|
||||
|
@ -49,7 +49,7 @@ export const InlineStyleToolbarExtension = Extension.create<InlineStyleToolbarOp
|
||||
return false
|
||||
}
|
||||
|
||||
if (editor.isDestroyed || !editor.isEditable) {
|
||||
if (editor.isDestroyed) {
|
||||
return false
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user