π₯ π₯ π₯ A Free & Self-hostable Airtable Alternative
TypeScript airtableairtable-alternativeautomatic-apihacktoberfestlow-codeno-codeno-code-databaseno-code-platformpostgresqlrest-apirestful-apispreadsheetsqliteswagger
fix(nc-gui): reset inline mark formatting on press enter key
Ramesh Mane77e0cdae51ad
diff --git a/packages/nc-gui/components/ai/PromptWithFields.vue b/packages/nc-gui/components/ai/PromptWithFields.vueindex ce4e0d820f..da0d51052a 100644--- a/packages/nc-gui/components/ai/PromptWithFields.vue+++ b/packages/nc-gui/components/ai/PromptWithFields.vue@@ -6,7 +6,7 @@ import { EditorContent, useEditor } from '@tiptap/vue-3'import tippy from 'tippy.js'import { type ColumnType, UITypes } from 'nocodb-sdk'import { suggestion } from '~/helpers/tiptap'-import { FieldMentionList } from '~/helpers/tiptap-markdown/extensions'+import { FieldMentionList, Paragraph } from '~/helpers/tiptap-markdown/extensions'const props = withDefaults(defineProps<{@@ -53,7 +53,9 @@ const editor = useEditor({extensions: [StarterKit.configure({heading: false,+ paragraph: false,}) as any,+ Paragraph,Placeholder.configure({emptyEditorClass: 'is-editor-empty',placeholder: props.placeholder,diff --git a/packages/nc-gui/components/cell/RichText.vue b/packages/nc-gui/components/cell/RichText.vueindex ddb5314ef3..ce0527df35 100644--- a/packages/nc-gui/components/cell/RichText.vue+++ b/packages/nc-gui/components/cell/RichText.vue@@ -14,6 +14,7 @@ import {Underline,UserMention,UserMentionList,+ Paragraph,} from '~/helpers/tiptap-markdown/extensions'const props = withDefaults(@@ -107,6 +108,7 @@ const getTiptapExtensions = () => {strike: false,hardBreak: false,italic: false,+ paragraph: false,}),// MarksStrike,@@ -115,6 +117,7 @@ const getTiptapExtensions = () => {Italic,// Nodes+ Paragraph,HardBreak,TaskList,TaskItem.configure({diff --git a/packages/nc-gui/helpers/tiptap-markdown/extensions/nodes/paragraph.ts b/packages/nc-gui/helpers/tiptap-markdown/extensions/nodes/paragraph.tsindex 17a559db52..c35b68ee41 100644--- a/packages/nc-gui/helpers/tiptap-markdown/extensions/nodes/paragraph.ts+++ b/packages/nc-gui/helpers/tiptap-markdown/extensions/nodes/paragraph.ts@@ -1,11 +1,26 @@-import { Node } from '@tiptap/core'-import { defaultMarkdownSerializer, defaultMarkdownParser } from '@tiptap/pm/markdown'+import { defaultMarkdownSerializer } from '@tiptap/pm/markdown'import type { MarkdownNodeSpec } from '../../types'+import TiptapParagraph, { type ParagraphOptions } from '@tiptap/extension-paragraph'-// TODO: Extend from tiptap extension-export const Paragraph = Node.create<any, { markdown: MarkdownNodeSpec }>({- name: 'paragraph',+export const Paragraph = TiptapParagraph.extend<ParagraphOptions, { markdown: MarkdownNodeSpec }>({+ addKeyboardShortcuts() {+ return {+ ...(this.parent?.() ?? {}),+ Enter: () => {+ const { state, view } = this.editor++ // Remove all stored marks for the next typed text+ const tr = state.tr+ Object.values(state.schema.marks).forEach((markType) => {+ tr.removeStoredMark(markType)+ })++ view.dispatch(tr)+ return false // return false to avoid preventing the default Enter behavior+ },+ }+ },addStorage() {return {markdown: {