fix: Switch from hostic dom to zeed dom (#2151)
* add zeed-dom * update zeed-dom for performance improvements
This commit is contained in:
@@ -22,8 +22,8 @@
|
||||
],
|
||||
"dependencies": {
|
||||
"@tiptap/core": "^2.0.0-beta.133",
|
||||
"hostic-dom": "^0.8.7",
|
||||
"prosemirror-model": "^1.15.0"
|
||||
"prosemirror-model": "^1.15.0",
|
||||
"zeed-dom": "^0.9.15"
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
|
||||
@@ -1,11 +1,10 @@
|
||||
import { DOMParser } from 'prosemirror-model'
|
||||
import { getSchema, Extensions } from '@tiptap/core'
|
||||
// @ts-ignore
|
||||
import { parseHTML } from 'hostic-dom'
|
||||
import { parseHTML } from 'zeed-dom'
|
||||
|
||||
export default function generateJSON(html: string, extensions: Extensions): Record<string, any> {
|
||||
const schema = getSchema(extensions)
|
||||
const dom = parseHTML(html)
|
||||
const dom = parseHTML(html) as unknown as Node
|
||||
|
||||
return DOMParser.fromSchema(schema)
|
||||
.parse(dom)
|
||||
|
||||
@@ -1,13 +1,12 @@
|
||||
import { Node, DOMSerializer, Schema } from 'prosemirror-model'
|
||||
// @ts-ignore
|
||||
import { createHTMLDocument } from 'hostic-dom'
|
||||
import { createHTMLDocument, VHTMLDocument } from 'zeed-dom'
|
||||
|
||||
export default function getHTMLFromFragment(doc: Node, schema: Schema): string {
|
||||
return DOMSerializer
|
||||
const document = DOMSerializer
|
||||
.fromSchema(schema)
|
||||
.serializeFragment(doc.content, {
|
||||
document: createHTMLDocument(),
|
||||
})
|
||||
// @ts-ignore
|
||||
.render()
|
||||
}) as unknown as VHTMLDocument
|
||||
|
||||
return document.render()
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user