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 editorDom = ref<HTMLElement | null>(null)
const vModel = useVModel(props, 'value', emits, { defaultValue: '' })
const tiptapExtensions = [
@ -62,10 +64,15 @@ if (props.syncValueChange) {
})
}
onMounted(() => {
setTimeout(() => {
watch(editorDom, () => {
if (!editorDom.value) return
setEditorContent(vModel.value)
}, 0)
// Focus editor after editor is mounted
setTimeout(() => {
editor.value?.chain().focus().run()
}, 50)
})
</script>
@ -76,7 +83,7 @@ onMounted(() => {
</div>
<CellRichTextSelectedBubbleMenuPopup 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>
</template>

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

@ -110,7 +110,7 @@ watch(editEnabled, () => {
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>
<textarea
v-else-if="editEnabled && !isVisible"
@ -199,6 +199,7 @@ watch(editEnabled, () => {
<CellRichText
v-else
:key="String(isVisible)"
v-model:value="vModel"
class="ml-2 mt-2 nc-scrollbar-md"
:style="{

Loading…
Cancel
Save