do the save to drafts/save to drafts and close
This commit is contained in:
parent
ad8579af99
commit
c0875ee34e
5 changed files with 21 additions and 6 deletions
|
@ -102,6 +102,7 @@ const PostStatusForm = {
|
||||||
'disablePreview',
|
'disablePreview',
|
||||||
'disableDraft',
|
'disableDraft',
|
||||||
'hideDraft',
|
'hideDraft',
|
||||||
|
'closeable',
|
||||||
'placeholder',
|
'placeholder',
|
||||||
'maxHeight',
|
'maxHeight',
|
||||||
'postHandler',
|
'postHandler',
|
||||||
|
@ -234,6 +235,9 @@ const PostStatusForm = {
|
||||||
showAllScopes () {
|
showAllScopes () {
|
||||||
return !this.mergedConfig.minimalScopesMode
|
return !this.mergedConfig.minimalScopesMode
|
||||||
},
|
},
|
||||||
|
hideExtraActions () {
|
||||||
|
return this.disableDraft || this.hideDraft
|
||||||
|
},
|
||||||
emojiUserSuggestor () {
|
emojiUserSuggestor () {
|
||||||
return suggestor({
|
return suggestor({
|
||||||
emoji: [
|
emoji: [
|
||||||
|
@ -355,10 +359,12 @@ const PostStatusForm = {
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
safeToSaveDraft () {
|
safeToSaveDraft () {
|
||||||
return this.newStatus.status ||
|
return (
|
||||||
|
this.newStatus.status ||
|
||||||
this.newStatus.spoilerText ||
|
this.newStatus.spoilerText ||
|
||||||
this.newStatus.files?.length ||
|
this.newStatus.files?.length ||
|
||||||
this.newStatus.hasPoll
|
this.newStatus.hasPoll
|
||||||
|
) && this.saveable
|
||||||
},
|
},
|
||||||
...mapGetters(['mergedConfig']),
|
...mapGetters(['mergedConfig']),
|
||||||
...mapState({
|
...mapState({
|
||||||
|
@ -762,6 +768,7 @@ const PostStatusForm = {
|
||||||
this.newStatus.id = id
|
this.newStatus.id = id
|
||||||
}
|
}
|
||||||
this.saveable = false
|
this.saveable = false
|
||||||
|
this.clearStatus()
|
||||||
this.$emit('draft-done')
|
this.$emit('draft-done')
|
||||||
})
|
})
|
||||||
} else if (this.newStatus.id) {
|
} else if (this.newStatus.id) {
|
||||||
|
@ -769,6 +776,7 @@ const PostStatusForm = {
|
||||||
return this.abandonDraft()
|
return this.abandonDraft()
|
||||||
.then(() => {
|
.then(() => {
|
||||||
this.saveable = false
|
this.saveable = false
|
||||||
|
this.clearStatus()
|
||||||
this.$emit('draft-done')
|
this.$emit('draft-done')
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
|
@ -316,13 +316,12 @@
|
||||||
</template>
|
</template>
|
||||||
</button>
|
</button>
|
||||||
<Popover
|
<Popover
|
||||||
v-if="!hideDraft"
|
v-if="!hideExtraActions"
|
||||||
class="more-post-actions"
|
class="more-post-actions"
|
||||||
:normal-button="true"
|
:normal-button="true"
|
||||||
trigger="click"
|
trigger="click"
|
||||||
placement="bottom"
|
placement="bottom"
|
||||||
:offset="{ y: 5 }"
|
:offset="{ y: 5 }"
|
||||||
:bound-to="{ x: 'container' }"
|
|
||||||
>
|
>
|
||||||
<template #trigger>
|
<template #trigger>
|
||||||
<FAIcon
|
<FAIcon
|
||||||
|
@ -336,7 +335,7 @@
|
||||||
role="menu"
|
role="menu"
|
||||||
>
|
>
|
||||||
<button
|
<button
|
||||||
v-if="!hideDraft"
|
v-if="!hideDraft || !disableDraft"
|
||||||
class="menu-item dropdown-item dropdown-item-icon"
|
class="menu-item dropdown-item dropdown-item-icon"
|
||||||
role="menu"
|
role="menu"
|
||||||
:disabled="!safeToSaveDraft && saveable"
|
:disabled="!safeToSaveDraft && saveable"
|
||||||
|
@ -344,7 +343,12 @@
|
||||||
@click.prevent="saveDraft"
|
@click.prevent="saveDraft"
|
||||||
@click="close"
|
@click="close"
|
||||||
>
|
>
|
||||||
{{ $t('post_status.save_to_drafts_button') }}
|
<template v-if="closeable">
|
||||||
|
{{ $t('post_status.save_to_drafts_and_close_button') }}
|
||||||
|
</template>
|
||||||
|
<template v-else>
|
||||||
|
{{ $t('post_status.save_to_drafts_button') }}
|
||||||
|
</template>
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
|
@ -14,6 +14,7 @@
|
||||||
<PostStatusForm
|
<PostStatusForm
|
||||||
class="panel-body"
|
class="panel-body"
|
||||||
v-bind="params"
|
v-bind="params"
|
||||||
|
:closeable="true"
|
||||||
@posted="resetAndClose"
|
@posted="resetAndClose"
|
||||||
@draft-done="resetAndClose"
|
@draft-done="resetAndClose"
|
||||||
/>
|
/>
|
||||||
|
|
|
@ -598,6 +598,7 @@
|
||||||
<PostStatusForm
|
<PostStatusForm
|
||||||
ref="postStatusForm"
|
ref="postStatusForm"
|
||||||
class="reply-body"
|
class="reply-body"
|
||||||
|
:closeable="true"
|
||||||
:reply-to="status.id"
|
:reply-to="status.id"
|
||||||
:attentions="status.attentions"
|
:attentions="status.attentions"
|
||||||
:replied-user="status.user"
|
:replied-user="status.user"
|
||||||
|
|
|
@ -321,7 +321,8 @@
|
||||||
"auto_save_nothing_new": "Nothing new to save.",
|
"auto_save_nothing_new": "Nothing new to save.",
|
||||||
"auto_save_saved": "Saved.",
|
"auto_save_saved": "Saved.",
|
||||||
"auto_save_saving": "Saving...",
|
"auto_save_saving": "Saving...",
|
||||||
"save_to_drafts_button": "Save to drafts"
|
"save_to_drafts_button": "Save to drafts",
|
||||||
|
"save_to_drafts_and_close_button": "Save to drafts and close"
|
||||||
},
|
},
|
||||||
"registration": {
|
"registration": {
|
||||||
"bio_optional": "Bio (optional)",
|
"bio_optional": "Bio (optional)",
|
||||||
|
|
Loading…
Add table
Reference in a new issue