Files
tiptap/packages/core/src/utils/elementFromString.ts
Philipp Kühn e5a6039706 fix xss issue
2020-07-15 11:36:33 +02:00

7 lines
243 B
TypeScript

export default function elementFromString(value: string): HTMLElement {
const htmlString = `<div>${value}</div>`
const parser = new window.DOMParser
const element = parser.parseFromString(htmlString, 'text/html').body
return element
}