diff --git a/packages/nc-gui/components/cell/RichText.vue b/packages/nc-gui/components/cell/RichText.vue index cd666fa2cb..58ad40968c 100644 --- a/packages/nc-gui/components/cell/RichText.vue +++ b/packages/nc-gui/components/cell/RichText.vue @@ -32,7 +32,7 @@ const props = withDefaults( const emits = defineEmits(['update:value', 'focus', 'blur']) -const { isFormField, hiddenBubbleMenuOptions } = toRefs(props) +const { fullMode, isFormField, hiddenBubbleMenuOptions } = toRefs(props) const isExpandedFormOpen = inject(IsExpandedFormOpenInj, ref(false))! @@ -219,16 +219,16 @@ if (isFormField.value) { }) } -watch(editorDom, () => { - if (!editorDom.value) return +onMounted(() => { + if (fullMode.value) { + setEditorContent(vModel.value, true) - setEditorContent(vModel.value, true) + if ((isForm.value && !isSurveyForm.value) || isFormField.value) return - if ((isForm.value && !isSurveyForm.value) || isFormField.value) return - // Focus editor after editor is mounted - setTimeout(() => { - editor.value?.chain().focus().run() - }, 50) + nextTick(() => { + editor.value?.chain().focus().run() + }) + } }) useEventListener(