Skip to content

Commit 357f607

Browse files
committed
feat: set shortcuts
1 parent f04efa9 commit 357f607

4 files changed

Lines changed: 29 additions & 8 deletions

File tree

packages/app/src/components/page/editor/project/preferences/container/EditorProjectPreferencesContainerKeyboard.vue

Lines changed: 18 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -75,33 +75,46 @@
7575
<EditorProjectPreferencesKeyboardItem
7676
:title="t('editor.aside.configuration.autosave')"
7777
shortcut="CTRL + S"
78-
/>
78+
>
79+
<InputBoolean v-model="SHORTCUTS.ctrlS" />
80+
</EditorProjectPreferencesKeyboardItem>
7981
<EditorProjectPreferencesKeyboardItem
8082
:title="t('editor.aside.configuration.cloudAutosave')"
8183
shortcut="CTRL + SHIFT + S"
8284
/>
8385
<EditorProjectPreferencesKeyboardItem
8486
:title="t('editor.bar.pdf.generate')"
8587
shortcut="CTRL + SHIFT + P"
86-
/>
88+
>
89+
<InputBoolean v-model="SHORTCUTS.ctrlShiftP" />
90+
</EditorProjectPreferencesKeyboardItem>
8791
<EditorProjectPreferencesKeyboardItem
8892
:title="t('editor.bar.epub.generate')"
8993
shortcut="CTRL + SHIFT + E"
90-
/>
94+
>
95+
<InputBoolean v-model="SHORTCUTS.ctrlShiftE" />
96+
</EditorProjectPreferencesKeyboardItem>
9197
<EditorProjectPreferencesKeyboardItem
9298
:title="t('editor.bar.html.generate')"
9399
shortcut="CTRL + SHIFT + H"
94-
/>
100+
>
101+
<InputBoolean v-model="SHORTCUTS.ctrlShiftH" />
102+
</EditorProjectPreferencesKeyboardItem>
95103
<EditorProjectPreferencesKeyboardItem
96104
:title="t('editor.bar.txt.generate')"
97105
shortcut="CTRL + SHIFT + T"
98-
/>
106+
>
107+
<InputBoolean v-model="SHORTCUTS.ctrlShiftT" />
108+
</EditorProjectPreferencesKeyboardItem>
99109
</div>
100110
</EditorProjectPreferencesContainerSlot>
101111
</template>
102112

103113
<script setup lang="ts">
114+
import { useShortcutsStore } from '@/store/shortcuts'
104115
import { useI18n } from 'vue-i18n'
105116
117+
const SHORTCUTS = useShortcutsStore()
118+
106119
const { t } = useI18n()
107120
</script>

packages/app/src/components/page/editor/project/preferences/keyboard/EditorProjectPreferencesKeyboardItem.vue

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,12 @@
33
class="flex flex-row font-bold justify-between text-theme-text-2 items-center w-full my-2"
44
>
55
<h3>{{ props.title }}</h3>
6-
<p class="px-2 py-1 rounded-full text-theme-text-2 shadow-lg w-24">
7-
{{ props.shortcut }}
8-
</p>
6+
<div class="flex items-center gap-4">
7+
<p class="px-2 py-1 rounded-full text-theme-text-2 shadow-lg w-24">
8+
{{ props.shortcut }}
9+
</p>
10+
<slot ></slot>
11+
</div>
912
</div>
1013
</template>
1114

packages/app/src/use/storage/storage.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,13 +16,15 @@ import { useDefines } from '../defines'
1616
import { useDOCXStore } from '@/store/docx'
1717
import { useUtils } from '../utils'
1818
import { useI18n } from 'vue-i18n'
19+
import { useShortcutsStore } from '@/store/shortcuts'
1920

2021
export const useStorage = () => {
2122
const PROJECT = useProjectStore()
2223
const CONTEXT = useContextStore()
2324
const EDITOR = useEditorStore()
2425
const PDF = usePDFStore()
2526
const DOCX = useDOCXStore()
27+
const SHORTCUTS = useShortcutsStore()
2628

2729
const env = useEnv()
2830
const emitter = useEmitter()
@@ -313,6 +315,7 @@ export const useStorage = () => {
313315
normalize: {},
314316
},
315317
docx: DOCX.$state,
318+
shortcuts: SHORTCUTS.$state
316319
}
317320
}
318321

packages/types/src/project.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import { ContextState } from './context'
22
import { DOCXState } from './docx'
33
import { EditorState } from './editor'
44
import { PDFState } from './pdf'
5+
import { ShortcutsState } from './shortcuts'
56
import { ID } from './utils'
67

78
export type ProjectType = 'creative' | 'blank' | 'only-annotations'
@@ -208,6 +209,7 @@ export interface ProjectObject {
208209
editor: EditorState
209210
pdf: PDFState
210211
docx: DOCXState
212+
shortcuts: ShortcutsState
211213
}
212214

213215
export interface ProjectStateBetterWrite {

0 commit comments

Comments
 (0)