feat: 添加自定义对话模态框

This commit is contained in:
Baobhan Sith
2025-05-28 19:32:14 +08:00
parent ae88f6c66c
commit f022033b22
21 changed files with 438 additions and 69 deletions
@@ -233,6 +233,7 @@ import { useQuickCommandsStore, type QuickCommandFE, type QuickCommandSortByType
import { useQuickCommandTagsStore } from '../stores/quickCommandTags.store';
import { useUiNotificationsStore } from '../stores/uiNotifications.store';
import { useI18n } from 'vue-i18n';
import { useConfirmDialog } from '../composables/useConfirmDialog';
import AddEditQuickCommandForm from '../components/AddEditQuickCommandForm.vue';
import { useFocusSwitcherStore } from '../stores/focusSwitcher.store';
import { useSettingsStore } from '../stores/settings.store';
@@ -245,6 +246,7 @@ const quickCommandsStore = useQuickCommandsStore();
const quickCommandTagsStore = useQuickCommandTagsStore();
const uiNotificationsStore = useUiNotificationsStore();
const { t } = useI18n();
const { showConfirmDialog } = useConfirmDialog();
const focusSwitcherStore = useFocusSwitcherStore();
const settingsStore = useSettingsStore();
const emitWorkspaceEvent = useWorkspaceEventEmitter();
@@ -510,8 +512,11 @@ const closeForm = () => {
commandToEdit.value = null;
};
const confirmDelete = (command: QuickCommandFE) => {
if (window.confirm(t('quickCommands.confirmDelete', { name: command.name || command.command }))) {
const confirmDelete = async (command: QuickCommandFE) => {
const confirmed = await showConfirmDialog({
message: t('quickCommands.confirmDelete', { name: command.name || command.command })
});
if (confirmed) {
quickCommandsStore.deleteQuickCommand(command.id);
}
};