upd: keep marked flag on move file

This commit is contained in:
purocean
2021-12-31 16:40:49 +08:00
parent d587bf5220
commit cbbd5cdbf6
+9 -1
View File
@@ -4,7 +4,7 @@ import store from '@fe/support/store'
import * as storage from '@fe/utils/storage'
import { basename } from '@fe/utils/path'
import type { BuildInSettings, Doc, Repo } from '@fe/types'
import { showHelp, switchDoc, unmarkDoc } from '@fe/services/document'
import { isMarked, markDoc, showHelp, switchDoc, unmarkDoc } from '@fe/services/document'
import { refreshTree } from '@fe/services/tree'
import { getSelectionInfo, whenEditorReady } from '@fe/services/editor'
import { getLanguage, setLanguage } from '@fe/services/i18n'
@@ -73,6 +73,14 @@ registerHook('DOC_SWITCH_FAILED', (payload?: { doc?: Doc | null, message: string
}
})
registerHook('DOC_MOVED', async ({ oldDoc, newDoc }) => {
if (isMarked(oldDoc)) {
await unmarkDoc(oldDoc)
await markDoc(newDoc)
await refreshTree()
}
})
registerHook('SETTING_FETCHED', () => {
if (!getPurchased(true)) {
whenEditorReady().then(() => {