forked from coracle/flotilla
Stop trying to use editor to view notes
This commit is contained in:
@@ -30,7 +30,7 @@
|
||||
}
|
||||
|
||||
onMount(() => {
|
||||
editor = createEditor(getEditorOptions({submit, loading, getPubkeyHints, submitOnEnter: true}))
|
||||
editor = createEditor(getEditorOptions({submit, loading, getPubkeyHints, submitOnEnter: true, autofocus: true}))
|
||||
})
|
||||
</script>
|
||||
|
||||
|
||||
@@ -2,7 +2,6 @@
|
||||
import {onMount} from "svelte"
|
||||
import twColors from "tailwindcss/colors"
|
||||
import type {Readable} from "svelte/store"
|
||||
import {createEditor, type Editor, EditorContent} from "svelte-tiptap"
|
||||
import {readable, derived} from "svelte/store"
|
||||
import {hash, groupBy, now} from "@welshman/lib"
|
||||
import type {TrustedEvent} from "@welshman/util"
|
||||
@@ -22,7 +21,6 @@
|
||||
import Button from "@lib/components/Button.svelte"
|
||||
import Avatar from "@lib/components/Avatar.svelte"
|
||||
import {REPLY, deriveEvent, displayReaction} from "@app/state"
|
||||
import {getViewOptions} from "@lib/editor"
|
||||
|
||||
export let event: TrustedEvent
|
||||
export let showPubkey: boolean
|
||||
@@ -63,8 +61,6 @@
|
||||
const findStatus = ($ps: PublishStatusData[], statuses: PublishStatus[]) =>
|
||||
$ps.find(({status}) => statuses.includes(status))
|
||||
|
||||
let editor: Readable<Editor>
|
||||
|
||||
$: parentPubkey = $parentEvent?.pubkey || replies[0]?.[4]
|
||||
$: parentProfile = deriveProfile(parentPubkey || "")
|
||||
$: parentProfileDisplay = deriveProfileDisplay(parentPubkey || "")
|
||||
@@ -72,10 +68,6 @@
|
||||
$: isPending = findStatus($ps, [PublishStatus.Pending]) && event.created_at > now() - 30
|
||||
$: failure =
|
||||
!isPending && !isPublished && findStatus($ps, [PublishStatus.Failure, PublishStatus.Timeout])
|
||||
|
||||
onMount(() => {
|
||||
editor = createEditor(getViewOptions(event))
|
||||
})
|
||||
</script>
|
||||
|
||||
<div in:fly class="group relative flex flex-col gap-1 p-2 transition-colors hover:bg-base-300">
|
||||
@@ -107,7 +99,7 @@
|
||||
</div>
|
||||
{/if}
|
||||
<p class="text-sm">
|
||||
<EditorContent editor={$editor} />
|
||||
{event.content}
|
||||
{#if isPending}
|
||||
<span class="flex-inline ml-1 gap-1">
|
||||
<span class="loading loading-spinner mx-1 h-3 w-3 translate-y-px" />
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
<script lang="ts">
|
||||
import {fromPairs} from "@welshman/lib"
|
||||
import {getAddress} from "@welshman/util"
|
||||
import {secondsToDate, getLocale, formatTimestamp, formatTimestampAsDate} from "@welshman/app"
|
||||
import Icon from "@lib/components/Icon.svelte"
|
||||
|
||||
|
||||
@@ -29,7 +29,7 @@
|
||||
let editor: Readable<Editor>
|
||||
|
||||
onMount(() => {
|
||||
editor = createEditor(getEditorOptions({submit, loading, getPubkeyHints}))
|
||||
editor = createEditor(getEditorOptions({submit, loading, getPubkeyHints, autofocus: true}))
|
||||
})
|
||||
</script>
|
||||
|
||||
|
||||
@@ -1,25 +1,13 @@
|
||||
<script lang="ts">
|
||||
import {onMount} from "svelte"
|
||||
import type {Readable} from "svelte/store"
|
||||
import {createEditor, type Editor, EditorContent} from "svelte-tiptap"
|
||||
import {displayPubkey} from "@welshman/util"
|
||||
import {deriveProfile, deriveProfileDisplay, formatTimestamp} from "@welshman/app"
|
||||
import Avatar from "@lib/components/Avatar.svelte"
|
||||
import {getEditorOptions} from "@lib/editor"
|
||||
|
||||
export let root
|
||||
export let replies
|
||||
|
||||
const profile = deriveProfile(root.pubkey)
|
||||
const profileDisplay = deriveProfileDisplay(root.pubkey)
|
||||
|
||||
let editor: Readable<Editor>
|
||||
|
||||
onMount(() => {
|
||||
editor = createEditor(getEditorOptions({}))
|
||||
|
||||
setTimeout(() => $editor.commands.insertContent(root.content, {applyPasteRules: true}), 100)
|
||||
})
|
||||
</script>
|
||||
|
||||
<div>
|
||||
@@ -36,9 +24,7 @@
|
||||
</div>
|
||||
<span class="text-sm opacity-75">{formatTimestamp(root.created_at)}</span>
|
||||
</div>
|
||||
<div class="ml-12">
|
||||
<EditorContent editor={$editor} />
|
||||
</div>
|
||||
<div class="ml-12"></div>
|
||||
</div>
|
||||
{#if replies.length > 0}
|
||||
Show {replies.length} {replies.length === 1 ? "reply" : "replies"}
|
||||
|
||||
Reference in New Issue
Block a user