mirror of
https://github.com/coracle-social/coracle.git
synced 2024-09-30 00:41:12 +00:00
Fix mentions
This commit is contained in:
parent
090f9d888e
commit
707a17d075
@ -23,8 +23,12 @@
|
|||||||
export let showParent = true
|
export let showParent = true
|
||||||
export let invertColors = false
|
export let invertColors = false
|
||||||
|
|
||||||
|
const getDefaultReplyMentions = () =>
|
||||||
|
Tags.from(note).type("p").values().all().concat(note.pubkey)
|
||||||
|
|
||||||
let reply = null
|
let reply = null
|
||||||
let replyMentions = without([$user?.pubkey], Tags.from(note).type("p").values().all())
|
let replyMentions = without([$user?.pubkey], getDefaultReplyMentions())
|
||||||
|
let replyContainer = null
|
||||||
|
|
||||||
const links = $settings.showLinkPreviews ? extractUrls(note.content) || [] : null
|
const links = $settings.showLinkPreviews ? extractUrls(note.content) || [] : null
|
||||||
const showEntire = anchorId === note.id
|
const showEntire = anchorId === note.id
|
||||||
@ -100,7 +104,7 @@
|
|||||||
|
|
||||||
const resetReply = () => {
|
const resetReply = () => {
|
||||||
reply = null
|
reply = null
|
||||||
replyMentions = Tags.from(note).type("p").values().all()
|
replyMentions = getDefaultReplyMentions()
|
||||||
}
|
}
|
||||||
|
|
||||||
const sendReply = () => {
|
const sendReply = () => {
|
||||||
@ -117,7 +121,7 @@
|
|||||||
const onBodyClick = e => {
|
const onBodyClick = e => {
|
||||||
const target = e.target as HTMLElement
|
const target = e.target as HTMLElement
|
||||||
|
|
||||||
if (!target.closest('.fa-reply') && !target.closest('.note-reply')) {
|
if (replyContainer && !replyContainer.contains(target)) {
|
||||||
resetReply()
|
resetReply()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -157,26 +161,22 @@
|
|||||||
<div class="text-ellipsis overflow-hidden flex flex-col gap-2">
|
<div class="text-ellipsis overflow-hidden flex flex-col gap-2">
|
||||||
<p>{@html renderNote(note, {showEntire})}</p>
|
<p>{@html renderNote(note, {showEntire})}</p>
|
||||||
{#each links.slice(-2) as link}
|
{#each links.slice(-2) as link}
|
||||||
<div>
|
<button class="inline-block" on:click={e => e.stopPropagation()}>
|
||||||
<button class="inline-block" on:click={e => e.stopPropagation()}>
|
<Preview endpoint={`${$settings.dufflepudUrl}/link/preview`} url={link} />
|
||||||
<Preview endpoint={`${$settings.dufflepudUrl}/link/preview`} url={link} />
|
</button>
|
||||||
</button>
|
|
||||||
</div>
|
|
||||||
{/each}
|
{/each}
|
||||||
</div>
|
</div>
|
||||||
<div class="flex gap-6 text-light">
|
<div class="flex gap-6 text-light" on:click={e => e.stopPropagation()}>
|
||||||
<div>
|
<div>
|
||||||
<button class="fa fa-reply cursor-pointer" on:click|stopPropagation={startReply} />
|
<button class="fa fa-reply cursor-pointer" on:click={startReply} />
|
||||||
{note.replies.length}
|
{note.replies.length}
|
||||||
</div>
|
</div>
|
||||||
<div class={cx({'text-accent': like})}>
|
<div class={cx({'text-accent': like})}>
|
||||||
<button
|
<button class="fa fa-heart cursor-pointer" on:click={() => like ? deleteReaction(like) : react("+")} />
|
||||||
class="fa fa-heart cursor-pointer"
|
|
||||||
on:click|stopPropagation={() => like ? deleteReaction(like) : react("+")} />
|
|
||||||
{likes.length}
|
{likes.length}
|
||||||
</div>
|
</div>
|
||||||
<div>
|
<div>
|
||||||
<button class="fa fa-flag cursor-pointer" on:click|stopPropagation={() => react("-")} />
|
<button class="fa fa-flag cursor-pointer" on:click={() => react("-")} />
|
||||||
{flags.length}
|
{flags.length}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@ -185,7 +185,7 @@
|
|||||||
</Card>
|
</Card>
|
||||||
|
|
||||||
{#if reply}
|
{#if reply}
|
||||||
<div transition:slide class="note-reply">
|
<div transition:slide class="note-reply" bind:this={replyContainer}>
|
||||||
<div class="bg-medium border-medium border border-solid">
|
<div class="bg-medium border-medium border border-solid">
|
||||||
<Compose bind:this={reply} onSubmit={sendReply}>
|
<Compose bind:this={reply} onSubmit={sendReply}>
|
||||||
<button
|
<button
|
||||||
|
Loading…
Reference in New Issue
Block a user