Skip to content

Commit

Permalink
chore(toolbox): 翻译结束后清除缓存
Browse files Browse the repository at this point in the history
  • Loading branch information
mark9804 committed Apr 12, 2024
1 parent ed8b5b5 commit da528bb
Showing 1 changed file with 9 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
文件名: {{ getFileName() }}
</n-tooltip>
<n-button type="info" @click="handlePreviewModeRequest">{{
isPreviewMode ? '取消预览' : '预览全文翻译'
isPreviewMode ? "取消预览" : "预览全文翻译"
}}</n-button>
<n-button
v-if="!hasFileSaved"
Expand All @@ -41,10 +41,10 @@
</div>
</template>
<script setup lang="ts">
import { saveAs } from 'file-saver';
import { computed, ref } from 'vue';
import { useGlobalConfig } from '../store/configStore';
import { useScenarioStore } from '../store/scenarioEditorStore';
import { saveAs } from "file-saver";
import { computed, ref } from "vue";
import { useGlobalConfig } from "../store/configStore";
import { useScenarioStore } from "../store/scenarioEditorStore";
// import { Scenario } from '../types/content';
Expand All @@ -57,7 +57,7 @@ function normalizeFileId(fileId: string): string {
const fileIdStr = fileId;
const characterId = fileIdStr.slice(0, 5);
const groupId = fileIdStr.slice(5);
if (groupId.startsWith('0')) {
if (groupId.startsWith("0")) {
return `${characterId}${groupId.slice(1)}`;
}
return fileIdStr;
Expand All @@ -69,12 +69,12 @@ function getFileName() {
if (groupId.length > 5) {
fileId = normalizeFileId(groupId);
}
return `[${config.isProofread ? '已校对' : '未校对'}]${fileId}.json`;
return `[${config.isProofread ? "已校对" : "未校对"}]${fileId}.json`;
}
const downloadHandle = () => {
const blob = new Blob([JSON.stringify(mainStore.getScenario, null, 2)], {
type: 'text/plain;charset=utf-8',
type: "text/plain;charset=utf-8",
});
saveAs(blob, getFileName());
hasFileSaved.value = true;
Expand All @@ -88,6 +88,7 @@ function handleClearAllRequest() {
hasFileSaved.value = false;
mainStore.clearAll();
config.resetConfigState();
config.resetTmpTranslation();
}
function handlePreviewModeRequest() {
Expand Down

0 comments on commit da528bb

Please sign in to comment.