Add "isEmpty" prop to "MessageViewer" (#2613)

Signed-off-by: Sergei Ogorelkov <sergei.ogorelkov@xored.com>
This commit is contained in:
Sergei Ogorelkov 2023-02-09 22:35:40 +06:00 committed by GitHub
parent 44f5ba1c64
commit 3c5f67df62
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -22,7 +22,12 @@
const parser = new DOMParser()
$: dom = parser.parseFromString(message, 'text/html').firstChild?.childNodes[1] as HTMLElement
export function isEmpty () {
return doc.documentElement.innerText.length === 0
}
$: doc = parser.parseFromString(message, 'text/html')
$: dom = doc.firstChild?.childNodes[1] as HTMLElement
</script>
<Nodes nodes={dom.childNodes} />