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

27 lines
691 B
Vue
Raw Normal View History

2019-10-12 21:52:04 +05:30
<script>
/* global Mousetrap */
import 'mousetrap';
import discussionNavigation from '~/notes/mixins/discussion_navigation';
2020-10-24 23:57:45 +05:30
import eventHub from '~/notes/event_hub';
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() {
2020-03-13 15:44:24 +05:30
Mousetrap.bind('n', this.jumpToNextDiscussion);
Mousetrap.bind('p', this.jumpToPreviousDiscussion);
2019-10-12 21:52:04 +05:30
},
beforeDestroy() {
Mousetrap.unbind('n');
Mousetrap.unbind('p');
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>