fix: #1181 reset TOC after close the last tab (#1200)

This commit is contained in:
Ran Luo 2019-07-31 23:54:23 +08:00 committed by Felix Häusler
parent 669918bda2
commit 761ff169b0

View File

@ -59,6 +59,11 @@ const mutations = {
window.DIRNAME = pathname ? path.dirname(pathname) : ''
bus.$emit('file-changed', { id, markdown, cursor, renderCursor: true, history })
}
// 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.