diff --git a/src/app/components/ChannelCompose.svelte b/src/app/components/ChannelCompose.svelte index a63df6e..164b6b8 100644 --- a/src/app/components/ChannelCompose.svelte +++ b/src/app/components/ChannelCompose.svelte @@ -17,7 +17,7 @@ const submit = () => { onSubmit({ - content: $editor.getText(), + content: $editor.getText({blockSeparator: '\n'}), tags: getEditorTags($editor), }) diff --git a/src/app/components/Content.svelte b/src/app/components/Content.svelte index 0bd95b6..f9f50a7 100644 --- a/src/app/components/Content.svelte +++ b/src/app/components/Content.svelte @@ -35,7 +35,7 @@ export let maxLength = 700 export let showEntire = false export let hideMedia = false - export let expandable = true + export let expandMode = "block" export let depth = 0 const fullContent = parse(event) @@ -80,7 +80,9 @@ mediaLength: hideMedia ? 20 : 200, }) - $: ellipsize = expandable && shortContent.find(isEllipsis) + $: hasEllipsis = shortContent.find(isEllipsis) + $: expandInline = hasEllipsis && expandMode === "inline" + $: expandBlock = hasEllipsis && expandMode === "block"
@@ -95,10 +97,10 @@ {:else}
+ style={expandBlock ? "mask-image: linear-gradient(0deg, transparent 0px, black 100px)" : ""}> {#each shortContent as parsed, i} {#if isNewline(parsed)} - + {:else if isTopic(parsed)} {:else if isCode(parsed)} @@ -128,12 +130,17 @@ {fromNostrURI(parsed.raw).slice(0, 16) + "…"} {/if} + {:else if isEllipsis(parsed) && expandInline} + {@html renderParsed(parsed)} + {:else} {@html renderParsed(parsed)} {/if} {/each}
- {#if ellipsize} + {#if expandBlock}
-{/each} +{#if $reactions.length > 0} +
+ {#each groupedReactions.entries() as [content, events]} + {@const isOwn = events.some(e => e.pubkey === $pubkey)} + {@const onClick = () => onReactionClick(content, events)} + + {/each} +
+{/if} diff --git a/src/app/components/ThreadActions.svelte b/src/app/components/ThreadActions.svelte index 98e0a58..acb8064 100644 --- a/src/app/components/ThreadActions.svelte +++ b/src/app/components/ThreadActions.svelte @@ -45,10 +45,8 @@
- -
+ +
{#if $deleted}
Deleted
{/if} diff --git a/src/app/components/ThreadCreate.svelte b/src/app/components/ThreadCreate.svelte index a1c90a4..1e5dadd 100644 --- a/src/app/components/ThreadCreate.svelte +++ b/src/app/components/ThreadCreate.svelte @@ -34,7 +34,7 @@ }) } - const content = $editor.getText() + const content = $editor.getText({blockSeparator: '\n'}) if (!content.trim()) { return pushToast({ diff --git a/src/app/components/ThreadItem.svelte b/src/app/components/ThreadItem.svelte index 9887f13..5d2ed26 100644 --- a/src/app/components/ThreadItem.svelte +++ b/src/app/components/ThreadItem.svelte @@ -1,25 +1,35 @@ -
- +
+

{title}

{formatTimestamp(event.created_at)}

-
- + +
+ + Posted by + + @ + + {#if !hideActions} {/if} diff --git a/src/app/components/ThreadReply.svelte b/src/app/components/ThreadReply.svelte index 6033b06..eca3524 100644 --- a/src/app/components/ThreadReply.svelte +++ b/src/app/components/ThreadReply.svelte @@ -23,7 +23,7 @@ const loading = writable(false) const submit = () => { - const content = $editor.getText() + const content = $editor.getText({blockSeparator: '\n'}) const tags = append(tagRoom(GENERAL, url), getEditorTags($editor)) if (!content.trim()) { diff --git a/src/lib/components/PageBar.svelte b/src/lib/components/PageBar.svelte index 4fb36a6..30d23d7 100644 --- a/src/lib/components/PageBar.svelte +++ b/src/lib/components/PageBar.svelte @@ -1,4 +1,4 @@ -
+
diff --git a/src/lib/editor/index.ts b/src/lib/editor/index.ts index 2f5df5e..8151ce8 100644 --- a/src/lib/editor/index.ts +++ b/src/lib/editor/index.ts @@ -65,7 +65,7 @@ export const getModifiedHardBreakExtension = () => "Shift-Enter": () => this.editor.commands.setHardBreak(), "Mod-Enter": () => this.editor.commands.setHardBreak(), Enter: () => { - if (this.editor.getText().trim()) { + if (this.editor.getText({blockSeparator: '\n'}).trim()) { uploadFiles(this.editor) return true diff --git a/src/routes/spaces/[relay]/threads/[id]/+page.svelte b/src/routes/spaces/[relay]/threads/[id]/+page.svelte index efe7646..82c64fa 100644 --- a/src/routes/spaces/[relay]/threads/[id]/+page.svelte +++ b/src/routes/spaces/[relay]/threads/[id]/+page.svelte @@ -1,6 +1,6 @@
-
+
{#if $event} {#if !showReply}
@@ -57,14 +59,14 @@ {#each sortBy(e => -e.created_at, $replies) as reply (reply.id)}
- +
{/each}
- +
@@ -75,13 +77,14 @@

Failed to load thread.

{/await} {/if} - +
+

{title}