feat: remove from content if matches preview URL

This commit is contained in:
Ayo 2023-01-11 17:44:40 +01:00
parent f9509f8987
commit 9bdfd71b0a

View file

@ -21,6 +21,16 @@ const vnode = $computed(() => {
})
return vnode
})
// remove link at the end of content if matches preview card URL
const previewCardURL = (status as mastodon.v1.Status).card?.url
if (vnode?.children !== null) {
const contentChildren = vnode?.children[0].children
const contentLastChild = contentChildren[contentChildren.length - 1]
const matchesPreviewURL = contentLastChild.type === 'a' && contentLastChild.props?.href === previewCardURL
if (matchesPreviewURL)
contentChildren.pop()
}
</script>
<template>