-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #9 from cesardeazevedo/pr-2349
Pr 2349
- Loading branch information
Showing
8 changed files
with
67 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
<script lang="ts"> | ||
import { onMount } from 'svelte' | ||
import { pool } from '../../nostr' | ||
import type { NostrEvent } from 'nostr-tools/core' | ||
export let id: string | ||
export let nevent: string | ||
export let relays: string[] | ||
let event: any = null | ||
onMount(async () => { | ||
const subscription = pool.subscribeMany(relays, [{ ids: [id] }], { | ||
onevent(e: NostrEvent) { | ||
event = e | ||
}, | ||
}) | ||
return () => subscription.close() | ||
}) | ||
</script> | ||
|
||
<span | ||
data-tooltip={` | ||
Id: ${id} | ||
. | ||
Relays: ${JSON.stringify(relays)} | ||
`}> | ||
{#if event} | ||
<a href="#">{nevent.replace('nostr:', '').slice(0, 12)}: {event.content.slice(0, 20)}...</a> | ||
{:else} | ||
<span class="text-gray-600">loading</span> | ||
{/if} | ||
</span> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
<script lang="ts"> | ||
import type { NodeViewProps, NodeViewRendererProps } from '@tiptap/core' | ||
import type { NEventAttributes } from 'nostr-editor' | ||
import { NodeViewWrapper, NodeViewContent } from 'svelte-tiptap' | ||
import NEvent from './NEvent.svelte' | ||
export let node: NodeViewProps['node'] | ||
$: attrs = node.attrs as NEventAttributes | ||
</script> | ||
|
||
<NodeViewWrapper data-type="nevent" as="span"> | ||
<NEvent id={attrs.id} relays={attrs.relays} nevent={attrs.nevent} /> | ||
</NodeViewWrapper> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters