Merge pull request #503 from h3poteto/iss-482
closes #482 Add confirm modal when close new toot
This commit is contained in:
commit
688eb928a9
|
@ -121,7 +121,10 @@
|
|||
"cw": "Write your warning here",
|
||||
"status": "What is on your mind?",
|
||||
"cancel": "Cancel",
|
||||
"toot": "Toot"
|
||||
"toot": "Toot",
|
||||
"close_confirm": "Are you sure to close new toot?",
|
||||
"close_confirm_ok": "OK",
|
||||
"close_confirm_cancel": "Cancel"
|
||||
},
|
||||
"jump": {
|
||||
"jump_to": "Jump to..."
|
||||
|
|
|
@ -121,7 +121,10 @@
|
|||
"cw": "Écrivez votre avertissement ici",
|
||||
"status": "Qu'avez-vous en tête ?",
|
||||
"cancel": "Annuler",
|
||||
"toot": "Pouet!"
|
||||
"toot": "Pouet!",
|
||||
"close_confirm": "Êtes-vous certain de vouloir fermer ce nouveau pouet ?",
|
||||
"close_confirm_ok": "Oui",
|
||||
"close_confirm_cancel": "Annuler"
|
||||
},
|
||||
"jump": {
|
||||
"jump_to": "Aller à..."
|
||||
|
|
|
@ -121,7 +121,10 @@
|
|||
"cw": "ここに警告を書いてください",
|
||||
"status": "今なにしてる?",
|
||||
"cancel": "キャンセル",
|
||||
"toot": "トゥート!"
|
||||
"toot": "トゥート!",
|
||||
"close_confirm": "本当に閉じますか?",
|
||||
"close_confirm_ok": "閉じる",
|
||||
"close_confirm_cancel": "キャンセル"
|
||||
},
|
||||
"jump": {
|
||||
"jump_to": "移動..."
|
||||
|
|
|
@ -2,6 +2,7 @@
|
|||
<el-dialog
|
||||
:title="$t('modals.new_toot.title')"
|
||||
:visible.sync="newTootModal"
|
||||
:before-close="closeConfirm"
|
||||
width="400px"
|
||||
class="new-toot-modal">
|
||||
<el-form v-on:submit.prevent="toot">
|
||||
|
@ -234,6 +235,22 @@ export default {
|
|||
},
|
||||
changeSensitive () {
|
||||
this.$store.commit('TimelineSpace/Modals/NewToot/changeSensitive', !this.sensitive)
|
||||
},
|
||||
closeConfirm (done) {
|
||||
if (this.status.length === 0) {
|
||||
done()
|
||||
} else {
|
||||
this.$confirm(
|
||||
this.$t('modals.new_toot.close_confirm'),
|
||||
{
|
||||
confirmButtonText: this.$t('modals.new_toot.close_confirm_ok'),
|
||||
cancelButtonText: this.$t('modals.new_toot.close_confirm_cancel')
|
||||
})
|
||||
.then(_ => {
|
||||
done()
|
||||
})
|
||||
.catch(_ => {})
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
<textarea
|
||||
v-model="status"
|
||||
ref="status"
|
||||
v-shortkey="openSuggest ? {up: ['arrowup'], down: ['arrowdown'], enter: ['enter']} : {linux: ['ctrl', 'enter'], mac: ['meta', 'enter'], left: ['arrowleft'], right: ['arrowright']}"
|
||||
v-shortkey="openSuggest ? {up: ['arrowup'], down: ['arrowdown'], enter: ['enter'], esc: ['esc']} : {linux: ['ctrl', 'enter'], mac: ['meta', 'enter'], left: ['arrowleft'], right: ['arrowright']}"
|
||||
@shortkey="handleKey"
|
||||
v-on:input="startSuggest"
|
||||
:placeholder="$t('modals.new_toot.status')"
|
||||
|
@ -140,6 +140,9 @@ export default {
|
|||
case 'enter':
|
||||
this.selectCurrentAccount()
|
||||
break
|
||||
case 'esc':
|
||||
this.closeSuggest()
|
||||
break
|
||||
case 'left':
|
||||
event.target.setSelectionRange(current - 1, current - 1)
|
||||
break
|
||||
|
|
Loading…
Reference in New Issue