11<script setup lang="ts">
22import emitter from " @/renderer/events" ;
33import { useContext } from " @/renderer/hooks/useContext" ;
4+ import { useConfig } from " @/renderer/hooks/useConfig" ;
45import useFont from " @/renderer/hooks/useFont" ;
56import useOtherConfig from " @/renderer/hooks/useOtherConfig" ;
6- import { isShowOutline } from " @/renderer/hooks/useOutline" ;
7+ import { isShowOutline , toggleShowOutline } from " @/renderer/hooks/useOutline" ;
78import { useSaveConfirmDialog } from " @/renderer/hooks/useSaveConfirmDialog" ;
89import useSourceCode from " @/renderer/hooks/useSourceCode" ;
910import useSpellCheck from " @/renderer/hooks/useSpellCheck" ;
1011import useTab from " @/renderer/hooks/useTab" ;
1112import useTheme from " @/renderer/hooks/useTheme" ;
1213import { useUpdateDialog } from " @/renderer/hooks/useUpdateDialog" ;
14+ import useWorkSpace from " @/renderer/hooks/useWorkSpace" ;
1315import SaveConfirmDialog from " ./components/dialogs/SaveConfirmDialog.vue" ;
1416import UpdateConfirmDialog from " ./components/dialogs/UpdateConfirmDialog.vue" ;
1517import MilkupEditor from " ./components/editor/MilkupEditor.vue" ;
@@ -24,6 +26,8 @@ useContext();
2426const { init : initTheme } = useTheme ();
2527const { init : initFont } = useFont ();
2628const { init : initOtherConfig } = useOtherConfig ();
29+ const { config } = useConfig ();
30+ const { openWorkSpaceByPath } = useWorkSpace ();
2731const { isShowSource } = useSourceCode (); // 用于控制大纲显示
2832const { init : initSpellCheck } = useSpellCheck ();
2933const {
@@ -135,6 +139,15 @@ onMounted(() => {
135139 initFont ();
136140 initOtherConfig ();
137141 initSpellCheck ();
142+ toggleShowOutline (Boolean (config .value .workspace ?.autoExpandSidebar ));
143+ const startupPath = config .value .workspace ?.startupPath ;
144+ if (startupPath ) {
145+ window .electronAPI .workspaceExists (startupPath ).then ((exists ) => {
146+ if (exists ) {
147+ openWorkSpaceByPath (startupPath );
148+ }
149+ });
150+ }
138151 emitter .on (" update:available" , onUpdateAvailable );
139152});
140153onUnmounted (() => {
0 commit comments