migrate: use svelte 5 event system
This commit is contained in:
1 parent
dd9abe5345
commit
9025f5db18
18 files changed
+70
-60
No files matched your search
@@ -237,7 +237,7 @@
|
||||
<CommentActions
|
||||
comment={node.comment_view}
|
||||
bind:replying
|
||||
on:edit={() => (editing = true)}
|
||||
onedit={() => (editing = true)}
|
||||
disabled={node.comment_view.banned_from_community ||
|
||||
node.comment_view.post.locked}
|
||||
/>
|
||||
|
||||
@@ -32,18 +32,15 @@
|
||||
comment: CommentView
|
||||
replying?: boolean
|
||||
disabled?: boolean
|
||||
onedit?: (comment: CommentView) => void
|
||||
}
|
||||
|
||||
let {
|
||||
comment = $bindable(),
|
||||
replying = $bindable(false),
|
||||
disabled = false,
|
||||
onedit,
|
||||
}: Props = $props()
|
||||
|
||||
const dispatcher = createEventDispatcher<{ edit: CommentView }>()
|
||||
|
||||
let reply = ''
|
||||
let translating = $state(false)
|
||||
</script>
|
||||
|
||||
<div
|
||||
@@ -97,7 +94,7 @@
|
||||
</MenuButton>
|
||||
{#if $profile?.jwt}
|
||||
{#if comment.creator.id == $profile.user?.local_user_view.person.id}
|
||||
<MenuButton onclick={() => dispatcher('edit', comment)}>
|
||||
<MenuButton onclick={() => onedit?.(comment)}>
|
||||
<Icon src={PencilSquare} mini size="16" />
|
||||
<span>{$t('post.actions.more.edit')}</span>
|
||||
</MenuButton>
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
|
||||
let { nodes, post, scrollTo }: Props = $props()
|
||||
|
||||
let virtualListEl: HTMLElement | undefined = $state(undefined)
|
||||
let virtualListEl = $state<HTMLElement>()
|
||||
|
||||
let virtualizer = $derived(
|
||||
createWindowVirtualizer({
|
||||
|
||||
@@ -27,7 +27,6 @@ export function buildCommentsTree(
|
||||
baseDepth: number = 0,
|
||||
filter: (c: CommentView) => boolean = (c) => true,
|
||||
): CommentNodeI[] {
|
||||
const start = performance.now()
|
||||
const map = new Map<number, CommentNodeI>()
|
||||
|
||||
let min_depth = Number.MAX_VALUE
|
||||
@@ -69,7 +68,6 @@ export function buildCommentsTree(
|
||||
}
|
||||
}
|
||||
|
||||
console.log(`Built tree in ${performance.now() - start}ms`)
|
||||
return tree
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user