Skip to content

Commit

Permalink
fix: rich text first char issue
Browse files Browse the repository at this point in the history
Signed-off-by: Raju Udava <86527202+dstala@users.noreply.github.com>
  • Loading branch information
dstala committed Dec 20, 2023
1 parent 14a1bd7 commit 38ac18b
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 3 deletions.
13 changes: 11 additions & 2 deletions packages/nc-gui/components/cell/RichText.vue
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ const editor = useEditor({
editable: !props.readonly,
})
const setEditorContent = (contentMd: any) => {
const setEditorContent = (contentMd: any, focusEndOfDoc?: boolean) => {
if (!editor.value) return
const selection = editor.value.view.state.selection
Expand All @@ -120,6 +120,15 @@ const setEditorContent = (contentMd: any) => {
editor.value.chain().setContent(content).setTextSelection(selection.to).run()
setTimeout(() => {
if (focusEndOfDoc) {
const docSize = editor.value!.state.doc.nodeSize
editor.value
?.chain()
.setTextSelection(docSize - 1)
.run()
}
;(editor.value!.state as any).history$.prevRanges = null
;(editor.value!.state as any).history$.done.eventCount = 0
}, 100)
Expand All @@ -134,7 +143,7 @@ if (props.syncValueChange) {
watch(editorDom, () => {
if (!editorDom.value) return
setEditorContent(vModel.value)
setEditorContent(vModel.value, true)
// Focus editor after editor is mounted
setTimeout(() => {
Expand Down
10 changes: 9 additions & 1 deletion packages/nc-gui/composables/useMultiSelect/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -718,7 +718,15 @@ export function useMultiSelect(
return message.info(t('msg.info.updateNotAllowedWithoutPK'))
}
if (isTypableInputColumn(columnObj) && makeEditable(rowObj, columnObj) && columnObj.title) {
rowObj.row[columnObj.title] = ''
if (columnObj.uidt === UITypes.LongText) {
if (rowObj.row[columnObj.title] === '<br />') {
rowObj.row[columnObj.title] = e.key
} else {
rowObj.row[columnObj.title] = rowObj.row[columnObj.title] ? rowObj.row[columnObj.title] + e.key : e.key
}
} else {
rowObj.row[columnObj.title] = ''
}
}
// editEnabled = true
}
Expand Down

1 comment on commit 38ac18b

@github-actions
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The PR changes have been deployed. Please run the following command to verify:

docker run -d -p 8888:8080 nocodb/nocodb-timely:0.202.10-pr-7266-20231220-1148

Please sign in to comment.