This commit is contained in:
Ran Luo 2019-09-30 06:29:03 +08:00 committed by Felix Häusler
parent 8e47088260
commit 91515242d4

View File

@ -59,12 +59,13 @@ const mutations = {
window.DIRNAME = pathname ? path.dirname(pathname) : ''
bus.$emit('file-changed', { id, markdown, cursor, renderCursor: true, history })
}
}
if (state.tabs.length === 0) {
// Handle close the last tab, need to reset the TOC state
if (Object.keys(fileState).length === 0) {
state.listToc = []
state.toc = []
}
}
},
// Exchange from with to and move from to the end if to is null or empty.
EXCHANGE_TABS_BY_ID (state, tabIDs) {
@ -252,6 +253,12 @@ const mutations = {
bus.$emit('file-changed', { id, markdown, cursor, renderCursor: true, history })
}
}
if (state.tabs.length === 0) {
// Handle close the last tab, need to reset the TOC state
state.listToc = []
state.toc = []
}
},
RENAME_IF_NEEDED (state, { src, dest }) {
const { tabs } = state