feat: translation flows, revision conflicts, delete scopes, article moves and a target site for new articles

This commit is contained in:
Florian Sylvain committed 2026-11-03 00:12:29 +01:00
1 parent 339e646eb8
commit 45fbbc33b1
93 files changed
+7630 -294

No files matched your search

+16
View File
@@ -0,0 +1,16 @@
const HTML_MIME = 'text/html'
const BLOCK_SELECTOR = 'p, h1, h2, h3, h4, h5, h6, li, blockquote, pre'
const BLANK_LINE = '\n\n'
export function bodyPlainText(html: string) {
const document = new DOMParser().parseFromString(html, HTML_MIME)
const blocks = Array.from(document.body.querySelectorAll(BLOCK_SELECTOR))
.filter((block) => !block.querySelector(BLOCK_SELECTOR))
.map((block) => (block.textContent ?? '').trim())
.filter((text) => text !== '')
return blocks.length > 0 ? blocks.join(BLANK_LINE) : (document.body.textContent ?? '').trim()
}
export function conflictDownloadText(title: string, html: string) {
return `${title}${BLANK_LINE}${bodyPlainText(html)}\n`
}