Listen for new threads, add reply/quote button to channels and chats, better quote handling

This commit is contained in:
Jon Staab
2024-11-19 13:24:18 -08:00
parent 6a646b3240
commit f4f60a5333
12 changed files with 153 additions and 51 deletions
+11 -15
View File
@@ -1,19 +1,24 @@
<script lang="ts">
import {onMount} from "svelte"
import type {Readable} from "svelte/store"
import {createEditor, type Editor, EditorContent} from "svelte-tiptap"
import {createEditor, EditorContent} from "svelte-tiptap"
import {isMobile} from "@lib/html"
import Icon from "@lib/components/Icon.svelte"
import Button from "@lib/components/Button.svelte"
import {getEditorOptions, getEditorTags} from "@lib/editor"
import {getPubkeyHints} from "@app/commands"
export let onSubmit
export let onSubmit: any
export let content = ""
export let editor = createEditor(
getEditorOptions({
submit,
getPubkeyHints,
submitOnEnter: true,
autofocus: !isMobile,
}),
)
let editor: Readable<Editor>
const submit = () => {
function submit() {
if ($loading) return
onSubmit({
@@ -27,15 +32,6 @@
$: loading = $editor?.storage.fileUpload.loading
onMount(() => {
editor = createEditor(
getEditorOptions({
submit,
getPubkeyHints,
submitOnEnter: true,
autofocus: !isMobile,
}),
)
$editor.commands.setContent(content)
})
</script>