fix(plugins): text content output in searx, stackoverflow

This commit is contained in:
Artemy 2024-05-14 13:05:06 +03:00
parent 9a6819e652
commit dba42c64b4
3 changed files with 3 additions and 11 deletions

View File

@ -41,24 +41,17 @@ async function search(
.textContent || '', .textContent || '',
}; };
return { return <ResultItem {...parsed} />;
html: <ResultItem {...parsed} />,
text: `${parsed.title} (${parsed.url})\n${parsed.content}\n---\n\n`,
};
}); });
const content = ( const content = (
<> <>
{articles_parsed.map((a) => a.html)} {articles_parsed}
<PageFooter page={page} previous={previous} next={next} /> <PageFooter page={page} previous={previous} next={next} />
</> </>
); );
const textContent = articles_parsed.map((a) => a.text).join('');
return { return {
content: content, content: content,
textContent,
title: `"${(document.getElementById('q') as HTMLInputElement).value}" - Searx - Page ${page}`, title: `"${(document.getElementById('q') as HTMLInputElement).value}" - Searx - Page ${page}`,
}; };
} }

View File

@ -42,7 +42,6 @@ async function users(
{topPosts} {topPosts}
</> </>
), ),
textContent: `${ro.q.id}/${ro.q.slug}\n`, // TODO
title: document.querySelector('title')?.textContent || '', title: document.querySelector('title')?.textContent || '',
}; };
} }

View File

@ -10,7 +10,7 @@ export namespace JSX {
export function createElement( export function createElement(
name: any, name: any,
props: { [id: string]: any }, props: { [id: string]: any },
...inner: any[] ...inner: (string | string[])[]
) { ) {
const content = inner.flat().join(''); const content = inner.flat().join('');