logo

pleroma-fe

My custom branche(s) on git.pleroma.social/pleroma/pleroma-fe git clone https://anongit.hacktivis.me/git/pleroma-fe.git/
commit: c0875ee34e2ab70d6fc12ddb3559e4181353d6ea
parent ad8579af9982eb364dae7ded00c0ef36d45d4ec2
Author: Henry Jameson <me@hjkos.com>
Date:   Wed,  8 Jan 2025 21:02:52 +0200

do the save to drafts/save to drafts and close

Diffstat:

Msrc/components/post_status_form/post_status_form.js10+++++++++-
Msrc/components/post_status_form/post_status_form.vue12++++++++----
Msrc/components/post_status_modal/post_status_modal.vue1+
Msrc/components/status/status.vue1+
Msrc/i18n/en.json3++-
5 files changed, 21 insertions(+), 6 deletions(-)

diff --git a/src/components/post_status_form/post_status_form.js b/src/components/post_status_form/post_status_form.js @@ -102,6 +102,7 @@ const PostStatusForm = { 'disablePreview', 'disableDraft', 'hideDraft', + 'closeable', 'placeholder', 'maxHeight', 'postHandler', @@ -234,6 +235,9 @@ const PostStatusForm = { showAllScopes () { return !this.mergedConfig.minimalScopesMode }, + hideExtraActions () { + return this.disableDraft || this.hideDraft + }, emojiUserSuggestor () { return suggestor({ emoji: [ @@ -355,10 +359,12 @@ const PostStatusForm = { } }, safeToSaveDraft () { - return this.newStatus.status || + return ( + this.newStatus.status || this.newStatus.spoilerText || this.newStatus.files?.length || this.newStatus.hasPoll + ) && this.saveable }, ...mapGetters(['mergedConfig']), ...mapState({ @@ -762,6 +768,7 @@ const PostStatusForm = { this.newStatus.id = id } this.saveable = false + this.clearStatus() this.$emit('draft-done') }) } else if (this.newStatus.id) { @@ -769,6 +776,7 @@ const PostStatusForm = { return this.abandonDraft() .then(() => { this.saveable = false + this.clearStatus() this.$emit('draft-done') }) } diff --git a/src/components/post_status_form/post_status_form.vue b/src/components/post_status_form/post_status_form.vue @@ -316,13 +316,12 @@ </template> </button> <Popover - v-if="!hideDraft" + v-if="!hideExtraActions" class="more-post-actions" :normal-button="true" trigger="click" placement="bottom" :offset="{ y: 5 }" - :bound-to="{ x: 'container' }" > <template #trigger> <FAIcon @@ -336,7 +335,7 @@ role="menu" > <button - v-if="!hideDraft" + v-if="!hideDraft || !disableDraft" class="menu-item dropdown-item dropdown-item-icon" role="menu" :disabled="!safeToSaveDraft && saveable" @@ -344,7 +343,12 @@ @click.prevent="saveDraft" @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> </div> </template> diff --git a/src/components/post_status_modal/post_status_modal.vue b/src/components/post_status_modal/post_status_modal.vue @@ -14,6 +14,7 @@ <PostStatusForm class="panel-body" v-bind="params" + :closeable="true" @posted="resetAndClose" @draft-done="resetAndClose" /> diff --git a/src/components/status/status.vue b/src/components/status/status.vue @@ -598,6 +598,7 @@ <PostStatusForm ref="postStatusForm" class="reply-body" + :closeable="true" :reply-to="status.id" :attentions="status.attentions" :replied-user="status.user" diff --git a/src/i18n/en.json b/src/i18n/en.json @@ -321,7 +321,8 @@ "auto_save_nothing_new": "Nothing new to save.", "auto_save_saved": "Saved.", "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": { "bio_optional": "Bio (optional)",