2022-08-06 22:43:41 +00:00
|
|
|
import { Editor, Content } from '@tiptap/react'
|
|
|
|
|
2022-08-11 21:32:02 +00:00
|
|
|
export function insertContent(editor: Editor | null, ...contents: Content[]) {
|
|
|
|
if (!editor) {
|
|
|
|
return
|
|
|
|
}
|
|
|
|
|
|
|
|
let e = editor.chain()
|
|
|
|
for (const content of contents) {
|
|
|
|
e = e.createParagraphNear().insertContent(content)
|
|
|
|
}
|
|
|
|
e.run()
|
2022-08-06 22:43:41 +00:00
|
|
|
}
|