mirror of
https://seed.radicle.dev/rad:z4V1sjrXqjvFdnCUbxPFqd5p4DtH5.git
synced 2026-11-29 18:20:30 +08:00
Add editing to issue/patch descriptions, comments and replies
Also does some refactoring for `action`, `editable` and other variables we were using which weren't very clear Signed-off-by: Sebastian Martinez <me@sebastinez.dev>
This commit is contained in:
@@ -0,0 +1,62 @@
|
||||
<script lang="ts">
|
||||
import type { Embed } from "@app/lib/file";
|
||||
import { createEventDispatcher } from "svelte";
|
||||
import ExtendedTextarea from "@app/components/ExtendedTextarea.svelte";
|
||||
|
||||
const dispatch = createEventDispatcher<{
|
||||
submit: {
|
||||
comment: string;
|
||||
embeds: Embed[];
|
||||
};
|
||||
}>();
|
||||
|
||||
export let body: string | undefined = undefined;
|
||||
export let placeholder: string | undefined = undefined;
|
||||
export let submitCaption: string | undefined = undefined;
|
||||
export let enableAttachments: boolean = false;
|
||||
export let inline: boolean = false;
|
||||
export let focus: boolean = false;
|
||||
export let submitInProgress: boolean = false;
|
||||
|
||||
let active: boolean = false;
|
||||
</script>
|
||||
|
||||
<style>
|
||||
.inactive {
|
||||
box-shadow: 0 0 0 1px var(--color-border-hint);
|
||||
border-radius: var(--border-radius-small);
|
||||
padding: 0.5rem 0.75rem;
|
||||
background-color: var(--color-background-dip);
|
||||
font-size: var(--font-size-small);
|
||||
color: var(--color-fill-gray);
|
||||
cursor: text;
|
||||
}
|
||||
.inactive:hover {
|
||||
box-shadow: 0 0 0 1px var(--color-border-default);
|
||||
}
|
||||
</style>
|
||||
|
||||
{#if active}
|
||||
<ExtendedTextarea
|
||||
{inline}
|
||||
{placeholder}
|
||||
{submitCaption}
|
||||
{submitInProgress}
|
||||
{focus}
|
||||
{body}
|
||||
{enableAttachments}
|
||||
on:close={() => (active = false)}
|
||||
on:submit={event => {
|
||||
active = false;
|
||||
dispatch("submit", event.detail);
|
||||
}} />
|
||||
{:else}
|
||||
<!-- svelte-ignore a11y-click-events-have-key-events -->
|
||||
<div
|
||||
class="inactive"
|
||||
role="button"
|
||||
tabindex="0"
|
||||
on:click={() => (active = true)}>
|
||||
{placeholder}
|
||||
</div>
|
||||
{/if}
|
||||
Reference in New Issue
Block a user