(reportId)
| 2800 | } |
| 2801 | |
| 2802 | async function deleteReportCard(reportId) { |
| 2803 | if (!reportId) return; |
| 2804 | const report = state.reports.find((item) => item.report_id === reportId) || state.currentReport || {}; |
| 2805 | const title = report.title || ui().reports.defaultTitle; |
| 2806 | const confirmText = responseLanguage() === "en" |
| 2807 | ? `Delete this local reading report?\n\n${title}` |
| 2808 | : `删除这个本地精读报告?\n\n${title}`; |
| 2809 | if (!window.confirm(confirmText)) return; |
| 2810 | await api("/api/reports/delete", { |
| 2811 | method: "POST", |
| 2812 | body: JSON.stringify({ report_id: reportId }) |
| 2813 | }); |
| 2814 | state.highlightedReports.delete(reportId); |
| 2815 | saveReportCardHighlights(); |
| 2816 | try { |
| 2817 | window.localStorage.removeItem(reportAnnotationKey(reportId)); |
| 2818 | } catch (error) { |
| 2819 | console.warn("Unable to clear deleted report annotation", error); |
| 2820 | } |
| 2821 | if (state.currentReport?.report_id === reportId) clearReportViewer(); |
| 2822 | showFeedbackToast("success", responseLanguage() === "en" ? "Report deleted" : "报告已删除", title); |
| 2823 | await refreshReports({ keepSelection: false }); |
| 2824 | } |
| 2825 | |
| 2826 | function loadReportAnnotation(reportId) { |
| 2827 | if (!reportId) return ""; |
no test coverage detected