mirror of
https://github.com/marktext/marktext.git
synced 2025-05-02 14:50:41 +08:00
fix: relative images are not loaded after closing a tab (#810)
This commit is contained in:
parent
c6def5a726
commit
94066706f5
2
.github/CHANGELOG.md
vendored
2
.github/CHANGELOG.md
vendored
@ -78,7 +78,7 @@ This update **fixes a XSS security vulnerability** when exporting a document.
|
||||
- Emojis don't work properly (#769)
|
||||
- Fixed multiple parser issues (update marked.js to v0.6.1)
|
||||
- Fixed [...] is displayed in gray and orange (#432)
|
||||
|
||||
- Fixed an issue that relative images are not loaded after closing a tab
|
||||
|
||||
### 0.13.65
|
||||
|
||||
|
@ -44,7 +44,8 @@ const mutations = {
|
||||
const fileState = state.tabs[index] || state.tabs[index - 1] || {}
|
||||
state.currentFile = fileState
|
||||
if (typeof fileState.markdown === 'string') {
|
||||
const { markdown, cursor, history } = fileState
|
||||
const { markdown, cursor, history, pathname } = fileState
|
||||
window.DIRNAME = pathname ? path.dirname(pathname) : ''
|
||||
bus.$emit('file-changed', { markdown, cursor, renderCursor: true, history })
|
||||
}
|
||||
}
|
||||
@ -112,12 +113,16 @@ const mutations = {
|
||||
arr.forEach(id => {
|
||||
const index = state.tabs.findIndex(f => f.id === id)
|
||||
state.tabs.splice(index, 1)
|
||||
if (state.currentFile.id === id) state.currentFile = {}
|
||||
if (state.currentFile.id === id) {
|
||||
state.currentFile = {}
|
||||
window.DIRNAME = ''
|
||||
}
|
||||
})
|
||||
if (!state.currentFile.id && state.tabs.length) {
|
||||
state.currentFile = state.tabs[0]
|
||||
if (typeof state.currentFile.markdown === 'string') {
|
||||
const { markdown, cursor, history } = state.currentFile
|
||||
const { markdown, cursor, history, pathname } = state.currentFile
|
||||
window.DIRNAME = pathname ? path.dirname(pathname) : ''
|
||||
bus.$emit('file-changed', { markdown, cursor, renderCursor: true, history })
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user