From 63987d1fa167a54991382ada2750b436be0530cb Mon Sep 17 00:00:00 2001 From: Muhammed Mustafa Date: Thu, 23 Nov 2023 11:20:35 +0000 Subject: [PATCH] fix: Fixed dbl click to open rich modal and have cursor on modal when opened --- packages/nc-gui/components/cell/RichText.vue | 15 +++++++++++---- packages/nc-gui/components/cell/TextArea.vue | 3 ++- 2 files changed, 13 insertions(+), 5 deletions(-) diff --git a/packages/nc-gui/components/cell/RichText.vue b/packages/nc-gui/components/cell/RichText.vue index c3cba90adb..45ab900953 100644 --- a/packages/nc-gui/components/cell/RichText.vue +++ b/packages/nc-gui/components/cell/RichText.vue @@ -20,6 +20,8 @@ const emits = defineEmits(['update:value']) const turndownService = new TurndownService() +const editorDom = ref(null) + const vModel = useVModel(props, 'value', emits, { defaultValue: '' }) const tiptapExtensions = [ @@ -62,10 +64,15 @@ if (props.syncValueChange) { }) } -onMounted(() => { +watch(editorDom, () => { + if (!editorDom.value) return + + setEditorContent(vModel.value) + + // Focus editor after editor is mounted setTimeout(() => { - setEditorContent(vModel.value) - }, 0) + editor.value?.chain().focus().run() + }, 50) }) @@ -76,7 +83,7 @@ onMounted(() => { - + diff --git a/packages/nc-gui/components/cell/TextArea.vue b/packages/nc-gui/components/cell/TextArea.vue index 786e775e3d..b4d3afb29e 100644 --- a/packages/nc-gui/components/cell/TextArea.vue +++ b/packages/nc-gui/components/cell/TextArea.vue @@ -110,7 +110,7 @@ watch(editEnabled, () => { minHeight: `${height}px !important`, }" > - +