🐛 Fixed hotkey service issues

This commit is contained in:
2025-08-19 00:08:50 +08:00
parent 873a3c0e60
commit 7b70a39b23
12 changed files with 348 additions and 51 deletions

View File

@@ -32,8 +32,8 @@ export function GetCurrentHotkey(): Promise<models$0.HotkeyCombo | null> & { can
/**
* Initialize 初始化热键服务
*/
export function Initialize(app: application$0.App | null): Promise<void> & { cancel(): void } {
let $resultPromise = $Call.ByID(3671360458, app) as any;
export function Initialize(app: application$0.App | null, mainWindow: application$0.WebviewWindow | null): Promise<void> & { cancel(): void } {
let $resultPromise = $Call.ByID(3671360458, app, mainWindow) as any;
return $resultPromise;
}

View File

@@ -214,7 +214,7 @@ const openInNewWindow = async (doc: Document, event: Event) => {
}
};
// 处理删除 - 简化确认机制
// 处理删除
const handleDelete = async (doc: Document, event: Event) => {
event.stopPropagation();
@@ -242,9 +242,13 @@ const handleDelete = async (doc: Document, event: Event) => {
return;
}
await documentStore.deleteDocument(doc.id);
await documentStore.updateDocuments();
const deleteSuccess = await documentStore.deleteDocument(doc.id);
if (!deleteSuccess) {
return;
}
await documentStore.updateDocuments();
// 如果删除的是当前文档,切换到第一个文档
if (documentStore.currentDocument?.id === doc.id && documentStore.documentList.length > 0) {
const firstDoc = documentStore.documentList[0];

View File

@@ -160,10 +160,12 @@ export const useDocumentStore = defineStore('document', () => {
try {
// 检查是否是默认文档使用ID判断
if (docId === SCRATCH_DOCUMENT_ID) {
console.log('Cannot delete default document (ID=1)');
return false;
}
await DocumentService.DeleteDocument(docId);
console.log('Backend delete successful for doc:', docId);
// 更新本地状态
delete documents.value[docId];