Commit d45a8e00 authored by Fatih Acet's avatar Fatih Acet

IssueNotesRefactor: Make scroll into note an action.

parent 08d597c7
......@@ -94,12 +94,8 @@ export default {
const $el = $(`#${hash}`);
if (hash && $el) {
const isInViewport = gl.utils.isInViewport($el[0]);
this.$store.commit('setTargetNoteHash', hash);
if (!isInViewport) {
gl.utils.scrollToElement($el);
}
this.$store.dispatch('scrollToNoteIfNeeded', $el);
}
},
},
......
......@@ -214,6 +214,13 @@ const actions = {
}
});
},
scrollToNoteIfNeeded(context, el) {
const isInViewport = gl.utils.isInViewport(el[0]);
if (!isInViewport) {
gl.utils.scrollToElement(el);
}
},
};
export default {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment