Add send button

This commit is contained in:
Jon Staab
2025-01-15 09:07:12 -08:00
parent be7a42d951
commit edd6e5c8fc
6 changed files with 21 additions and 19 deletions
+14 -5
View File
@@ -19,16 +19,18 @@
const submit = () => {
if ($uploading) return
onSubmit({
content: $editor!.getText({blockSeparator: "\n"}).trim(),
tags: $editor!.storage.nostr.getEditorTags(),
})
const content = $editor!.getText({blockSeparator: "\n"}).trim()
const tags = $editor!.storage.nostr.getEditorTags()
if (!content) return
onSubmit({content, tags})
$editor!.chain().clearContent().run()
}
onMount(() => {
editor = getEditor({autofocus: !isMobile, aggressive: true, element, submit, uploading})
editor = getEditor({autofocus: !isMobile, element, submit, uploading})
$editor!.chain().setContent(content).run()
})
@@ -51,4 +53,11 @@
<div class="chat-editor flex-grow overflow-hidden">
<div bind:this={element} />
</div>
<Button
data-tip="{window.navigator.platform.includes('Mac') ? 'cmd' : 'ctrl'}+enter to send"
class="center tooltip tooltip-left absolute right-4 h-10 w-10 min-w-10 rounded-full"
disabled={$uploading}
on:click={submit}>
<Icon icon="plain" />
</Button>
</form>
+1 -1
View File
@@ -22,7 +22,7 @@
const expand = () => pushModal(ContentLinkDetail, {url}, {fullscreen: true})
</script>
<Link external href={url} class="my-2 inline-block">
<Link external href={url} class="my-2 block">
<div class="overflow-hidden rounded-box leading-[0]">
{#if url.match(/\.(mov|webm|mp4)$/)}
<video controls src={url} class="max-h-96 object-contain object-center">
+1 -1
View File
@@ -54,7 +54,7 @@
{#if url && $reports.length > 0}
<button
type="button"
data-tip={`This content has been reported as "${displayList(reportReasons)}".`}}
data-tip="{`This content has been reported as "${displayList(reportReasons)}".`}}"
class="btn btn-error btn-xs tooltip-right flex items-center gap-1 rounded-full"
class:tooltip={!noTooltip && !isMobile}
on:click|preventDefault|stopPropagation={onReportClick}>
-7
View File
@@ -26,7 +26,6 @@ export const signWithAssert = async (template: StampedEvent) => {
}
export const getEditor = ({
aggressive = false,
autofocus = false,
charCount,
content = "",
@@ -36,7 +35,6 @@ export const getEditor = ({
uploading,
wordCount,
}: {
aggressive?: boolean
autofocus?: boolean
charCount?: Writable<number>
content?: string
@@ -62,11 +60,6 @@ export const getEditor = ({
placeholder,
},
},
breakOrSubmit: {
config: {
aggressive,
},
},
fileUpload: {
config: {
onDrop() {