feat(front): integrate markdown-it for rendering markdown content in MarkdownRender component

This commit is contained in:
keven1024
2025-05-20 11:38:58 +08:00
parent daf5a036e1
commit c63cec5d2b
7 changed files with 114 additions and 114 deletions

View File

@@ -1,25 +0,0 @@
import { Extension } from '@tiptap/core'
import { Plugin, PluginKey } from 'prosemirror-state'
import { marked } from 'marked'
export const MarkdownPaste = Extension.create({
name: 'markdownPaste',
addProseMirrorPlugins() {
return [
new Plugin({
key: new PluginKey('markdownPaste'),
props: {
handlePaste: (view, event) => {
const clipboardText = event.clipboardData?.getData('text/plain')
if (clipboardText) {
const html = marked(clipboardText)
this.editor.commands.insertContent(html)
return true
}
return false
},
},
}),
]
},
})