forked from Mirrors/elk
feat: remove from content if matches preview URL
This commit is contained in:
parent
f9509f8987
commit
9bdfd71b0a
1 changed files with 10 additions and 0 deletions
|
@ -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>
|
||||
|
|
Loading…
Reference in a new issue