Skip to content

Commit

Permalink
Merge pull request #51 from ZhaoYangyang0403/feature/save-current-dra…
Browse files Browse the repository at this point in the history
…ft-when-using-command-s

v1.14.1 - Save current draft when using cmd+s
  • Loading branch information
yumiguan authored Jul 19, 2023
2 parents 7e5ed19 + 178e125 commit 7eb8086
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 3 deletions.
1 change: 1 addition & 0 deletions frontend/src/components/BugTemplateSelector.vue
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,7 @@ export default {
set (val) {
if (val !== undefined) {
this.$store.commit('setSelectedCache', val)
this.$store.commit('setCreateName', val)
this.$store.dispatch('loadTemplate')
}
}
Expand Down
14 changes: 13 additions & 1 deletion frontend/src/components/Bugit.vue
Original file line number Diff line number Diff line change
Expand Up @@ -44,14 +44,26 @@ export default {
document.addEventListener('keydown', this.onKeyDown)
document.addEventListener('keyup', this.onKeyUp)
},
beforeDestroy () {
this.$bus.$off('message', this.displayMessage)
this.$bus.$off('msg.success', this.successMessage)
this.$bus.$off('msg.info', this.infoMessage)
this.$bus.$off('msg.error', this.errorMessage)
this.$bus.$off('msg.loading', this.loadingMessage)
this.$bus.$off('msg.destroy', this.destroyMessage)
},
methods: {
onKeyDown (event) {
if (event.key === 'Meta') {
this.metaKey = true
} else if (event.key === 's') {
if (this.metaKey) {
window.event.preventDefault()
this.$store.dispatch('saveCache')
if (this.$store.state.form.selectedCache === '') {
this.$store.commit('setShownDraftNameModal', true)
} else {
this.$store.dispatch('saveCache')
}
}
} else if (event.key === 'Enter' && this.$store.state.form.shownDraftNameModal) {
this.$store.dispatch('saveCache')
Expand Down
2 changes: 1 addition & 1 deletion lyrebird_bugit/apis.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ def template():
template_detail = template.form()

# 'template_loaded' fields will be ensured to have a uniform value by the script.
if template_detail[0]['template_loaded']:
if template_detail[0].get('template_loaded'):
message = None
else:
message = 'Template loads failed! Please try again later.'
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

setup(
name='lyrebird-bugit',
version='1.14.0',
version='1.14.1',
packages=['lyrebird_bugit'],
url='https://github.com/Meituan-Dianping/lyrebird-bugit',
author='HBQA',
Expand Down

0 comments on commit 7eb8086

Please sign in to comment.