Skip to content

Commit

Permalink
修正
Browse files Browse the repository at this point in the history
  • Loading branch information
X-20A committed Nov 17, 2024
1 parent 093c6d2 commit 98ca600
Show file tree
Hide file tree
Showing 6 changed files with 8 additions and 53 deletions.
9 changes: 0 additions & 9 deletions src/components/App.vue
Original file line number Diff line number Diff line change
Expand Up @@ -77,10 +77,6 @@ watch(
async (openedEditor) => {
if (openedEditor != undefined) {
hotkeyManager.onEditorChange(openedEditor);
await store.dispatch("SET_ROOT_MISC_SETTING", {
key: "editorType",
value: openedEditor,
});
}
},
);
Expand Down Expand Up @@ -114,11 +110,6 @@ onMounted(async () => {
// プロジェクトファイルのパスを取得
const projectFilePath = urlParams.get("projectFilePath");
// どちらのエディタを開くか設定
await store.actions.SET_OPENED_EDITOR({
editor: store.state.editorType,
});
// ショートカットキーの設定を登録
const hotkeySettings = store.state.hotkeySettings;
hotkeyManager.load(structuredClone(toRaw(hotkeySettings)));
Expand Down
5 changes: 4 additions & 1 deletion src/components/Menu/MenuBar/TitleBarEditorSwitcher.vue
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,10 @@ const openedEditor = computed(() => store.state.openedEditor);
const uiLocked = computed(() => store.getters.UI_LOCKED);

const switchEditor = async (editor: EditorType) => {
await store.actions.SET_OPENED_EDITOR({ editor });
await store.dispatch("SET_ROOT_MISC_SETTING", {
key: "openedEditor",
value: editor,
});
};
</script>

Expand Down
4 changes: 2 additions & 2 deletions src/store/setting.ts
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ export const settingStoreState: SettingStoreState = {
},
showSingCharacterPortrait: true,
playheadPositionDisplayFormat: "MINUTES_SECONDS",
editorType: "talk",
openedEditor: "talk",
};

export const settingStore = createPartialStore<SettingStoreTypes>({
Expand Down Expand Up @@ -149,7 +149,7 @@ export const settingStore = createPartialStore<SettingStoreTypes>({
"undoableTrackOperations",
"showSingCharacterPortrait",
"playheadPositionDisplayFormat",
"editorType",
"openedEditor",
] as const;

// rootMiscSettingKeysに値を足し忘れていたときに型エラーを出す検出用コード
Expand Down
12 changes: 0 additions & 12 deletions src/store/type.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1921,8 +1921,6 @@ export type SettingStoreTypes = {
*/

export type UiStoreState = {
editorType: EditorType;
openedEditor: EditorType | undefined; // undefinedのときはどのエディタを開くか定まっていない
uiLockCount: number;
dialogLockCount: number;
reloadingLock: boolean;
Expand Down Expand Up @@ -1952,11 +1950,6 @@ export type DialogStates = {
};

export type UiStoreTypes = {
SET_OPENED_EDITOR: {
mutation: { editor: EditorType };
action(palyoad: { editor: EditorType }): void;
};

UI_LOCKED: {
getter: boolean;
};
Expand Down Expand Up @@ -2054,11 +2047,6 @@ export type UiStoreTypes = {
action(payload: { activePointScrollMode: ActivePointScrollMode }): void;
};

SET_EDITOR_TYPE: {
mutation: { editorType: EditorType };
action(payload: { editorType: EditorType }): void;
};

SET_AVAILABLE_THEMES: {
mutation: { themes: ThemeConf[] };
};
Expand Down
28 changes: 1 addition & 27 deletions src/store/ui.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import {
UiStoreTypes,
} from "./type";
import { createPartialStore } from "./vuex";
import { ActivePointScrollMode, EditorType } from "@/type/preload";
import { ActivePointScrollMode } from "@/type/preload";
import {
AlertDialogOptions,
ConfirmDialogOptions,
Expand Down Expand Up @@ -63,8 +63,6 @@ export function withProgress<T>(
}

export const uiStoreState: UiStoreState = {
editorType: "talk",
openedEditor: undefined,
uiLockCount: 0,
dialogLockCount: 0,
reloadingLock: false,
Expand All @@ -91,15 +89,6 @@ export const uiStoreState: UiStoreState = {
};

export const uiStore = createPartialStore<UiStoreTypes>({
SET_OPENED_EDITOR: {
mutation(state, { editor }) {
state.openedEditor = editor;
},
action({ mutations }, { editor }) {
mutations.SET_OPENED_EDITOR({ editor });
},
},

UI_LOCKED: {
getter(state) {
return state.uiLockCount > 0;
Expand Down Expand Up @@ -261,10 +250,6 @@ export const uiStore = createPartialStore<UiStoreTypes>({
),
});

mutations.SET_OPENED_EDITOR({
editor: await window.backend.getSetting("editorType"),
});

// electron-window-stateがvuex初期化前に働くので
// ここで改めてelectron windowの最大化状態をVuex storeに同期
if (await window.backend.isMaximizedWindow()) {
Expand Down Expand Up @@ -340,17 +325,6 @@ export const uiStore = createPartialStore<UiStoreTypes>({
},
},

SET_EDITOR_TYPE: {
mutation(state, { editorType }: { editorType: EditorType }) {
state.editorType = editorType;
},
async action({ mutations }, { editorType }: { editorType: EditorType }) {
mutations.SET_OPENED_EDITOR({
editor: await window.backend.setSetting("editorType", editorType),
});
},
},

/**
* 選択可能なテーマをセットする。
* NOTE: カスタムテーマが導入された場合を見越して残している。
Expand Down
3 changes: 1 addition & 2 deletions src/type/preload.ts
Original file line number Diff line number Diff line change
Expand Up @@ -594,7 +594,7 @@ export const rootMiscSettingSchema = z.object({
playheadPositionDisplayFormat: z
.enum(["MINUTES_SECONDS", "MEASURES_BEATS"])
.default("MINUTES_SECONDS"), // 再生ヘッド位置の表示モード
editorType: z.enum(["talk", "song"]).default("talk"),
openedEditor: z.enum(["talk", "song"]).default("talk"),
});
export type RootMiscSettingType = z.infer<typeof rootMiscSettingSchema>;

Expand All @@ -604,7 +604,6 @@ export const configSchema = z
activePointScrollMode: z
.enum(["CONTINUOUSLY", "PAGE", "OFF"])
.default("OFF"),
editorType: z.enum(["talk", "song"]).default("talk"),
savingSetting: z
.object({
fileEncoding: z.enum(["UTF-8", "Shift_JIS"]).default("UTF-8"),
Expand Down

0 comments on commit 98ca600

Please sign in to comment.