Browse Source

fix: Fixed dbl click to open rich modal and have cursor on modal when opened

pull/7046/head
Muhammed Mustafa 1 year ago
parent
commit
63987d1fa1
  1. 15
      packages/nc-gui/components/cell/RichText.vue
  2. 3
      packages/nc-gui/components/cell/TextArea.vue

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

@ -20,6 +20,8 @@ const emits = defineEmits(['update:value'])
const turndownService = new TurndownService() const turndownService = new TurndownService()
const editorDom = ref<HTMLElement | null>(null)
const vModel = useVModel(props, 'value', emits, { defaultValue: '' }) const vModel = useVModel(props, 'value', emits, { defaultValue: '' })
const tiptapExtensions = [ const tiptapExtensions = [
@ -62,10 +64,15 @@ if (props.syncValueChange) {
}) })
} }
onMounted(() => { watch(editorDom, () => {
setTimeout(() => { if (!editorDom.value) return
setEditorContent(vModel.value) setEditorContent(vModel.value)
}, 0)
// Focus editor after editor is mounted
setTimeout(() => {
editor.value?.chain().focus().run()
}, 50)
}) })
</script> </script>
@ -76,7 +83,7 @@ onMounted(() => {
</div> </div>
<CellRichTextSelectedBubbleMenuPopup v-if="editor" :editor="editor" /> <CellRichTextSelectedBubbleMenuPopup v-if="editor" :editor="editor" />
<CellRichTextLinkOptions v-if="editor" :editor="editor" /> <CellRichTextLinkOptions v-if="editor" :editor="editor" />
<EditorContent :editor="editor" class="nc-textarea-rich w-full h-full nc-text-rich-scroll nc-scrollbar-md" /> <EditorContent ref="editorDom" :editor="editor" class="nc-textarea-rich w-full h-full nc-text-rich-scroll nc-scrollbar-md" />
</div> </div>
</template> </template>

3
packages/nc-gui/components/cell/TextArea.vue

@ -110,7 +110,7 @@ watch(editEnabled, () => {
minHeight: `${height}px !important`, minHeight: `${height}px !important`,
}" }"
> >
<CellRichText v-model:value="vModel" sync-value-change readonly /> <CellRichText v-model:value="vModel" sync-value-change readonly class="!pointer-events-none" />
</div> </div>
<textarea <textarea
v-else-if="editEnabled && !isVisible" v-else-if="editEnabled && !isVisible"
@ -199,6 +199,7 @@ watch(editEnabled, () => {
<CellRichText <CellRichText
v-else v-else
:key="String(isVisible)"
v-model:value="vModel" v-model:value="vModel"
class="ml-2 mt-2 nc-scrollbar-md" class="ml-2 mt-2 nc-scrollbar-md"
:style="{ :style="{

Loading…
Cancel
Save