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:
parent
57a785ca2a
commit
64c0f62339
@ -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;
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user