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:
parent
097cde0201
commit
d87e516ffa
2 changed files with 14 additions and 15 deletions
|
|
@ -1,5 +1,5 @@
|
||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import {fromNostrURI, tagSpec, tagValue} from "@welshman/util"
|
import {tagSpec, tagValue} from "@welshman/util"
|
||||||
import {
|
import {
|
||||||
parse,
|
parse,
|
||||||
truncate,
|
truncate,
|
||||||
|
|
@ -37,7 +37,6 @@
|
||||||
import ContentTopic from "@app/components/ContentTopic.svelte"
|
import ContentTopic from "@app/components/ContentTopic.svelte"
|
||||||
import ContentMention from "@app/components/ContentMention.svelte"
|
import ContentMention from "@app/components/ContentMention.svelte"
|
||||||
import RoomName from "@app/components/RoomName.svelte"
|
import RoomName from "@app/components/RoomName.svelte"
|
||||||
import {entityLink} from "@app/env"
|
|
||||||
import {makeRoomPath} from "@app/routes"
|
import {makeRoomPath} from "@app/routes"
|
||||||
import {userSettingsValues} from "@app/settings"
|
import {userSettingsValues} from "@app/settings"
|
||||||
|
|
||||||
|
|
@ -190,16 +189,7 @@
|
||||||
#<RoomName url={parsed.value.url} h={parsed.value.room} />
|
#<RoomName url={parsed.value.url} h={parsed.value.room} />
|
||||||
</Link>
|
</Link>
|
||||||
{:else if isQuote(parsed)}
|
{:else if isQuote(parsed)}
|
||||||
{#if isBlock(i)}
|
<ContentQuote {url} value={parsed.value} raw={parsed.raw} {event} inline={!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}
|
|
||||||
{:else if isEllipsis(parsed) && expandInline}
|
{:else if isEllipsis(parsed) && expandInline}
|
||||||
{@html renderAsHtml(parsed)}
|
{@html renderAsHtml(parsed)}
|
||||||
<button
|
<button
|
||||||
|
|
|
||||||
|
|
@ -7,6 +7,7 @@
|
||||||
Address,
|
Address,
|
||||||
MESSAGE,
|
MESSAGE,
|
||||||
eventOutbox,
|
eventOutbox,
|
||||||
|
fromNostrURI,
|
||||||
getIdFilters,
|
getIdFilters,
|
||||||
relays as relaySelections,
|
relays as relaySelections,
|
||||||
seen,
|
seen,
|
||||||
|
|
@ -23,11 +24,13 @@
|
||||||
|
|
||||||
type Props = {
|
type Props = {
|
||||||
value: any
|
value: any
|
||||||
|
raw: string
|
||||||
event: TrustedEvent
|
event: TrustedEvent
|
||||||
|
inline?: boolean
|
||||||
url?: string
|
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 {id, identifier, kind, pubkey = value.author, relays = []} = value
|
||||||
const idOrAddress = id || new Address(kind, pubkey, identifier).toString()
|
const idOrAddress = id || new Address(kind, pubkey, identifier).toString()
|
||||||
|
|
@ -72,8 +75,14 @@
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<Button class="my-2 block w-full max-w-full text-left" {onclick}>
|
<Button
|
||||||
{#if $quote}
|
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]+$/)}
|
{#if $quote.content.trim().match(/^(nostr:)?nevent1[a-z0-9]+$/)}
|
||||||
<NoteContent {url} event={$quote} />
|
<NoteContent {url} event={$quote} />
|
||||||
{:else if $quote.kind === MESSAGE}
|
{:else if $quote.kind === MESSAGE}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue