fix: character count should includes spoiler text (#1535)

* fix: character count should includes spoiler text

* fix: draft empty conditions exclude spoiler text
This commit is contained in:
Alex Liu 2023-02-06 01:36:33 +08:00 committed by GitHub
parent 04c4ff5225
commit 2bd8dc2dd5
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 17 additions and 3 deletions

View file

@ -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({
<div v-if="draft.params.sensitive">
<input
v-model="draft.params.spoilerText"
v-model="publishSpoilerText"
type="text"
:placeholder="$t('placeholder.content_warning')"
p2 border-rounded w-full bg-transparent