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:
parent
04c4ff5225
commit
2bd8dc2dd5
3 changed files with 17 additions and 3 deletions
|
@ -21,6 +21,17 @@ export function usePublish(options: {
|
|||
const isExpanded = $ref(false)
|
||||
const failedMessages = $ref<string[]>([])
|
||||
|
||||
const publishSpoilerText = $computed({
|
||||
get() {
|
||||
return draft.params.sensitive ? draft.params.spoilerText : ''
|
||||
},
|
||||
set(val) {
|
||||
if (!draft.params.sensitive)
|
||||
return
|
||||
draft.params.spoilerText = val
|
||||
},
|
||||
})
|
||||
|
||||
const shouldExpanded = $computed(() => expanded || isExpanded || !isEmpty)
|
||||
const isPublishDisabled = $computed(() => {
|
||||
return isEmpty || isUploading || isSending || (draft.attachments.length === 0 && !draft.params.status) || failedMessages.length > 0
|
||||
|
@ -41,6 +52,7 @@ export function usePublish(options: {
|
|||
|
||||
const payload = {
|
||||
...draft.params,
|
||||
spoilerText: publishSpoilerText,
|
||||
status: content,
|
||||
mediaIds: draft.attachments.map(a => a.id),
|
||||
language: draft.params.language || preferredLanguage,
|
||||
|
@ -91,6 +103,7 @@ export function usePublish(options: {
|
|||
isPublishDisabled,
|
||||
failedMessages,
|
||||
preferredLanguage,
|
||||
publishSpoilerText,
|
||||
publishDraft,
|
||||
})
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue