mirror of
https://seed.radicle.dev/rad:z4V1sjrXqjvFdnCUbxPFqd5p4DtH5.git
synced 2026-11-21 14:20:42 +08:00
Add embeds to patches
Signed-off-by: Sebastian Martinez <me@sebastinez.dev>
This commit is contained in:
@@ -1,4 +1,6 @@
|
||||
<script lang="ts" strictEvents>
|
||||
import type { Embed } from "@app/lib/file";
|
||||
|
||||
import { createEventDispatcher, tick } from "svelte";
|
||||
|
||||
import { authenticated } from "@app/lib/httpd";
|
||||
@@ -16,6 +18,7 @@
|
||||
export let authorId: string;
|
||||
export let authorAlias: string | undefined = undefined;
|
||||
export let body: string;
|
||||
export let enableAttachments: boolean = false;
|
||||
export let reactions: [string, string][];
|
||||
export let caption = "commented";
|
||||
export let rawPath: string;
|
||||
@@ -29,7 +32,7 @@
|
||||
|
||||
const dispatch = createEventDispatcher<{
|
||||
react: { nids: string[]; id: string; reaction: string };
|
||||
edit: string;
|
||||
edit: { comment: string; embeds: Embed[] };
|
||||
}>();
|
||||
|
||||
$: groupedReactions = reactions?.reduce(
|
||||
@@ -144,12 +147,12 @@
|
||||
{#if editInProgress}
|
||||
<ExtendedTextarea
|
||||
{body}
|
||||
enableAttachments
|
||||
{enableAttachments}
|
||||
submitCaption="Save"
|
||||
placeholder="Leave your description"
|
||||
on:submit={({ detail: { comment } }) => {
|
||||
on:submit={({ detail: { comment, embeds } }) => {
|
||||
editInProgress = false;
|
||||
dispatch("edit", comment);
|
||||
dispatch("edit", { comment, embeds });
|
||||
}}
|
||||
on:close={async () => {
|
||||
body = body;
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
<script lang="ts" strictEvents>
|
||||
import type { Comment } from "@httpd-client";
|
||||
import type { Embed } from "@app/lib/file";
|
||||
|
||||
import { createEventDispatcher, tick } from "svelte";
|
||||
import { httpdStore } from "@app/lib/httpd";
|
||||
@@ -25,10 +26,10 @@
|
||||
const dispatch = createEventDispatcher<{
|
||||
reply: {
|
||||
id: string;
|
||||
embeds: { name: string; content: string }[];
|
||||
embeds: Embed[];
|
||||
body: string;
|
||||
};
|
||||
editComment: { id: string; body: string };
|
||||
editComment: { id: string; body: string; embeds: Embed[] };
|
||||
react: { nids: string[]; commentId: string | undefined; reaction: string };
|
||||
cancel: never;
|
||||
}>();
|
||||
@@ -73,8 +74,12 @@
|
||||
timestamp={root.timestamp}
|
||||
disableEdit={root.embeds.length > 0}
|
||||
body={root.body}
|
||||
on:edit={event =>
|
||||
dispatch("editComment", { id: root.id, body: event.detail })}
|
||||
on:edit={({ detail }) =>
|
||||
dispatch("editComment", {
|
||||
id: root.id,
|
||||
body: detail.comment,
|
||||
embeds: detail.embeds,
|
||||
})}
|
||||
on:react>
|
||||
<IconSmall name="chat" slot="icon" />
|
||||
</CommentComponent>
|
||||
@@ -94,8 +99,12 @@
|
||||
timestamp={reply.timestamp}
|
||||
disableEdit={reply.embeds.length > 0}
|
||||
body={reply.body}
|
||||
on:edit={event =>
|
||||
dispatch("editComment", { id: reply.id, body: event.detail })}
|
||||
on:edit={({ detail }) =>
|
||||
dispatch("editComment", {
|
||||
id: reply.id,
|
||||
body: detail.comment,
|
||||
embeds: detail.embeds,
|
||||
})}
|
||||
on:react />
|
||||
{/each}
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user