migrate: switch to callbacks instead of events
This commit is contained in:
1 parent
c7e2963390
commit
b291aeebf8
67 files changed
+332
-357
No files matched your search
@@ -170,7 +170,7 @@
|
||||
{/await}
|
||||
{/if}
|
||||
<Button
|
||||
on:click={() => (debug = true)}
|
||||
onclick={() => (debug = true)}
|
||||
title="Debug"
|
||||
size="custom"
|
||||
color="ghost"
|
||||
@@ -196,7 +196,7 @@
|
||||
|
||||
{#if $profile?.jwt}
|
||||
<Button
|
||||
on:click={async () => {
|
||||
onclick={async () => {
|
||||
if (!$profile?.jwt) return
|
||||
saving = true
|
||||
post.saved = await save(post, !post.saved, $profile?.jwt)
|
||||
@@ -312,7 +312,7 @@
|
||||
{$t('post.actions.more.actions')}
|
||||
</MenuDivider>
|
||||
{#if $profile?.user && $profile?.jwt && $profile.user.local_user_view.person.id == post.creator.id}
|
||||
<MenuButton on:click={() => (editing = true)}>
|
||||
<MenuButton onclick={() => (editing = true)}>
|
||||
{#snippet prefix()}
|
||||
<Icon src={PencilSquare} size="16" micro />
|
||||
{/snippet}
|
||||
@@ -321,7 +321,7 @@
|
||||
{/if}
|
||||
{#if $profile?.jwt}
|
||||
<MenuButton
|
||||
on:click={async () => {
|
||||
onclick={async () => {
|
||||
if ($profile?.jwt)
|
||||
post.read = await markAsRead(post.post, !post.read, $profile.jwt)
|
||||
}}
|
||||
@@ -335,7 +335,7 @@
|
||||
</MenuButton>
|
||||
{/if}
|
||||
<MenuButton
|
||||
on:click={() => {
|
||||
onclick={() => {
|
||||
navigator.share?.({
|
||||
url: localShare
|
||||
? `${instanceToURL(getInstance())}/post/${post.post.id}`
|
||||
@@ -361,7 +361,7 @@
|
||||
color={!localShare ? 'primary' : 'secondary'}
|
||||
size="square-md"
|
||||
roundingSide="left"
|
||||
on:click={() => (localShare = false)}
|
||||
onclick={() => (localShare = false)}
|
||||
title={$t('filter.location.global')}
|
||||
>
|
||||
<Icon src={GlobeAmericas} size="16" micro />
|
||||
@@ -370,7 +370,7 @@
|
||||
color={localShare ? 'primary' : 'secondary'}
|
||||
size="square-md"
|
||||
roundingSide="right"
|
||||
on:click={() => (localShare = true)}
|
||||
onclick={() => (localShare = true)}
|
||||
title={$t('filter.location.local')}
|
||||
>
|
||||
<Icon src={MapPin} size="16" micro />
|
||||
@@ -380,7 +380,7 @@
|
||||
</MenuButton>
|
||||
{#if post.post.body && settings.translator}
|
||||
<MenuButton
|
||||
on:click={() => {
|
||||
onclick={() => {
|
||||
// @ts-ignore
|
||||
text.set(post.post.body)
|
||||
translating = !translating
|
||||
@@ -394,7 +394,7 @@
|
||||
{/if}
|
||||
{#if $profile?.jwt}
|
||||
<MenuButton
|
||||
on:click={() => {
|
||||
onclick={() => {
|
||||
setSessionStorage('postDraft', {
|
||||
body: `${
|
||||
settings.crosspostOriginalLink
|
||||
@@ -423,7 +423,7 @@
|
||||
</MenuButton>
|
||||
{#if $profile.user && post.creator.id == $profile.user.local_user_view.person.id}
|
||||
<MenuButton
|
||||
on:click={async () => {
|
||||
onclick={async () => {
|
||||
if ($profile?.jwt)
|
||||
post.post.deleted = await deleteItem(
|
||||
post,
|
||||
@@ -444,7 +444,7 @@
|
||||
{#if $profile.user?.local_user_view.person.id != post.creator.id}
|
||||
{#if feature('hidePosts', $site?.version)}
|
||||
<MenuButton
|
||||
on:click={async () => {
|
||||
onclick={async () => {
|
||||
if (!$profile?.jwt) return
|
||||
const hidden = await hidePost(
|
||||
post.post.id,
|
||||
@@ -466,7 +466,7 @@
|
||||
: $t('post.actions.more.hide')}
|
||||
</MenuButton>
|
||||
{/if}
|
||||
<MenuButton on:click={() => report(post)} color="danger-subtle">
|
||||
<MenuButton onclick={() => report(post)} color="danger-subtle">
|
||||
{#snippet prefix()}
|
||||
<Icon src={Flag} width={16} micro />
|
||||
{/snippet}
|
||||
|
||||
@@ -51,7 +51,7 @@ ${view == 'list' ? `max-h-24` : 'max-h-48'}`
|
||||
<Markdown inline={!expanded} source={expanded ? body : body.slice(0, 1000)} />
|
||||
{#if overflows}
|
||||
<Button
|
||||
on:click={() => (expanded = !expanded)}
|
||||
onclick={() => (expanded = !expanded)}
|
||||
size="square-sm"
|
||||
color="tertiary"
|
||||
class="text-black dark:text-white absolute z-10 isolate pointer-events-auto bottom-0 {expanded
|
||||
|
||||
@@ -278,7 +278,7 @@
|
||||
color="primary"
|
||||
{loading}
|
||||
disabled={loading}
|
||||
on:click={() => loadMore()}
|
||||
onclick={() => loadMore()}
|
||||
>
|
||||
{$t('message.retry')}
|
||||
</Button>
|
||||
|
||||
@@ -295,7 +295,7 @@
|
||||
<span class="font-medium text-sm">{$t('form.post.community')}</span>
|
||||
<Button
|
||||
class="w-full !bg-white dark:!bg-black h-[38px]"
|
||||
on:click={() => (data.community = null)}
|
||||
onclick={() => (data.community = null)}
|
||||
alignment="left"
|
||||
size="sm"
|
||||
>
|
||||
@@ -347,7 +347,7 @@
|
||||
</div>
|
||||
{#if data.url}
|
||||
<Button
|
||||
on:click={() => (addAltText = !addAltText)}
|
||||
onclick={() => (addAltText = !addAltText)}
|
||||
rounding="pill"
|
||||
size="sm"
|
||||
color="ghost"
|
||||
@@ -359,7 +359,7 @@
|
||||
</Button>
|
||||
{/if}
|
||||
<Button
|
||||
on:click={() => (uploadingImage = !uploadingImage)}
|
||||
onclick={() => (uploadingImage = !uploadingImage)}
|
||||
rounding="pill"
|
||||
size="sm"
|
||||
color="ghost"
|
||||
@@ -372,7 +372,7 @@
|
||||
</Button>
|
||||
{#if generation.generatable}
|
||||
<Button
|
||||
on:click={() => generateTitle(data.url)}
|
||||
onclick={() => generateTitle(data.url)}
|
||||
loading={generation.loading}
|
||||
rounding="pill"
|
||||
size="sm"
|
||||
@@ -391,7 +391,7 @@
|
||||
<div class="flex flex-row gap-2 flex-wrap">
|
||||
{#if data.url === undefined}
|
||||
<Button
|
||||
on:click={async () => {
|
||||
onclick={async () => {
|
||||
data.url = ''
|
||||
try {
|
||||
const url = new URL(await navigator.clipboard.readText())
|
||||
@@ -406,7 +406,7 @@
|
||||
{$t('form.post.addUrl')}
|
||||
</Button>
|
||||
<Button
|
||||
on:click={() => {
|
||||
onclick={() => {
|
||||
data.url = ''
|
||||
uploadingImage = true
|
||||
}}
|
||||
@@ -418,7 +418,7 @@
|
||||
</Button>
|
||||
{/if}
|
||||
{#if data.language_id === undefined}
|
||||
<Button size="sm" rounding="pill" on:click={() => (data.language_id = 0)}>
|
||||
<Button size="sm" rounding="pill" onclick={() => (data.language_id = 0)}>
|
||||
<Icon src={Language} size="16" micro />
|
||||
{$t('form.post.setLanguage')}
|
||||
</Button>
|
||||
@@ -466,7 +466,7 @@
|
||||
|
||||
{#if !edit}
|
||||
<Button
|
||||
on:click={() => {
|
||||
onclick={() => {
|
||||
toast({ content: $t('toast.restoredFromDraft') })
|
||||
const draft = getSessionStorage('postDraft')
|
||||
if (draft && !edit) {
|
||||
|
||||
@@ -68,7 +68,7 @@
|
||||
{/each}
|
||||
<MenuDivider>{$t('post.actions.link.actions')}</MenuDivider>
|
||||
<MenuButton
|
||||
on:click={() => {
|
||||
onclick={() => {
|
||||
navigator?.share?.({ url: url }) ?? navigator?.clipboard?.writeText?.(url)
|
||||
|
||||
toast({ content: $t('toast.copied') })
|
||||
|
||||
@@ -82,7 +82,7 @@
|
||||
>
|
||||
{#if post.alt_text}
|
||||
<Button
|
||||
on:click={(e) => {
|
||||
onclick={(e) => {
|
||||
e.stopPropagation()
|
||||
modal({
|
||||
title: 'Alt',
|
||||
|
||||
Reference in new issue
Block a user