feat: add and close #94
This commit is contained in:
1 parent
b1356ffb66
commit
a5c41a9c90
2 files changed
+8
-1
No files matched your search
@@ -73,7 +73,8 @@
|
|||||||
? 'This post is locked.'
|
? 'This post is locked.'
|
||||||
: placeholders.get('comment')}
|
: placeholders.get('comment')}
|
||||||
bind:value
|
bind:value
|
||||||
disabled={locked}
|
disabled={locked || loading}
|
||||||
|
on:confirm={submit}
|
||||||
/>
|
/>
|
||||||
{/if}
|
{/if}
|
||||||
{#if actions || previewAction}
|
{#if actions || previewAction}
|
||||||
|
|||||||
@@ -8,6 +8,7 @@
|
|||||||
import Modal from '$lib/components/ui/modal/Modal.svelte'
|
import Modal from '$lib/components/ui/modal/Modal.svelte'
|
||||||
import { toast } from '$lib/components/ui/toasts/toasts.js'
|
import { toast } from '$lib/components/ui/toasts/toasts.js'
|
||||||
import { uploadImage } from '$lib/lemmy.js'
|
import { uploadImage } from '$lib/lemmy.js'
|
||||||
|
import { createEventDispatcher } from 'svelte'
|
||||||
import {
|
import {
|
||||||
CodeBracket,
|
CodeBracket,
|
||||||
ExclamationTriangle,
|
ExclamationTriangle,
|
||||||
@@ -21,6 +22,9 @@
|
|||||||
export let value: string = ''
|
export let value: string = ''
|
||||||
export let label: string | undefined = undefined
|
export let label: string | undefined = undefined
|
||||||
export let previewButton: boolean = false
|
export let previewButton: boolean = false
|
||||||
|
export let disabled: boolean = false
|
||||||
|
|
||||||
|
const dispatcher = createEventDispatcher<{ confirm: string }>()
|
||||||
|
|
||||||
let textArea: HTMLTextAreaElement
|
let textArea: HTMLTextAreaElement
|
||||||
|
|
||||||
@@ -89,6 +93,7 @@
|
|||||||
KeyS: () => wrapSelection('~~', '~~'),
|
KeyS: () => wrapSelection('~~', '~~'),
|
||||||
KeyH: () => wrapSelection('\n# ', ''),
|
KeyH: () => wrapSelection('\n# ', ''),
|
||||||
KeyK: () => wrapSelection('[](', ')'),
|
KeyK: () => wrapSelection('[](', ')'),
|
||||||
|
Enter: () => dispatcher('confirm', value),
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
@@ -223,6 +228,7 @@ overflow-hidden focus-within:border-black focus-within:dark:border-white transit
|
|||||||
bind:value
|
bind:value
|
||||||
bind:item={textArea}
|
bind:item={textArea}
|
||||||
on:keydown={(e) => {
|
on:keydown={(e) => {
|
||||||
|
if (disabled) return
|
||||||
if (e.ctrlKey) {
|
if (e.ctrlKey) {
|
||||||
// @ts-ignore
|
// @ts-ignore
|
||||||
let shortcut = shortcuts[e.code]
|
let shortcut = shortcuts[e.code]
|
||||||
|
|||||||
Reference in new issue
Block a user