post_status_form: reset all to defaults on clear

This commit is contained in:
novenary 2024-09-17 10:59:08 +03:00
parent 7b8429aa24
commit 65dbac098e
2 changed files with 11 additions and 4 deletions

View file

@ -341,17 +341,23 @@ const PostStatusForm = {
this.saveDraft() this.saveDraft()
}, },
clearStatus () { clearStatus () {
const newStatus = this.newStatus const config = this.$store.getters.mergedConfig
const postLanguage = config.postLanguage || interfaceToISOLanguage(config.interfaceLanguage)
this.newStatus = { this.newStatus = {
status: '', status: '',
spoilerText: '', spoilerText: '',
files: [], files: [],
visibility: newStatus.visibility, nsfw: !!config.sensitiveByDefault,
contentType: newStatus.contentType, visibility: this.suggestedVisibility(),
language: newStatus.language, contentType: config.postContentType,
language: postLanguage,
poll: {}, poll: {},
mediaDescriptions: {} mediaDescriptions: {}
} }
const scopeselector = this.$refs.scopeselector
if (scopeselector) {
scopeselector.currentScope = this.newStatus.visibility
}
this.pollFormVisible = false this.pollFormVisible = false
this.$refs.mediaUpload && this.$refs.mediaUpload.clearFile() this.$refs.mediaUpload && this.$refs.mediaUpload.clearFile()
this.clearPollForm() this.clearPollForm()

View file

@ -195,6 +195,7 @@
:class="{ 'visibility-tray-edit': isEdit }" :class="{ 'visibility-tray-edit': isEdit }"
> >
<scope-selector <scope-selector
ref="scopeselector"
v-if="!disableVisibilitySelector" v-if="!disableVisibilitySelector"
:user-default="userDefaultScope" :user-default="userDefaultScope"
:original-scope="copyMessageScope" :original-scope="copyMessageScope"