From 2bd8dc2dd592a1ab747a2fe0ab2d5eb0ceee3acb Mon Sep 17 00:00:00 2001 From: Alex Liu <39984251+Mini-ghost@users.noreply.github.com> Date: Mon, 6 Feb 2023 01:36:33 +0800 Subject: [PATCH] fix: character count should includes spoiler text (#1535) * fix: character count should includes spoiler text * fix: draft empty conditions exclude spoiler text --- components/publish/PublishWidget.vue | 6 ++++-- composables/masto/publish.ts | 13 +++++++++++++ composables/masto/statusDrafts.ts | 1 - 3 files changed, 17 insertions(+), 3 deletions(-) diff --git a/components/publish/PublishWidget.vue b/components/publish/PublishWidget.vue index a20f4c81..e6b6ede7 100644 --- a/components/publish/PublishWidget.vue +++ b/components/publish/PublishWidget.vue @@ -35,7 +35,7 @@ const { dropZoneRef, } = $(useUploadMediaAttachment($$(draft))) -let { shouldExpanded, isExpanded, isSending, isPublishDisabled, publishDraft, failedMessages, preferredLanguage } = $(usePublish( +let { shouldExpanded, isExpanded, isSending, isPublishDisabled, publishDraft, failedMessages, preferredLanguage, publishSpoilerText } = $(usePublish( { draftState, ...$$({ expanded, isUploading, initialDraft: initial }), @@ -74,6 +74,8 @@ const characterCount = $computed(() => { }).join(' ').length + 1 } + length += stringLength(publishSpoilerText) + return length }) @@ -162,7 +164,7 @@ defineExpose({