Return parsed dom back to backend

This commit is contained in:
Hongbo Wu
2022-05-06 12:29:08 +08:00
parent 5f5076e864
commit eaad96acdd
3 changed files with 5 additions and 8 deletions

View File

@ -254,9 +254,8 @@ export const parsePreparedContent = async (
// Format code blocks
// TODO: we probably want to move this type of thing
// to the handlers, and have some concept of postHandle
if (article?.window) {
// const cWindow = new JSDOM(article?.content).window
article.window.document.querySelectorAll('code').forEach((e) => {
if (article?.dom) {
article.dom.querySelectorAll('code').forEach((e) => {
console.log(e.textContent)
if (e.textContent) {
const att = hljs.highlightAuto(e.textContent)
@ -271,7 +270,7 @@ export const parsePreparedContent = async (
e.replaceWith(code)
}
})
article.content = article.window.document.body.outerHTML
article.content = article.dom.outerHTML
}
const newWindow = new JSDOM('').window