Module 'jsdom' as import syntax (#4016)
This commit is contained in:
parent
893a3b527d
commit
6e0c055faf
2 changed files with 4 additions and 4 deletions
|
@ -47,6 +47,7 @@
|
||||||
"@types/is-root": "1.0.0",
|
"@types/is-root": "1.0.0",
|
||||||
"@types/is-svg": "3.0.0",
|
"@types/is-svg": "3.0.0",
|
||||||
"@types/js-yaml": "3.12.0",
|
"@types/js-yaml": "3.12.0",
|
||||||
|
"@types/jsdom": "12.2.1",
|
||||||
"@types/katex": "0.5.0",
|
"@types/katex": "0.5.0",
|
||||||
"@types/koa": "2.0.48",
|
"@types/koa": "2.0.48",
|
||||||
"@types/koa-bodyparser": "5.0.2",
|
"@types/koa-bodyparser": "5.0.2",
|
||||||
|
|
|
@ -1,5 +1,4 @@
|
||||||
const jsdom = require('jsdom');
|
import { JSDOM } from 'jsdom';
|
||||||
const { JSDOM } = jsdom;
|
|
||||||
import config from '../config';
|
import config from '../config';
|
||||||
import { INote } from '../models/note';
|
import { INote } from '../models/note';
|
||||||
import { intersperse } from '../prelude/array';
|
import { intersperse } from '../prelude/array';
|
||||||
|
@ -158,9 +157,9 @@ export function toHtml(tokens: MfmForest, mentionedRemoteUsers: INote['mentioned
|
||||||
|
|
||||||
text(token) {
|
text(token) {
|
||||||
const el = doc.createElement('span');
|
const el = doc.createElement('span');
|
||||||
const nodes = (token.node.props.text as string).split(/\r\n|\r|\n/).map(x => doc.createTextNode(x));
|
const nodes = (token.node.props.text as string).split(/\r\n|\r|\n/).map(x => doc.createTextNode(x) as Node);
|
||||||
|
|
||||||
for (const x of intersperse('br', nodes)) {
|
for (const x of intersperse<Node | 'br'>('br', nodes)) {
|
||||||
el.appendChild(x === 'br' ? doc.createElement('br') : x);
|
el.appendChild(x === 'br' ? doc.createElement('br') : x);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue