fix: don't nyaize quoted text (#9791)
This commit is contained in:
commit
63c3a21c0c
1 changed files with 14 additions and 4 deletions
|
@ -265,12 +265,22 @@ export const NoteRepository = db.getRepository(Note).extend({
|
||||||
|
|
||||||
if (packed.user.isCat && packed.text) {
|
if (packed.user.isCat && packed.text) {
|
||||||
const tokens = packed.text ? mfm.parse(packed.text) : [];
|
const tokens = packed.text ? mfm.parse(packed.text) : [];
|
||||||
mfm.inspect(tokens, (node) => {
|
function nyaizeNode(node: mfm.MfmNode) {
|
||||||
if (node.type === "text") {
|
if (node.type === "quote")
|
||||||
// TODO: quoteなtextはskip
|
return;
|
||||||
|
if (node.type === "text")
|
||||||
node.props.text = nyaize(node.props.text);
|
node.props.text = nyaize(node.props.text);
|
||||||
|
|
||||||
|
if (node.children) {
|
||||||
|
for (const child of node.children) {
|
||||||
|
nyaizeNode(child);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
});
|
}
|
||||||
|
|
||||||
|
for (const node of tokens)
|
||||||
|
nyaizeNode(node);
|
||||||
|
|
||||||
packed.text = mfm.toString(tokens);
|
packed.text = mfm.toString(tokens);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue