Commit 1ccf76e1 authored by Anton Koch's avatar Anton Koch

Merge branch 'mosys--save-scroll-position' into 'master'

Mosys: Save scroll position across all grid views

See merge request !16
parents 1fa5efe4 94c816b5
Pipeline #12725 passed with stage
in 9 minutes and 10 seconds
......@@ -43,7 +43,8 @@
},
computed: {
...mapGetters({
isMobile: 'globalSettings/getIsMobile'
isMobile: 'globalSettings/getIsMobile',
scrollPositionCache: 'mosys/getScrollPositionCache'
}),
queryPositionX () {
if (this.$route.query.x) return parseInt(this.$route.query.x)
......@@ -66,7 +67,7 @@
},
async mounted () {
await this.loadGrid(this.$route.params.uuid)
this.$root.$emit('setBackButton', '/mosys/grids')
this.$el.scrollLeft = this.scrollPositionCache
},
methods: {
onScroll () {
......
......@@ -99,7 +99,7 @@
components: {
Cell
},
props: ['gridUuid'],
props: ['gridUuid', 'tabsAreOpen'],
data () {
return {
gridContextMenuActions: {
......@@ -138,7 +138,8 @@
user: 'auth/getUserState',
isMobile: 'globalSettings/getIsMobile',
// editingCells: 'mosys/getEditingCells'
showEditingCells: 'mosys/getShowEditingCells'
showEditingCells: 'mosys/getShowEditingCells',
scrollPositionCache: 'mosys/getScrollPositionCache'
}),
cellContextMenuActions () {
const actions = {
......@@ -182,8 +183,7 @@
},
async mounted () {
await this.fetchData()
// this.$root.$emit('setBackButton', '/mosys/grids')
console.log('show editing', this.showEditingCells)
this.resetScrollPosition()
},
watch: {
annotations () {
......@@ -200,6 +200,9 @@
if (val === false) {
this.updateAnnotationUIStates()
}
},
tabsAreOpen () {
this.resetScrollPosition()
}
},
methods: {
......@@ -361,7 +364,7 @@
handleCellEditClick (event, cell) {
this.annotationUIStates[cell._uuid].editing = !this.annotationUIStates[cell._uuid].editing
this.updateEditingCells()
// this.$store.commit('mosys/showEditingCells')
this.$root.$emit('mosys_saveScrollPosition')
},
handleCellClick (event, cell) {
......@@ -604,6 +607,10 @@
}
}
else return {}
},
resetScrollPosition () {
console.log('reset', this.scrollPositionCache, this.$el.scrollLeft)
this.$el.scrollLeft = this.scrollPositionCache
}
}
}
......
......@@ -4,7 +4,7 @@
q-tab(slot="title", name="tab-editing-cells", default) Edit Cell
q-btn(slot="title", icon="close",
small, flat, round, class="fixed", style="right: 2px; margin-top: 3px",
@click="() => {$store.commit('mosys/hideEditingCells')}")
@click="handleCloseTabs()")
q-tab-pane(name="tab-editing-cells")
template(v-if="showEditingCells")
......@@ -44,6 +44,12 @@
},
beforeDestroy () {
this.$store.commit('mosys/hideEditingCells')
},
methods: {
handleCloseTabs () {
this.$root.$emit('mosys_saveScrollPosition')
this.$store.commit('mosys/hideEditingCells')
}
}
}
</script>
......
......@@ -6,7 +6,7 @@
q-tab(slot="title", name="tab-documents", v-if="userHasDocuments") Documents
q-btn(slot="title", icon="close",
small, flat, round, class="fixed", style="right: 2px; margin-top: 3px",
@click="event => {$store.commit('mosys/hideSources')}")
@click="handleCloseTabs()")
q-tab-pane(name="tab-default-cells")
// template(v-if="this.selectedCells.length > 0")
......@@ -70,6 +70,12 @@
},
beforeDestroy () {
this.$store.commit('mosys/hideSources')
},
methods: {
handleCloseTabs () {
this.$root.$emit('mosys_saveScrollPosition')
this.$store.commit('mosys/hideSources')
}
}
}
</script>
......
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