Skip to content

Commit

Permalink
セルの全選択 (#1963)
Browse files Browse the repository at this point in the history
* セルの全選択

* 全セル選択をメニューバーの編集欄に追加、一部アクションの口調を統一

* 全セル選択をメニューバーの編集欄に追加、一部アクションの口調を統一

* 操作の名前の変更のマイグレートを追加

* to 読み込む

* 不要な変更が入ってしまった

* 誤字してしまった

---------

Co-authored-by: Hiroshiba Kazuyuki <[email protected]>
  • Loading branch information
ShimagayaSatoka and Hiroshiba authored Apr 30, 2024
1 parent 7b06f6f commit 54be47d
Show file tree
Hide file tree
Showing 4 changed files with 67 additions and 7 deletions.
29 changes: 29 additions & 0 deletions src/backend/common/ConfigManager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,35 @@ const migrations: [string, (store: Record<string, unknown>) => unknown][] = [
}
},
],
[
">=0.20",
(config) => {
// プロジェクト読み込み → プロジェクトを読み込む
const hotkeySettings =
config.hotkeySettings as ConfigType["hotkeySettings"];
const newHotkeySettings: ConfigType["hotkeySettings"] =
hotkeySettings.map((hotkeySetting) => {
/// @ts-expect-error 名前変更なので合わない。
if (hotkeySetting.action === "プロジェクト読み込み") {
return {
...hotkeySetting,
action: "プロジェクトを読み込む",
};
}
/// @ts-expect-error 名前変更なので合わない。
if (hotkeySetting.action === "テキスト読み込む") {
return {
...hotkeySetting,
action: "テキストを読み込む",
};
}
return hotkeySetting;
});
config.hotkeySettings = newHotkeySettings;

return config;
},
],
];

export type Metadata = {
Expand Down
18 changes: 16 additions & 2 deletions src/components/Menu/MenuBar/MenuBar.vue
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,8 @@ const store = useStore();
const { registerHotkeyWithCleanup } = useHotkeyManager();
const currentVersion = ref("");
const audioKeys = computed(() => store.state.audioKeys);
// デフォルトエンジンの代替先ポート
const defaultEngineAltPortTo = computed<number | undefined>(() => {
const altPortInfos = store.state.altPortInfos;
Expand Down Expand Up @@ -316,7 +318,7 @@ const menudata = computed<MenuItemData[]>(() => [
},
{
type: "button",
label: "プロジェクト読み込み",
label: "プロジェクトを読み込む",
onClick: () => {
importProject();
},
Expand Down Expand Up @@ -360,6 +362,18 @@ const menudata = computed<MenuItemData[]>(() => [
disabled: !canRedo.value,
disableWhenUiLocked: true,
},
{
type: "button",
label: "全セルを選択",
onClick: async () => {
if (!uiLocked.value) {
await store.dispatch("SET_SELECTED_AUDIO_KEYS", {
audioKeys: audioKeys.value,
});
}
},
disableWhenUiLocked: true,
},
...props.editSubMenuData,
],
},
Expand Down Expand Up @@ -506,7 +520,7 @@ registerHotkeyForAllEditors({
});
registerHotkeyForAllEditors({
callback: importProject,
name: "プロジェクト読み込み",
name: "プロジェクトを読み込む",
});
</script>

Expand Down
14 changes: 13 additions & 1 deletion src/components/Talk/TalkEditor.vue
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,7 @@ registerHotkeyWithCleanup({
});
registerHotkeyWithCleanup({
editor: "talk",
name: "テキスト読み込む",
name: "テキストを読み込む",
callback: () => {
if (!uiLocked.value) {
store.dispatch("SHOW_CONNECT_AND_EXPORT_TEXT_DIALOG");
Expand Down Expand Up @@ -246,6 +246,18 @@ registerHotkeyWithCleanup({
}
},
});
registerHotkeyWithCleanup({
editor: "talk",
enableInTextbox: false,
name: "全セルを選択",
callback: () => {
if (!uiLocked.value) {
store.dispatch("SET_SELECTED_AUDIO_KEYS", {
audioKeys: audioKeys.value,
});
}
},
});
const removeAudioItem = async () => {
if (activeAudioKey.value == undefined) throw new Error();
Expand Down
13 changes: 9 additions & 4 deletions src/type/preload.ts
Original file line number Diff line number Diff line change
Expand Up @@ -137,11 +137,11 @@ export const defaultHotkeySettings: HotkeySettingType[] = [
combination: HotkeyCombination(!isMac ? "Ctrl S" : "Meta S"),
},
{
action: "プロジェクト読み込み",
action: "プロジェクトを読み込む",
combination: HotkeyCombination(!isMac ? "Ctrl O" : "Meta O"),
},
{
action: "テキスト読み込む",
action: "テキストを読み込む",
combination: HotkeyCombination(""),
},
{
Expand Down Expand Up @@ -172,6 +172,10 @@ export const defaultHotkeySettings: HotkeySettingType[] = [
action: "選択解除",
combination: HotkeyCombination("Escape"),
},
{
action: "全セルを選択",
combination: HotkeyCombination(!isMac ? "Ctrl Shift A" : "Meta Shift A"),
},
];

export const defaultToolbarButtonSetting: ToolbarSettingType = [
Expand Down Expand Up @@ -449,15 +453,16 @@ export const hotkeyActionNameSchema = z.enum([
"新規プロジェクト",
"プロジェクトを名前を付けて保存",
"プロジェクトを上書き保存",
"プロジェクト読み込み",
"テキスト読み込む",
"プロジェクトを読み込む",
"テキストを読み込む",
"全体のイントネーションをリセット",
"選択中のアクセント句のイントネーションをリセット",
"コピー",
"切り取り",
"貼り付け",
"すべて選択",
"選択解除",
"全セルを選択",
]);

export type HotkeyActionNameType = z.infer<typeof hotkeyActionNameSchema>;
Expand Down

0 comments on commit 54be47d

Please sign in to comment.