Route inline quote links in-app instead of out to coracle (#409)

Co-authored-by: Coracle-Bot <npub1klq6260@nostr.local>
This commit is contained in:
Coracle-Bot 2026-09-02 23:47:15 +00:00 committed by hodlbod
parent 097cde0201
commit d87e516ffa
2 changed files with 14 additions and 15 deletions

View file

@ -1,5 +1,5 @@
<script lang="ts">
import {fromNostrURI, tagSpec, tagValue} from "@welshman/util"
import {tagSpec, tagValue} from "@welshman/util"
import {
parse,
truncate,
@ -37,7 +37,6 @@
import ContentTopic from "@app/components/ContentTopic.svelte"
import ContentMention from "@app/components/ContentMention.svelte"
import RoomName from "@app/components/RoomName.svelte"
import {entityLink} from "@app/env"
import {makeRoomPath} from "@app/routes"
import {userSettingsValues} from "@app/settings"
@ -190,16 +189,7 @@
#<RoomName url={parsed.value.url} h={parsed.value.room} />
</Link>
{:else if isQuote(parsed)}
{#if isBlock(i)}
<ContentQuote {url} value={parsed.value} {event} />
{:else}
<Link
external
class="overflow-hidden text-ellipsis whitespace-nowrap underline"
href={entityLink(parsed.raw)}>
{fromNostrURI(parsed.raw).slice(0, 16) + "…"}
</Link>
{/if}
<ContentQuote {url} value={parsed.value} raw={parsed.raw} {event} inline={!isBlock(i)} />
{:else if isEllipsis(parsed) && expandInline}
{@html renderAsHtml(parsed)}
<button

View file

@ -7,6 +7,7 @@
Address,
MESSAGE,
eventOutbox,
fromNostrURI,
getIdFilters,
relays as relaySelections,
seen,
@ -23,11 +24,13 @@
type Props = {
value: any
raw: string
event: TrustedEvent
inline?: boolean
url?: string
}
const {value, event, url}: Props = $props()
const {value, raw, event, inline = false, url}: Props = $props()
const {id, identifier, kind, pubkey = value.author, relays = []} = value
const idOrAddress = id || new Address(kind, pubkey, identifier).toString()
@ -72,8 +75,14 @@
}
</script>
<Button class="my-2 block w-full max-w-full text-left" {onclick}>
{#if $quote}
<Button
class={inline
? "max-w-full cursor-pointer overflow-hidden text-ellipsis whitespace-nowrap underline"
: "my-2 block w-full max-w-full text-left"}
{onclick}>
{#if inline}
{fromNostrURI(raw).slice(0, 16) + "…"}
{:else if $quote}
{#if $quote.content.trim().match(/^(nostr:)?nevent1[a-z0-9]+$/)}
<NoteContent {url} event={$quote} />
{:else if $quote.kind === MESSAGE}