From ab07165475c1fcdebc071c09e7787dc878eab2c6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E4=B8=89=E5=92=B2=E6=99=BA=E5=AD=90?= Date: Tue, 29 Nov 2022 19:57:05 +0800 Subject: [PATCH] fix(publish): expand state --- components/publish/PublishWidget.vue | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/components/publish/PublishWidget.vue b/components/publish/PublishWidget.vue index 6e2aee9e..dbd13363 100644 --- a/components/publish/PublishWidget.vue +++ b/components/publish/PublishWidget.vue @@ -22,7 +22,8 @@ const { let { draft, isEmpty } = $(useDraft(draftKey, initial)) let isSending = $ref(false) -let isExpanded = $ref(!isEmpty || _expanded) +let isExpanded = $ref(false) +const shouldExpanded = $computed(() => _expanded || isExpanded || !isEmpty) const { editor } = useTiptap({ content: computed({ @@ -30,7 +31,7 @@ const { editor } = useTiptap({ set: newVal => draft.params.status = newVal, }), placeholder: draft.placeholder, - autofocus: isExpanded, + autofocus: shouldExpanded, onSubmit: publish, onFocus() { isExpanded = true }, onPaste: handlePaste, @@ -177,9 +178,9 @@ const { isOverDropZone } = useDropZone(dropZoneRef, onDrop) -
+
{{ characterLimit - editor?.storage.characterCount.characters() }}
@@ -198,7 +199,7 @@ const { isOverDropZone } = useDropZone(dropZoneRef, onDrop)