fix: save media asset path on reopen (#919)

pull/921/head 2.0.0-beta.230
Markus 6 years ago committed by Nicolas Giard
parent 5689444a17
commit c88a9fc703

@ -228,7 +228,7 @@
<script>
import _ from 'lodash'
import { sync } from 'vuex-pathify'
import { get, sync } from 'vuex-pathify'
import vueFilePond from 'vue-filepond'
import 'filepond/dist/filepond.min.css'
@ -255,7 +255,6 @@ export default {
data() {
return {
folders: [],
folderTree: [],
files: [],
assets: [],
pagination: {},
@ -268,9 +267,6 @@ export default {
{ text: 'Absolute Top Right', value: 'abstopright' }
],
imageAlignment: '',
currentFolderId: 0,
currentFileId: null,
previousFolderId: 0,
loading: false,
newFolderDialog: false,
newFolderName: '',
@ -289,6 +285,9 @@ export default {
set(val) { this.$emit('input', val) }
},
activeModal: sync('editor/activeModal'),
folderTree: get('editor/media@folderTree'),
currentFolderId: sync('editor/media@currentFolderId'),
currentFileId: sync('editor/media@currentFileId'),
pageTotal () {
if (this.pagination.rowsPerPage == null || this.pagination.totalItems == null) {
return 0
@ -400,12 +399,12 @@ export default {
await this.$apollo.queries.assets.refetch()
},
downFolder(folder) {
this.folderTree.push(folder)
this.$store.commit('editor/pushMediaFolderTree', folder)
this.currentFolderId = folder.id
this.currentFileId = null
},
upFolder() {
this.folderTree.pop()
this.$store.commit('editor/popMediaFolderTree')
const parentFolder = _.last(this.folderTree)
this.currentFolderId = parentFolder ? parentFolder.id : 0
this.currentFileId = null

@ -4,11 +4,24 @@ const state = {
editor: '',
content: '',
mode: 'create',
activeModal: ''
activeModal: '',
media: {
folderTree: [],
currentFolderId: 0,
currentFileId: null
}
}
export default {
namespaced: true,
state,
mutations: make.mutations(state)
mutations: {
...make.mutations(state),
pushMediaFolderTree: (state, folder) => {
state.media.folderTree = state.media.folderTree.concat(folder)
},
popMediaFolderTree: (state) => {
state.media.folderTree = state.media.folderTree.slice(0, -1)
}
}
}

Loading…
Cancel
Save