diff --git a/packages/html/getHtmlFromFragment.ts b/packages/html/getHtmlFromFragment.ts index aa5adfca..38a678f7 100644 --- a/packages/html/getHtmlFromFragment.ts +++ b/packages/html/getHtmlFromFragment.ts @@ -1,14 +1,13 @@ import { Node, DOMSerializer } from 'prosemirror-model' import { Schema } from 'prosemirror-model' -const jsdom = require('jsdom') -const { JSDOM } = jsdom +import { JSDOM } from 'jsdom' export default function getHtmlFromFragment(doc: Node, schema: Schema): string { const fragment = DOMSerializer .fromSchema(schema) .serializeFragment(doc.content) - const temporaryDocument = new jsdom(``).window.document + const temporaryDocument = new JSDOM(``).window.document const container = temporaryDocument.createElement('div') container.appendChild(fragment) diff --git a/packages/html/package.json b/packages/html/package.json index abbfada0..ad70d7ef 100644 --- a/packages/html/package.json +++ b/packages/html/package.json @@ -8,6 +8,7 @@ ], "dependencies": { "@tiptap/core": "2.x", + "@types/jsdom": "^16.2.4", "jsdom": "^16.4.0", "prosemirror-model": "^1.11.0" } diff --git a/yarn.lock b/yarn.lock index b961c275..9094c492 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2287,6 +2287,15 @@ "@types/minimatch" "*" "@types/node" "*" +"@types/jsdom@^16.2.4": + version "16.2.4" + resolved "https://registry.yarnpkg.com/@types/jsdom/-/jsdom-16.2.4.tgz#527ca99943e00561ca4056b1904fd5f4facebc3b" + integrity sha512-RssgLa5ptjVKRkHho/Ex0+DJWkVsYuV8oh2PSG3gKxFp8n/VNyB7kOrZGQkk2zgPlcBkIKOItUc/T5BXit9uhg== + dependencies: + "@types/node" "*" + "@types/parse5" "*" + "@types/tough-cookie" "*" + "@types/json-schema@^7.0.4": version "7.0.5" resolved "https://registry.yarnpkg.com/@types/json-schema/-/json-schema-7.0.5.tgz#dcce4430e64b443ba8945f0290fb564ad5bac6dd" @@ -2322,6 +2331,11 @@ resolved "https://registry.yarnpkg.com/@types/parse-json/-/parse-json-4.0.0.tgz#2f8bb441434d163b35fb8ffdccd7138927ffb8c0" integrity sha512-//oorEZjL6sbPcKUaCdIGlIUeH26mgzimjBB77G6XRgnDl/L5wOnpyBGRe/Mmf5CVW3PwEBE1NjiMZ/ssFh4wA== +"@types/parse5@*": + version "5.0.3" + resolved "https://registry.yarnpkg.com/@types/parse5/-/parse5-5.0.3.tgz#e7b5aebbac150f8b5fdd4a46e7f0bd8e65e19109" + integrity sha512-kUNnecmtkunAoQ3CnjmMkzNU/gtxG8guhi+Fk2U/kOpIKjIMKnXGp4IJCgQJrXSgMsWYimYG4TGjz/UzbGEBTw== + "@types/prop-types@*": version "15.7.3" resolved "https://registry.yarnpkg.com/@types/prop-types/-/prop-types-15.7.3.tgz#2ab0d5da2e5815f94b0b9d4b95d1e5f243ab2ca7" @@ -2438,6 +2452,11 @@ resolved "https://registry.yarnpkg.com/@types/sizzle/-/sizzle-2.3.2.tgz#a811b8c18e2babab7d542b3365887ae2e4d9de47" integrity sha512-7EJYyKTL7tFR8+gDbB6Wwz/arpGa0Mywk1TJbNzKzHtzbwVmY4HR9WqS5VV7dsBUKQmPNr192jHr/VpBluj/hg== +"@types/tough-cookie@*": + version "4.0.0" + resolved "https://registry.yarnpkg.com/@types/tough-cookie/-/tough-cookie-4.0.0.tgz#fef1904e4668b6e5ecee60c52cc6a078ffa6697d" + integrity sha512-I99sngh224D0M7XgW1s120zxCt3VYQ3IQsuw3P3jbq5GG4yc79+ZjyKznyOGIQrflfylLgcfekeZW/vk0yng6A== + "@types/unist@*", "@types/unist@^2.0.0", "@types/unist@^2.0.2": version "2.0.3" resolved "https://registry.yarnpkg.com/@types/unist/-/unist-2.0.3.tgz#9c088679876f374eb5983f150d4787aa6fb32d7e"