debian-mirror-gitlab/app/assets/javascripts/notes/components/discussion_navigator.vue

32 lines
973 B
Vue
Raw Normal View History

2019-10-12 21:52:04 +05:30
<script>
/* global Mousetrap */
import 'mousetrap';
2021-04-29 21:17:54 +05:30
import {
keysFor,
MR_NEXT_UNRESOLVED_DISCUSSION,
MR_PREVIOUS_UNRESOLVED_DISCUSSION,
} from '~/behaviors/shortcuts/keybindings';
2020-10-24 23:57:45 +05:30
import eventHub from '~/notes/event_hub';
2021-03-11 19:13:27 +05:30
import discussionNavigation from '~/notes/mixins/discussion_navigation';
2019-10-12 21:52:04 +05:30
export default {
mixins: [discussionNavigation],
2020-10-24 23:57:45 +05:30
created() {
eventHub.$on('jumpToFirstUnresolvedDiscussion', this.jumpToFirstUnresolvedDiscussion);
},
2019-10-12 21:52:04 +05:30
mounted() {
2021-04-29 21:17:54 +05:30
Mousetrap.bind(keysFor(MR_NEXT_UNRESOLVED_DISCUSSION), this.jumpToNextDiscussion);
Mousetrap.bind(keysFor(MR_PREVIOUS_UNRESOLVED_DISCUSSION), this.jumpToPreviousDiscussion);
2019-10-12 21:52:04 +05:30
},
beforeDestroy() {
2021-04-29 21:17:54 +05:30
Mousetrap.unbind(keysFor(MR_NEXT_UNRESOLVED_DISCUSSION));
Mousetrap.unbind(keysFor(MR_PREVIOUS_UNRESOLVED_DISCUSSION));
2020-10-24 23:57:45 +05:30
eventHub.$off('jumpToFirstUnresolvedDiscussion', this.jumpToFirstUnresolvedDiscussion);
2019-10-12 21:52:04 +05:30
},
render() {
return this.$slots.default;
},
};
</script>