FEATURE [workflow][doc] scroll immediately to document in workflow and let background flash

This commit is contained in:
2023-05-25 17:06:10 +02:00
parent 5749660760
commit ff03299f80
4 changed files with 41 additions and 9 deletions

View File

@@ -122,7 +122,8 @@
<add-evaluation
v-for="e in pickedEvaluations"
v-bind:key="e.key"
v-bind:evaluation="e">
v-bind:evaluation="e"
v-bind:docId="this.docId">
</add-evaluation>
<!-- box to add new evaluation -->
@@ -389,6 +390,7 @@ export default {
i18n,
data() {
return {
docId: null,
isExpanded: false,
editor: ClassicEditor,
showAddObjective: false,
@@ -428,7 +430,14 @@ export default {
},
};
},
computed: {
beforeMount() {
const urlParams = new URLSearchParams(window.location.search);
this.docId = urlParams.get('doc_id');
},
mounted() {
this.scrollToElement(this.docId);
},
computed: {
...mapState([
'work',
'resultsForAction',
@@ -559,7 +568,7 @@ export default {
});
},
saveFormOnTheFly(payload) {
console.log('saveFormOnTheFly: type', payload.type, ', data', payload.data);
// console.log('saveFormOnTheFly: type', payload.type, ', data', payload.data);
let body = { type: payload.type };
body.name = payload.data.text;
@@ -581,6 +590,12 @@ export default {
this.$toast.open({message: 'An error occurred'});
}
})
},
scrollToElement(docId) {
const documentEl = document.getElementById(`document_${docId}`);
if (documentEl) {
documentEl.scrollIntoView({behavior: 'smooth'});
}
}
}
};