feat: use new textarea
This commit is contained in:
1 parent
721fa81fd6
commit
1f9bb5418d
11 files changed
+31
-81
No files matched your search
+1
-1
@@ -42,7 +42,7 @@
|
|||||||
"@dicebear/initials": "^6.0.4",
|
"@dicebear/initials": "^6.0.4",
|
||||||
"lemmy-js-client": "^0.18.0-rc.2",
|
"lemmy-js-client": "^0.18.0-rc.2",
|
||||||
"markdown-it": "^13.0.1",
|
"markdown-it": "^13.0.1",
|
||||||
"mono-svelte": "^0.1.5"
|
"mono-svelte": "^0.1.6"
|
||||||
},
|
},
|
||||||
"type": "module"
|
"type": "module"
|
||||||
}
|
}
|
||||||
@@ -1,42 +0,0 @@
|
|||||||
<script lang="ts">
|
|
||||||
import { createEventDispatcher } from 'svelte'
|
|
||||||
|
|
||||||
export let label: string = ''
|
|
||||||
export let placeholder: string = ''
|
|
||||||
export let value: string = ''
|
|
||||||
export let maxlength: number = -1
|
|
||||||
export let rows: number = 3
|
|
||||||
export let required: boolean = false
|
|
||||||
export let item: any = undefined
|
|
||||||
|
|
||||||
let clazz = ''
|
|
||||||
export { clazz as class }
|
|
||||||
|
|
||||||
const dispatcher = createEventDispatcher()
|
|
||||||
</script>
|
|
||||||
|
|
||||||
<label class="flex flex-col items-center {clazz}">
|
|
||||||
{#if label != ''}
|
|
||||||
<span
|
|
||||||
class="font-bold text-sm text-left mb-1 cursor-pointer w-max self-start"
|
|
||||||
>
|
|
||||||
{label}
|
|
||||||
{#if required}
|
|
||||||
<span class="font-bold text-red-500">*</span>
|
|
||||||
{/if}
|
|
||||||
</span>
|
|
||||||
{/if}
|
|
||||||
<textarea
|
|
||||||
bind:value
|
|
||||||
bind:this={item}
|
|
||||||
on:input={(e) => dispatcher('input', e)}
|
|
||||||
on:keydown
|
|
||||||
{placeholder}
|
|
||||||
{maxlength}
|
|
||||||
{rows}
|
|
||||||
class="w-full px-3 text-sm py-2.5 bg-white dark:bg-black
|
|
||||||
border border-slate-300 dark:border-zinc-700 dark:focus:border-white
|
|
||||||
focus:outline-none focus:border-black transition-colors rounded-md {clazz}"
|
|
||||||
{...$$restProps}
|
|
||||||
/>
|
|
||||||
</label>
|
|
||||||
@@ -1,9 +1,7 @@
|
|||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import { Color } from '$lib/ui/colors.js'
|
|
||||||
import type { CommentResponse } from 'lemmy-js-client'
|
import type { CommentResponse } from 'lemmy-js-client'
|
||||||
import { getClient } from '$lib/lemmy.js'
|
import { getClient } from '$lib/lemmy.js'
|
||||||
import { createEventDispatcher } from 'svelte'
|
import { createEventDispatcher } from 'svelte'
|
||||||
import TextArea from '$lib/components/input/TextArea.svelte'
|
|
||||||
import MultiSelect from '$lib/components/input/MultiSelect.svelte'
|
import MultiSelect from '$lib/components/input/MultiSelect.svelte'
|
||||||
import Markdown from '$lib/components/markdown/Markdown.svelte'
|
import Markdown from '$lib/components/markdown/Markdown.svelte'
|
||||||
import { profile } from '$lib/auth.js'
|
import { profile } from '$lib/auth.js'
|
||||||
@@ -75,18 +73,10 @@
|
|||||||
bind:value
|
bind:value
|
||||||
disabled={locked || loading}
|
disabled={locked || loading}
|
||||||
on:confirm={submit}
|
on:confirm={submit}
|
||||||
/>
|
previewButton={previewAction}
|
||||||
{/if}
|
>
|
||||||
{#if actions || previewAction}
|
|
||||||
<div class="flex flex-row items-center justify-between">
|
|
||||||
{#if previewAction}
|
|
||||||
<MultiSelect
|
|
||||||
options={[false, true]}
|
|
||||||
optionNames={['Edit', 'Preview']}
|
|
||||||
bind:selected={preview}
|
|
||||||
/>
|
|
||||||
{/if}
|
|
||||||
{#if actions}
|
{#if actions}
|
||||||
|
<div class="ml-auto">
|
||||||
<Button
|
<Button
|
||||||
large
|
large
|
||||||
on:click={submit}
|
on:click={submit}
|
||||||
@@ -98,7 +88,8 @@
|
|||||||
>
|
>
|
||||||
Submit
|
Submit
|
||||||
</Button>
|
</Button>
|
||||||
{/if}
|
|
||||||
</div>
|
</div>
|
||||||
{/if}
|
{/if}
|
||||||
|
</MarkdownEditor>
|
||||||
|
{/if}
|
||||||
</div>
|
</div>
|
||||||
@@ -1,11 +1,11 @@
|
|||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import TextArea from '$lib/components/input/TextArea.svelte'
|
|
||||||
import Avatar from '$lib/components/ui/Avatar.svelte'
|
import Avatar from '$lib/components/ui/Avatar.svelte'
|
||||||
import type { Community, Person, PersonView } from 'lemmy-js-client'
|
import type { Community, Person, PersonView } from 'lemmy-js-client'
|
||||||
import { getClient } from '$lib/lemmy.js'
|
import { getClient } from '$lib/lemmy.js'
|
||||||
import { toast } from '$lib/components/ui/toasts/toasts.js'
|
import { toast } from '$lib/components/ui/toasts/toasts.js'
|
||||||
import { profile } from '$lib/auth.js'
|
import { profile } from '$lib/auth.js'
|
||||||
import { Button, Checkbox, Modal, TextInput } from 'mono-svelte'
|
import { Button, Checkbox, Modal, TextInput } from 'mono-svelte'
|
||||||
|
import MarkdownEditor from '$lib/components/markdown/MarkdownEditor.svelte'
|
||||||
|
|
||||||
export let open = false
|
export let open = false
|
||||||
let item: Person | undefined
|
let item: Person | undefined
|
||||||
@@ -114,7 +114,7 @@
|
|||||||
{banned ? 'Unbanning' : 'Banning'} from
|
{banned ? 'Unbanning' : 'Banning'} from
|
||||||
<span class="font-bold">{community ? community.name : 'site'}</span>
|
<span class="font-bold">{community ? community.name : 'site'}</span>
|
||||||
</p>
|
</p>
|
||||||
<TextArea
|
<MarkdownEditor
|
||||||
required
|
required
|
||||||
bind:value={reason}
|
bind:value={reason}
|
||||||
label="Reason"
|
label="Reason"
|
||||||
|
|||||||
@@ -1,5 +1,4 @@
|
|||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import TextArea from '$lib/components/input/TextArea.svelte'
|
|
||||||
import Comment from '$lib/components/lemmy/comment/Comment.svelte'
|
import Comment from '$lib/components/lemmy/comment/Comment.svelte'
|
||||||
import Post from '$lib/components/lemmy/post/Post.svelte'
|
import Post from '$lib/components/lemmy/post/Post.svelte'
|
||||||
import { toast } from '$lib/components/ui/toasts/toasts.js'
|
import { toast } from '$lib/components/ui/toasts/toasts.js'
|
||||||
@@ -193,7 +192,7 @@
|
|||||||
<Post actions={false} post={item} />
|
<Post actions={false} post={item} />
|
||||||
{/if}
|
{/if}
|
||||||
|
|
||||||
<TextArea
|
<MarkdownEditor
|
||||||
rows={3}
|
rows={3}
|
||||||
label="Reason"
|
label="Reason"
|
||||||
placeholder="Optional"
|
placeholder="Optional"
|
||||||
|
|||||||
@@ -1,5 +1,4 @@
|
|||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import TextArea from '$lib/components/input/TextArea.svelte'
|
|
||||||
import Comment from '$lib/components/lemmy/comment/Comment.svelte'
|
import Comment from '$lib/components/lemmy/comment/Comment.svelte'
|
||||||
import Post from '$lib/components/lemmy/post/Post.svelte'
|
import Post from '$lib/components/lemmy/post/Post.svelte'
|
||||||
import { toast } from '$lib/components/ui/toasts/toasts.js'
|
import { toast } from '$lib/components/ui/toasts/toasts.js'
|
||||||
@@ -7,6 +6,7 @@
|
|||||||
import type { CommentView, PostView } from 'lemmy-js-client'
|
import type { CommentView, PostView } from 'lemmy-js-client'
|
||||||
import { profile } from '$lib/auth.js'
|
import { profile } from '$lib/auth.js'
|
||||||
import { Button, Modal } from 'mono-svelte'
|
import { Button, Modal } from 'mono-svelte'
|
||||||
|
import MarkdownEditor from '$lib/components/markdown/MarkdownEditor.svelte'
|
||||||
|
|
||||||
export let open: boolean
|
export let open: boolean
|
||||||
export let item: PostView | CommentView | undefined = undefined
|
export let item: PostView | CommentView | undefined = undefined
|
||||||
@@ -81,9 +81,9 @@
|
|||||||
{/if}
|
{/if}
|
||||||
</div>
|
</div>
|
||||||
{/if}
|
{/if}
|
||||||
<TextArea
|
<MarkdownEditor
|
||||||
required
|
required
|
||||||
rows={3}
|
rows={4}
|
||||||
label="Reason"
|
label="Reason"
|
||||||
placeholder="he's being a meanie :("
|
placeholder="he's being a meanie :("
|
||||||
bind:value={reason}
|
bind:value={reason}
|
||||||
|
|||||||
@@ -2,11 +2,10 @@
|
|||||||
import { profile } from '$lib/auth.js'
|
import { profile } from '$lib/auth.js'
|
||||||
import FileInput from '$lib/components/input/FileInput.svelte'
|
import FileInput from '$lib/components/input/FileInput.svelte'
|
||||||
import MultiSelect from '$lib/components/input/MultiSelect.svelte'
|
import MultiSelect from '$lib/components/input/MultiSelect.svelte'
|
||||||
import TextArea from '$lib/components/input/TextArea.svelte'
|
|
||||||
import Markdown from '$lib/components/markdown/Markdown.svelte'
|
import Markdown from '$lib/components/markdown/Markdown.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 { Button, Modal } from 'mono-svelte'
|
import { Button, Modal, TextArea } from 'mono-svelte'
|
||||||
import { createEventDispatcher } from 'svelte'
|
import { createEventDispatcher } from 'svelte'
|
||||||
import {
|
import {
|
||||||
CodeBracket,
|
CodeBracket,
|
||||||
@@ -226,7 +225,7 @@ overflow-hidden focus-within:border-black focus-within:dark:border-white transit
|
|||||||
</div>
|
</div>
|
||||||
<!--Actual text area-->
|
<!--Actual text area-->
|
||||||
<TextArea
|
<TextArea
|
||||||
class="bg-inherit border-0 rounded-none"
|
class="bg-inherit border-0 rounded-none !ring-0 focus:!ring-transparent !transition-none"
|
||||||
bind:value
|
bind:value
|
||||||
bind:item={textArea}
|
bind:item={textArea}
|
||||||
on:keydown={(e) => {
|
on:keydown={(e) => {
|
||||||
@@ -244,14 +243,18 @@ overflow-hidden focus-within:border-black focus-within:dark:border-white transit
|
|||||||
{...$$restProps}
|
{...$$restProps}
|
||||||
/>
|
/>
|
||||||
{/if}
|
{/if}
|
||||||
</div>
|
|
||||||
|
{#if $$slots.default || previewButton}
|
||||||
|
<div class="p-2 flex items-center w-full">
|
||||||
{#if previewButton}
|
{#if previewButton}
|
||||||
<div class="mt-2">
|
|
||||||
<MultiSelect
|
<MultiSelect
|
||||||
bind:selected={previewing}
|
bind:selected={previewing}
|
||||||
options={[false, true]}
|
options={[false, true]}
|
||||||
optionNames={['Edit', 'Preview']}
|
optionNames={['Edit', 'Preview']}
|
||||||
/>
|
/>
|
||||||
|
{/if}
|
||||||
|
<slot />
|
||||||
</div>
|
</div>
|
||||||
{/if}
|
{/if}
|
||||||
</div>
|
</div>
|
||||||
|
</div>
|
||||||
@@ -1,6 +1,5 @@
|
|||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import { goto } from '$app/navigation'
|
import { goto } from '$app/navigation'
|
||||||
import TextArea from '$lib/components/input/TextArea.svelte'
|
|
||||||
import Comment from '$lib/components/lemmy/comment/Comment.svelte'
|
import Comment from '$lib/components/lemmy/comment/Comment.svelte'
|
||||||
import Markdown from '$lib/components/markdown/Markdown.svelte'
|
import Markdown from '$lib/components/markdown/Markdown.svelte'
|
||||||
import Card from '$lib/components/ui/Card.svelte'
|
import Card from '$lib/components/ui/Card.svelte'
|
||||||
@@ -18,6 +17,7 @@
|
|||||||
import PostMeta from '$lib/components/lemmy/post/PostMeta.svelte'
|
import PostMeta from '$lib/components/lemmy/post/PostMeta.svelte'
|
||||||
import SectionTitle from '$lib/components/ui/SectionTitle.svelte'
|
import SectionTitle from '$lib/components/ui/SectionTitle.svelte'
|
||||||
import { Button } from 'mono-svelte'
|
import { Button } from 'mono-svelte'
|
||||||
|
import MarkdownEditor from '$lib/components/markdown/MarkdownEditor.svelte'
|
||||||
|
|
||||||
export let item: CommentReplyView | PersonMentionView | PrivateMessageView
|
export let item: CommentReplyView | PersonMentionView | PrivateMessageView
|
||||||
export let read: boolean
|
export let read: boolean
|
||||||
@@ -176,7 +176,7 @@
|
|||||||
{#if isPrivateMessage(item)}
|
{#if isPrivateMessage(item)}
|
||||||
{#if replying}
|
{#if replying}
|
||||||
<div class="mt-2 flex flex-col gap-2">
|
<div class="mt-2 flex flex-col gap-2">
|
||||||
<TextArea placeholder="Message" bind:value={reply} rows={3} />
|
<MarkdownEditor placeholder="Message" bind:value={reply} rows={4} />
|
||||||
<div class="ml-auto w-24">
|
<div class="ml-auto w-24">
|
||||||
<Button
|
<Button
|
||||||
disabled={loading}
|
disabled={loading}
|
||||||
|
|||||||
@@ -2,8 +2,8 @@
|
|||||||
import { goto } from '$app/navigation'
|
import { goto } from '$app/navigation'
|
||||||
import { page } from '$app/stores'
|
import { page } from '$app/stores'
|
||||||
import { setUser } from '$lib/auth.js'
|
import { setUser } from '$lib/auth.js'
|
||||||
import TextArea from '$lib/components/input/TextArea.svelte'
|
|
||||||
import Markdown from '$lib/components/markdown/Markdown.svelte'
|
import Markdown from '$lib/components/markdown/Markdown.svelte'
|
||||||
|
import MarkdownEditor from '$lib/components/markdown/MarkdownEditor.svelte'
|
||||||
import Avatar from '$lib/components/ui/Avatar.svelte'
|
import Avatar from '$lib/components/ui/Avatar.svelte'
|
||||||
import Card from '$lib/components/ui/Card.svelte'
|
import Card from '$lib/components/ui/Card.svelte'
|
||||||
import Placeholder from '$lib/components/ui/Placeholder.svelte'
|
import Placeholder from '$lib/components/ui/Placeholder.svelte'
|
||||||
@@ -11,7 +11,7 @@
|
|||||||
import { toast } from '$lib/components/ui/toasts/toasts.js'
|
import { toast } from '$lib/components/ui/toasts/toasts.js'
|
||||||
import { getClient } from '$lib/lemmy.js'
|
import { getClient } from '$lib/lemmy.js'
|
||||||
import type { GetCaptchaResponse } from 'lemmy-js-client'
|
import type { GetCaptchaResponse } from 'lemmy-js-client'
|
||||||
import { Button, TextInput } from 'mono-svelte'
|
import { Button, TextArea, TextInput } from 'mono-svelte'
|
||||||
import {
|
import {
|
||||||
ArrowPath,
|
ArrowPath,
|
||||||
ExclamationCircle,
|
ExclamationCircle,
|
||||||
@@ -143,7 +143,7 @@
|
|||||||
{#if data.site_view.local_site.application_question}
|
{#if data.site_view.local_site.application_question}
|
||||||
<Markdown source={data.site_view.local_site.application_question} />
|
<Markdown source={data.site_view.local_site.application_question} />
|
||||||
{/if}
|
{/if}
|
||||||
<TextArea
|
<MarkdownEditor
|
||||||
label="Application"
|
label="Application"
|
||||||
required
|
required
|
||||||
placeholder="i like this instance's icon "
|
placeholder="i like this instance's icon "
|
||||||
|
|||||||
@@ -24,10 +24,8 @@
|
|||||||
import { isCommentView } from '$lib/lemmy/item.js'
|
import { isCommentView } from '$lib/lemmy/item.js'
|
||||||
import { getClient } from '$lib/lemmy.js'
|
import { getClient } from '$lib/lemmy.js'
|
||||||
import { isBlocked } from '$lib/lemmy/user.js'
|
import { isBlocked } from '$lib/lemmy/user.js'
|
||||||
import MultiSelect from '$lib/components/input/MultiSelect.svelte'
|
|
||||||
import { toast } from '$lib/components/ui/toasts/toasts.js'
|
import { toast } from '$lib/components/ui/toasts/toasts.js'
|
||||||
import UserLink from '$lib/components/lemmy/user/UserLink.svelte'
|
import UserLink from '$lib/components/lemmy/user/UserLink.svelte'
|
||||||
import TextArea from '$lib/components/input/TextArea.svelte'
|
|
||||||
import { profile } from '$lib/auth.js'
|
import { profile } from '$lib/auth.js'
|
||||||
import { ban, isAdmin } from '$lib/components/lemmy/moderation/moderation.js'
|
import { ban, isAdmin } from '$lib/components/lemmy/moderation/moderation.js'
|
||||||
import Menu from '$lib/components/ui/menu/Menu.svelte'
|
import Menu from '$lib/components/ui/menu/Menu.svelte'
|
||||||
@@ -36,6 +34,7 @@
|
|||||||
import { searchParam } from '$lib/util.js'
|
import { searchParam } from '$lib/util.js'
|
||||||
import Placeholder from '$lib/components/ui/Placeholder.svelte'
|
import Placeholder from '$lib/components/ui/Placeholder.svelte'
|
||||||
import { Button, Modal, Select } from 'mono-svelte'
|
import { Button, Modal, Select } from 'mono-svelte'
|
||||||
|
import MarkdownEditor from '$lib/components/markdown/MarkdownEditor.svelte'
|
||||||
|
|
||||||
export let data
|
export let data
|
||||||
|
|
||||||
@@ -122,7 +121,7 @@
|
|||||||
<p class="inline-flex flex-row gap-2 items-center">
|
<p class="inline-flex flex-row gap-2 items-center">
|
||||||
Sending <UserLink avatar user={data.person_view.person} /> a message
|
Sending <UserLink avatar user={data.person_view.person} /> a message
|
||||||
</p>
|
</p>
|
||||||
<TextArea
|
<MarkdownEditor
|
||||||
bind:value={message}
|
bind:value={message}
|
||||||
label="Message"
|
label="Message"
|
||||||
placeholder="your hair looks nice today"
|
placeholder="your hair looks nice today"
|
||||||
|
|||||||
@@ -2977,10 +2977,10 @@ mlly@^1.2.0, mlly@^1.4.0:
|
|||||||
pkg-types "^1.0.3"
|
pkg-types "^1.0.3"
|
||||||
ufo "^1.1.2"
|
ufo "^1.1.2"
|
||||||
|
|
||||||
mono-svelte@^0.1.5:
|
mono-svelte@^0.1.6:
|
||||||
version "0.1.5"
|
version "0.1.6"
|
||||||
resolved "https://registry.yarnpkg.com/mono-svelte/-/mono-svelte-0.1.5.tgz#0306598c171d32b8acebc2350a363ab15e3b7613"
|
resolved "https://registry.yarnpkg.com/mono-svelte/-/mono-svelte-0.1.6.tgz#2b2bdfea6a52813592658992d0676f9b7a6135e0"
|
||||||
integrity sha512-4Hz9wEPOrlfvJ157YE7agKgJiyh2XHVRmObLD1r27IcRBUmTB/ANdrUBwtyZS9CsSX4RNY1Zpxm2z/g2gsJMgw==
|
integrity sha512-HcsNhWwdXdCdpEmCa2RsAwJsROGZZy3XRymiLJH+Bglk0bcW+kTO9yRxDCVWqrWu9ac7GRKYvtY54kvLNpdJ6g==
|
||||||
|
|
||||||
mri@^1.1.0:
|
mri@^1.1.0:
|
||||||
version "1.2.0"
|
version "1.2.0"
|
||||||
|
|||||||
Reference in new issue
Block a user