Added parameter to disable TextArea (#2446)

Signed-off-by: Oleg Solodkov <oleg.solodkov@ezthera.com>
This commit is contained in:
sol-0 2022-12-16 11:11:20 +04:00 committed by GitHub
parent cbf83a55ff
commit 9bb045e53a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 11 additions and 6 deletions

View File

@ -26,6 +26,7 @@
export let placeholder: IntlString = plugin.string.EditBoxPlaceholder
export let placeholderParam: any | undefined = undefined
export let noFocusBorder: boolean = false
export let disabled: boolean = false
let input: HTMLTextAreaElement
let phTraslate: string = ''
@ -47,7 +48,7 @@
<div class="textarea" class:no-focus-border={noFocusBorder} style:width style:height>
{#if label}<div class="label"><Label {label} /></div>{/if}
<textarea bind:value bind:this={input} on:keydown={onKeydown} placeholder={phTraslate} />
<textarea bind:value bind:this={input} on:keydown={onKeydown} {disabled} placeholder={phTraslate} />
</div>
<style lang="scss">

View File

@ -13,6 +13,7 @@
export let height: string | undefined = undefined
export let submitLabel: IntlString = ui.string.Save
export let placeholder: IntlString | undefined = undefined
export let disabled: boolean = false
const dispatch = createEventDispatcher()
let isEditing = false
@ -57,16 +58,19 @@
{placeholder}
{height}
{width}
{disabled}
bind:this={inputRef}
bind:value
on:keydown={onKeydown}
noFocusBorder={true}
/>
</div>
<div class="flex-row-center mt-3">
<Button label={submitLabel} kind="no-border" size="medium" on:click={submit} />
<div class="ml-2" on:click={cancel}>
<ActionIcon icon={IconClose} size="medium" action={cancel} />
{#if !disabled}
<div class="flex-row-center mt-3">
<Button label={submitLabel} kind="no-border" size="medium" on:click={submit} />
<div class="ml-2" on:click={cancel}>
<ActionIcon icon={IconClose} size="medium" action={cancel} />
</div>
</div>
</div>
{/if}
</div>