fix errors from quote string removal

The parse5 tree does not have the full DOM methods and attributes.
This commit is contained in:
Johann150 2022-11-21 19:43:56 +01:00
parent 0f6cf83add
commit 7ee6a09cf2
Signed by untrusted user: Johann150
GPG key ID: 9EE6577A2A06F8F1
2 changed files with 3 additions and 2 deletions

View file

@ -204,7 +204,8 @@ export function fromHtml(html: string, hashtagNames?: string[], quoteUri?: strin
case 'span':
{
if (node.classList.contains('quote-inline') && quoteUri && getText(node).trim() === `RE: ${quoteUri}`) {
const nodeClass = node.attrs.find(({ name }) => name === 'class');
if (/\bquote-inline\b/.test(nodeClass) && quoteUri && getText(node).trim() === `RE: ${quoteUri}`) {
// embedded quote thingy for backwards compatibility, don't show it
} else {
appendChildren(node.childNodes);

View file

@ -201,7 +201,7 @@ export async function createNote(value: string | IObject, resolver?: Resolver =
} else if (typeof note._misskey_content !== 'undefined') {
text = note._misskey_content;
} else if (typeof note.content === 'string') {
text = htmlToMfm(note.content, note.tag, quote.uri);
text = htmlToMfm(note.content, note.tag, quote?.uri);
}
// vote