1
0
mirror of https://github.com/MisskeyIO/misskey synced 2024-11-27 06:18:40 +09:00

MfmService.toHtml を JSDOM に戻す (MisskeyIO#647)

This commit is contained in:
riku6460 2024-06-14 06:36:37 +09:00 committed by GitHub
parent 57a785ca2a
commit 64c0f62339
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -6,7 +6,7 @@
import { URL } from 'node:url';
import { Inject, Injectable } from '@nestjs/common';
import * as parse5 from 'parse5';
import { Window, XMLSerializer } from 'happy-dom';
import { JSDOM } from 'jsdom';
import { DI } from '@/di-symbols.js';
import type { Config } from '@/config.js';
import { intersperse } from '@/misc/prelude/array.js';
@ -243,9 +243,9 @@ export class MfmService {
return null;
}
const { window } = new Window();
const fragment = JSDOM.fragment('');
const doc = window.document;
const doc = fragment.ownerDocument;
const body = doc.createElement('p');
@ -461,6 +461,6 @@ export class MfmService {
appendChildren(nodes, body);
return new XMLSerializer().serializeToString(body);
return body.outerHTML;
}
}