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