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

8
package-lock.json generated
View File

@@ -33,7 +33,7 @@
"@welshman/app": "~0.0.37",
"@welshman/content": "~0.0.15",
"@welshman/dvm": "~0.0.13",
"@welshman/editor": "~0.0.5",
"@welshman/editor": "~0.0.6",
"@welshman/feeds": "~0.0.30",
"@welshman/lib": "~0.0.37",
"@welshman/net": "~0.0.45",
@@ -4902,9 +4902,9 @@
}
},
"node_modules/@welshman/editor": {
"version": "0.0.5",
"resolved": "https://registry.npmjs.org/@welshman/editor/-/editor-0.0.5.tgz",
"integrity": "sha512-4WOFoPT6LgX2bjM8RR+6YrfOm7Lk2BLlJ46aMYHFRyDcD737Rx5dtsct0ZlyQ8TzPR85TyYHrv6g98/J0cZKDQ==",
"version": "0.0.6",
"resolved": "https://registry.npmjs.org/@welshman/editor/-/editor-0.0.6.tgz",
"integrity": "sha512-7ZnjrsBX/5Z2OiHStCSBqNlspX/weURcP8yrH9CTcOEqJZfPx5UWfeYmzsbXttvCPBph+Cv9jfHkeVreyLkeKQ==",
"peerDependencies": {
"@tiptap/core": "^2.9.1",
"@tiptap/extension-code": "^2.9.1",

View File

@@ -62,7 +62,7 @@
"@welshman/app": "~0.0.37",
"@welshman/content": "~0.0.15",
"@welshman/dvm": "~0.0.13",
"@welshman/editor": "~0.0.5",
"@welshman/editor": "~0.0.6",
"@welshman/feeds": "~0.0.30",
"@welshman/lib": "~0.0.37",
"@welshman/net": "~0.0.45",

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>

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">

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}>

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() {