fix: fix problem on bbcode value maybe include space

pull/90/head
moonrailgun 2 years ago
parent 9524502d70
commit b47a22b51f

@ -79,10 +79,13 @@ class BBCodeParser {
const { tag, content, attrs } = node;
const attrsStr = _toPairs(attrs)
.map(([key, value]) => {
/**
* value
*/
if (key === value) {
return `=${value}`;
return `="${value}"`;
} else {
return ` ${key}=${value}`;
return ` ${key}="${value}"`;
}
})
// NOTICE: 这里排序看起来好像有问题但是attrs的顺序是有序的所以没有问题
@ -135,6 +138,7 @@ class BBCodeParser {
}
render(input: string): ReactNode[] {
console.log('input', input);
const ast = this.parse(input);
return ast

Loading…
Cancel
Save