From 130a19daa927fec3577ace3a30307eb60b7c17b2 Mon Sep 17 00:00:00 2001 From: Alexander Platov Date: Mon, 12 Dec 2022 07:39:03 +0300 Subject: [PATCH] Add AccordionEditor (#2431) --- .../src/components/StyledTextArea.svelte | 6 + .../src/components/StyledTextBox.svelte | 14 ++- .../src/components/StyledTextEditor.svelte | 19 ++- .../src/components/TextEditor.svelte | 14 ++- packages/theme/styles/common.scss | 110 ++++++++++++++++++ packages/theme/styles/global.scss | 1 + packages/ui/src/components/Button.svelte | 10 +- .../src/components/icons/DownOutline.svelte | 2 +- .../src/components/AccordionEditor.svelte | 109 +++++++++++++++++ .../src/components/AttachmentStyledBox.svelte | 14 +++ plugins/attachment-resources/src/index.ts | 15 ++- .../src/components/SpecialView.svelte | 10 +- 12 files changed, 303 insertions(+), 21 deletions(-) create mode 100644 plugins/attachment-resources/src/components/AccordionEditor.svelte diff --git a/packages/text-editor/src/components/StyledTextArea.svelte b/packages/text-editor/src/components/StyledTextArea.svelte index 832841542a..d28ca7ef23 100644 --- a/packages/text-editor/src/components/StyledTextArea.svelte +++ b/packages/text-editor/src/components/StyledTextArea.svelte @@ -29,6 +29,12 @@ export function submit (): void { textEditor.submit() } + export function isEditable (): boolean { + return textEditor.isEditable() + } + export function setEditable (editable: boolean): void { + textEditor.setEditable(editable) + } const dispatch = createEventDispatcher() let focused = false diff --git a/packages/text-editor/src/components/StyledTextBox.svelte b/packages/text-editor/src/components/StyledTextBox.svelte index 238bc6f0ea..22a8652490 100644 --- a/packages/text-editor/src/components/StyledTextBox.svelte +++ b/packages/text-editor/src/components/StyledTextBox.svelte @@ -69,6 +69,18 @@ export function submit (): void { textEditor.submit() } + export function focus (): void { + textEditor.focus() + } + export function isEditable (): boolean { + return textEditor.isEditable() + } + export function setEditable (editable: boolean): void { + textEditor.setEditable(editable) + } + export function setContent (data: string): void { + textEditor.setContent(data) + } const dispatch = createEventDispatcher() let focused = false @@ -124,7 +136,7 @@ if (alwaysEdit) { content = evt.detail } - dispatch('changeContent') + dispatch('changeContent', evt.detail) }} > {#if !alwaysEdit && !hideExtraButtons} diff --git a/packages/text-editor/src/components/StyledTextEditor.svelte b/packages/text-editor/src/components/StyledTextEditor.svelte index b1070b94c7..d7b50a11df 100644 --- a/packages/text-editor/src/components/StyledTextEditor.svelte +++ b/packages/text-editor/src/components/StyledTextEditor.svelte @@ -76,6 +76,18 @@ export function focus (): void { textEditor.focus() } + export function isEditable (): boolean { + return textEditor.isEditable() + } + export function setEditable (editable: boolean): void { + textEditor.setEditable(editable) + } + export function getContent (): string { + return content + } + export function setContent (data: string): void { + textEditor.setContent(data) + } $: varsStyle = maxHeight === 'card' @@ -344,7 +356,8 @@ } -
+ +
(needFocus = true)}> {#if isFormatting}
{ if (focus && input) { @@ -114,9 +114,8 @@