Skip to content

Commit

Permalink
feat(Save Dialogs): enter key triggers save
Browse files Browse the repository at this point in the history
  • Loading branch information
PaulHax committed Dec 29, 2023
1 parent e40529f commit cb5791e
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/components/SaveSegmentGroupDialog.vue
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ import { onMounted, ref } from 'vue';
import { saveAs } from 'file-saver';
import { useSegmentGroupStore } from '@/src/store/segmentGroups';
import { writeImage } from '@/src/io/readWriteImage';
import { onKeyDown } from '@vueuse/core';
const EXTENSIONS = [
'dcm',
Expand All @@ -57,7 +58,7 @@ const EXTENSIONS = [
];
const props = defineProps<{
close: () => undefined;
close: () => void;
id: string;
}>();
const fileName = ref('');
Expand Down Expand Up @@ -87,6 +88,10 @@ onMounted(() => {
fileName.value = segmentGroupStore.metadataByID[props.id].name;
});
onKeyDown('Enter', () => {
saveSegmentGroup();
});
function validFileName(name: string) {
return name.trim().length > 0 || 'Required';
}
Expand Down
5 changes: 5 additions & 0 deletions src/components/SaveSession.vue
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
<script lang="ts">
import { defineComponent, onMounted, ref } from 'vue';
import { saveAs } from 'file-saver';
import { onKeyDown } from '@vueuse/core';
import { serialize } from '../io/state-file';
Expand Down Expand Up @@ -68,6 +69,10 @@ export default defineComponent({
fileName.value = DEFAULT_FILENAME;
});
onKeyDown('Enter', () => {
saveSession();
});
function validFileName(name: string) {
return name.trim().length > 0 || 'Required';
}
Expand Down

0 comments on commit cb5791e

Please sign in to comment.