When I tried to pass in a JSDOM wrapper as a third argument to convertToHTML I still got this error. Here is the full stack trace:
W20190113-16:58:58.334(-8)? (STDERR) ReferenceError: HTMLElement is not defined
W20190113-16:58:58.334(-8)? (STDERR) at processInlineTag (/Users/discordius/LessWrong/LessWrong/Lesswrong2/node_modules/draft-convert/lib/convertFromHTML.js:199:30)
W20190113-16:58:58.334(-8)? (STDERR) at genFragment (/Users/discordius/LessWrong/LessWrong/Lesswrong2/node_modules/draft-convert/lib/convertFromHTML.js:359:17)
W20190113-16:58:58.335(-8)? (STDERR) at getChunkForHTML (/Users/discordius/LessWrong/LessWrong/Lesswrong2/node_modules/draft-convert/lib/convertFromHTML.js:481:15)
W20190113-16:58:58.335(-8)? (STDERR) at convertFromHTMLtoContentBlocks (/Users/discordius/LessWrong/LessWrong/Lesswrong2/node_modules/draft-convert/lib/convertFromHTML.js:521:15)
W20190113-16:58:58.335(-8)? (STDERR) at /Users/discordius/LessWrong/LessWrong/Lesswrong2/node_modules/draft-convert/lib/convertFromHTML.js:612:25
I was able to fix this by adding the following line to the top of the file:
global.HTMLElement = new JSDOM().window.HTMLElement
But I would prefer to not have to add some globals to make parsing work. Not sure whether you can avoid it, but it would be great to somehow not rely on this class that isn't available on the server by default.
When I tried to pass in a JSDOM wrapper as a third argument to
convertToHTML
I still got this error. Here is the full stack trace:I was able to fix this by adding the following line to the top of the file:
But I would prefer to not have to add some globals to make parsing work. Not sure whether you can avoid it, but it would be great to somehow not rely on this class that isn't available on the server by default.