@@ -461,10 +461,6 @@ const performImport = async (file: File, target: HTMLInputElement) => {
461461 await snippetApi .delete (snippet .id );
462462 }
463463 }
464-
465- toast .success (
466- t (" settings.clearedExistingSnippets" , { count: existingCount })
467- );
468464 }
469465
470466 // 导入新的代码片段,只使用必要的字段
@@ -482,6 +478,13 @@ const performImport = async (file: File, target: HTMLInputElement) => {
482478 // 重新加载数据统计
483479 await loadDataStatistics ();
484480
481+ // 触发数据刷新事件,通知首页更新数据
482+ window .dispatchEvent (
483+ new CustomEvent (" seekcode:data-refresh" , {
484+ detail: { type: " snippets" },
485+ })
486+ );
487+
485488 // 显示成功通知
486489 if (clearExistingData .value ) {
487490 toast .success (
@@ -533,13 +536,10 @@ const saveClipboardSettings = async () => {
533536// 清空剪贴板数据
534537const clearClipboardData = async () => {
535538 // 使用 Tauri 的确认对话框
536- const confirmed = await confirm (
537- " 确定要清空所有剪贴板数据吗?此操作不可恢复。" ,
538- {
539- title: " 清空剪贴板数据" ,
540- kind: " warning" ,
541- }
542- );
539+ const confirmed = await confirm (t (" settings.confirmClearClipboardData" ), {
540+ title: t (" settings.confirmClearClipboardDataTitle" ),
541+ kind: " warning" ,
542+ });
543543
544544 // 如果用户取消,直接返回,不执行任何操作
545545 if (! confirmed ) {
@@ -552,6 +552,14 @@ const clearClipboardData = async () => {
552552 // 清空剪贴板数据
553553 await clipboardApi .clear ();
554554 toast .success (t (" settings.clipboardDataCleared" ));
555+
556+ // 触发数据刷新事件,通知首页更新剪贴板数据
557+ window .dispatchEvent (
558+ new CustomEvent (" seekcode:data-refresh" , {
559+ detail: { type: " clipboard" },
560+ })
561+ );
562+
555563 // 重新加载数据统计
556564 await loadDataStatistics ();
557565 } catch (error ) {
0 commit comments