Browse Source

fix(nc-gui): rich text on blur remove menu option

pull/7741/head
Ramesh Mane 9 months ago
parent
commit
ed602d25d9
  1. 21
      packages/nc-gui/components/cell/RichText.vue
  2. 2
      packages/nc-gui/components/smartsheet/Form.vue

21
packages/nc-gui/components/cell/RichText.vue

@ -19,7 +19,6 @@ const props = defineProps<{
fullMode?: boolean
isFormField?: boolean
autofocus?: boolean
isTabPressed?: boolean
placeholder?: string
renderAsText?: boolean
}>()
@ -141,7 +140,7 @@ const editor = useEditor({
isFocused.value = true
},
onBlur: (e) => {
if (props.isTabPressed) {
if (!(e?.event?.relatedTarget as HTMLElement)?.closest('.bubble-menu, .nc-textarea-rich-editor')) {
isFocused.value = false
e?.editor?.setEditable(false)
}
@ -202,13 +201,17 @@ watch(editorDom, () => {
}, 50)
})
onClickOutside(editorDom, (e) => {
if ((e.target as HTMLElement)?.closest('.bubble-menu')) {
return
}
isFocused.value = false
})
useEventListener(
editorDom,
'focusout',
(e: FocusEvent) => {
if (!(e?.relatedTarget as HTMLElement)?.closest('.bubble-menu, .nc-textarea-rich-editor')) {
isFocused.value = false
editor.value?.setEditable(false)
}
},
true,
)
</script>
<template>

2
packages/nc-gui/components/smartsheet/Form.vue

@ -936,7 +936,6 @@ useEventListener(
class="nc-form-focus-element font-medium text-base !text-gray-500"
is-form-field
:autofocus="activeRow === 'nc-form-sub-heading'"
:is-tab-pressed="isTabPressed"
data-testid="nc-form-sub-heading"
data-title="nc-form-sub-heading"
@update:value="updateView"
@ -1083,7 +1082,6 @@ useEventListener(
:placeholder="$t('msg.info.formHelpText')"
class="form-meta-input nc-form-input-help-text"
is-form-field
:is-tab-pressed="isTabPressed"
data-testid="nc-form-input-help-text"
@update:value="updateColMeta(element)"
/></a-form-item>

Loading…
Cancel
Save