diff --git a/app/appearance/langs/de_DE.json b/app/appearance/langs/de_DE.json index 52772df65..126acd2b7 100644 --- a/app/appearance/langs/de_DE.json +++ b/app/appearance/langs/de_DE.json @@ -1,4 +1,5 @@ { + "workspaceData": "Arbeitsbereichsdaten", "confirmRemoveRelationField": "Sind Sie sicher, dass Sie das Feld, das mit ${x} verknüpft ist, löschen möchten?", "removeButKeepRelationField": "Entfernen, aber verknüpftes Feld behalten", "exportPDFLowMemory": "Nicht genügend verfügbarer Speicher, um dieses PDF zu exportieren, bitte reduzieren Sie den Inhalt oder erhöhen Sie den verfügbaren Speicher und versuchen Sie es erneut", @@ -855,7 +856,7 @@ "moveToBottomRight": "In die untere rechte Ecke verschieben", "accountDisplayTitle": "Das Titelsymbol anzeigen", "accountDisplayVIP": "Das VIP-Symbol anzeigen", - "rollbackConfirm": "Rollback-Operation kann nicht rückgängig gemacht werden, sind Sie sicher, dass Sie ${date} zurückrollen möchten?", + "rollbackConfirm": "Der Rollback-Vorgang kann nicht rückgängig gemacht werden, bitte gehen Sie vorsichtig vor. Sind Sie sicher, dass Sie ${name} auf ${time} zurücksetzen möchten?", "pdfTip": "PDF-Export unterstützt kein Dunkelthema", "pdfConfirm": "Möchten Sie mit dem ausgewählten Lichtthema weiter exportieren?", "import": "Importieren", diff --git a/app/appearance/langs/en_US.json b/app/appearance/langs/en_US.json index 7d8ffaa71..c35ab123e 100644 --- a/app/appearance/langs/en_US.json +++ b/app/appearance/langs/en_US.json @@ -1,4 +1,5 @@ { + "workspaceData": "Workspace data", "confirmRemoveRelationField": "Are you sure you want to delete the field associated with ${x}?", "removeButKeepRelationField": "Remove, but keep related field", "exportPDFLowMemory": "Insufficient available memory to export this PDF, please reduce the content or increase available memory and try exporting again", @@ -855,7 +856,7 @@ "moveToBottomRight": "Move to the Bottom Right", "accountDisplayTitle": "Display the title icon", "accountDisplayVIP": "Display the VIP icon", - "rollbackConfirm": "Rollback operation cannot be undone, are you sure you want to rollback ${date} ?", + "rollbackConfirm": "The rollback operation cannot be undone, please proceed with caution. Are you sure you want to roll back ${name} to ${time}?", "pdfTip": "PDF export does not support Dark theme", "pdfConfirm": "Do you want to continue exporting with the selected Light theme?", "import": "Import", diff --git a/app/appearance/langs/es_ES.json b/app/appearance/langs/es_ES.json index d38cde7f2..56308f6d6 100644 --- a/app/appearance/langs/es_ES.json +++ b/app/appearance/langs/es_ES.json @@ -1,4 +1,5 @@ { + "workspaceData": "Datos del espacio de trabajo", "confirmRemoveRelationField": "¿Está seguro de que desea eliminar el campo asociado a ${x}?", "removeButKeepRelationField": "Eliminar, pero mantener el campo relacionado", "exportPDFLowMemory": "Memoria disponible insuficiente para exportar este PDF, por favor reduzca el contenido o aumente la memoria disponible y vuelva a intentar exportar", @@ -855,7 +856,7 @@ "moveToBottomRight": "Mover a la parte inferior derecha", "accountDisplayTitle": "Mostrar el icono del título", "accountDisplayVIP": "Mostrar el icono VIP", - "rollbackConfirm": "La operación de retroceso no se puede deshacer, ¿estás seguro de que quieres revertir ${date} ?", + "rollbackConfirm": "La operación de reversión no se puede deshacer, por favor proceda con precaución. ¿Está seguro de que desea revertir ${name} a ${time}?", "pdfTip": "La exportación de PDF no es compatible con el tema oscuro", "pdfConfirm": "¿Desea seguir exportando con el tema Claro seleccionado?", "import": "Importar", diff --git a/app/appearance/langs/fr_FR.json b/app/appearance/langs/fr_FR.json index 154d7af33..9339c05d4 100644 --- a/app/appearance/langs/fr_FR.json +++ b/app/appearance/langs/fr_FR.json @@ -1,4 +1,5 @@ { + "workspaceData": "Données de l'espace de travail", "confirmRemoveRelationField": "Êtes-vous sûr de vouloir supprimer le champ associé à ${x}?", "removeButKeepRelationField": "Supprimer, mais conserver le champ associé", "exportPDFLowMemory": "Mémoire disponible insuffisante pour exporter ce PDF, veuillez réduire le contenu ou augmenter la mémoire disponible et réessayer d'exporter", @@ -855,7 +856,7 @@ "moveToBottomRight": "Déplacer vers la Bas à Droit", "accountDisplayTitle": "Afficher l'icône du titre", "accountDisplayVIP": "Afficher l'icône VIP", - "rollbackConfirm": "L'opération de retour en arrière est irréversible. Êtes-vous sûr de vouloir revenir en arrière à la date ${date} ?", + "rollbackConfirm": "L'opération de restauration ne peut pas être annulée, veuillez procéder avec prudence. Êtes-vous sûr de vouloir restaurer ${name} à ${time}?", "pdfTip": "L'exportation de PDF ne supporte pas le thème Dark", "pdfConfirm": "Voulez-vous continuer à exporter avec le thème clear sélectionné ?", "import": "Importer", diff --git a/app/appearance/langs/he_IL.json b/app/appearance/langs/he_IL.json index cbbb78a39..059d37802 100644 --- a/app/appearance/langs/he_IL.json +++ b/app/appearance/langs/he_IL.json @@ -1,4 +1,5 @@ { + "workspaceData": "נתוני סביבת עבודה", "confirmRemoveRelationField": "האם אתה בטוח שברצונך למחוק את השדה המשויך ל-${x}?", "removeButKeepRelationField": "מחק, אך שמור על שדה הקשר", "exportPDFLowMemory": "אין מספיק זיכרון זמין במערכת כדי לייצא את ה-PDF הזה, נא לצמצם את התוכן או להגדיל את הזיכרון הזמין ולנסות שוב לייצא", @@ -855,7 +856,7 @@ "moveToBottomRight": "העבר לפינה התחתונה הימנית", "accountDisplayTitle": "הצג את האייקון בכותרת", "accountDisplayVIP": "הצג את אייקון ה-VIP", - "rollbackConfirm": "פעולת החזרה לא ניתנת לביטול, האם אתה בטוח שברצונך לחזור ל${date}?", + "rollbackConfirm": "לא ניתן לבטל את פעולת השחזור, אנא היזהר בהחלטתך. האם אתה בטוח שברצונך לשחזר את ${name} ל-${time}?", "pdfTip": "ייצוא PDF אינו תומך בנושא כהה", "pdfConfirm": "האם תרצה להמשיך לייצא עם הנושא הנבחר האור?", "import": "ייבוא", diff --git a/app/appearance/langs/it_IT.json b/app/appearance/langs/it_IT.json index e799bbe5a..6727a4908 100644 --- a/app/appearance/langs/it_IT.json +++ b/app/appearance/langs/it_IT.json @@ -1,4 +1,5 @@ { + "workspaceData": "Dati dello spazio di lavoro", "confirmRemoveRelationField": "Sei sicuro di voler eliminare il campo associato a ${x}?", "removeButKeepRelationField": "Rimuovi, ma mantieni il campo correlato", "exportPDFLowMemory": "Memoria disponibile insufficiente per esportare questo PDF, riduci il contenuto o aumenta la memoria disponibile e riprova a esportare", @@ -855,7 +856,7 @@ "moveToBottomRight": "Sposta in basso a destra", "accountDisplayTitle": "Mostra l'icona del titolo", "accountDisplayVIP": "Mostra l'icona VIP", - "rollbackConfirm": "L'operazione di rollback non può essere annullata, sei sicuro di voler ripristinare a ${date}?", + "rollbackConfirm": "L'operazione di rollback non può essere annullata, si prega di procedere con cautela. Sei sicuro di voler ripristinare ${name} a ${time}?", "pdfTip": "L'esportazione PDF non supporta il tema scuro", "pdfConfirm": "Vuoi continuare l'esportazione con il tema chiaro selezionato?", "import": "Importa", diff --git a/app/appearance/langs/ja_JP.json b/app/appearance/langs/ja_JP.json index f8ecf62c9..deb45f616 100644 --- a/app/appearance/langs/ja_JP.json +++ b/app/appearance/langs/ja_JP.json @@ -1,4 +1,5 @@ { + "workspaceData": "ワークスペースデータ", "confirmRemoveRelationField": "${x} に関連するフィールドを同時に削除してもよろしいですか?", "removeButKeepRelationField": "削除して関連フィールドを保持", "exportPDFLowMemory": "システムの利用可能なメモリが不足しているため、この PDF をエクスポートできません。内容を減らすか、利用可能なメモリを増やしてから再試行してください", @@ -855,7 +856,7 @@ "moveToBottomRight": "右底", "accountDisplayTitle": "タイトルアイコンを表示", "accountDisplayVIP": "VIP アイコンを表示", - "rollbackConfirm": "ロールバック操作を取り消すことはできません。本当に ${date} をロールバックしてもよろしいですか?", + "rollbackConfirm": "ロールバック操作は元に戻せません。慎重に決定してください。${name}${time} にロールバックしてもよろしいですか?", "pdfTip": "PDF エクスポートはダークテーマに対応していません", "pdfConfirm": "選択したライトテーマでエクスポートを続行しますか?", "import": "インポート", diff --git a/app/appearance/langs/pl_PL.json b/app/appearance/langs/pl_PL.json index 261060978..34d340c59 100644 --- a/app/appearance/langs/pl_PL.json +++ b/app/appearance/langs/pl_PL.json @@ -1,4 +1,5 @@ { + "workspaceData": "Dane przestrzeni roboczej", "confirmRemoveRelationField": "Czy na pewno chcesz usunąć pole powiązane z ${x}?", "removeButKeepRelationField": "Usuń, ale zachowaj powiązane pole", "exportPDFLowMemory": "Za mało dostępnej pamięci, aby wyeksportować ten PDF, proszę zmniejszyć zawartość lub zwiększyć dostępną pamięć i spróbować ponownie", @@ -855,7 +856,7 @@ "moveToBottomRight": "Przenieś do dolnego prawego rogu", "accountDisplayTitle": "Wyświetl ikonę tytułu", "accountDisplayVIP": "Wyświetl ikonę VIP", - "rollbackConfirm": "Operacja wycofania nie może być cofnieta, czy na pewno chcesz cofnąć ${date}?", + "rollbackConfirm": "Operacja cofania nie może zostać anulowana, proszę zachować ostrożność. Czy na pewno chcesz cofnąć ${name} do ${time}?", "pdfTip": "Eksport PDF nie wspiera ciemnego motywu", "pdfConfirm": "Czy chcesz kontynuować eksport z wybranym jasnym motywem?", "import": "Importuj", diff --git a/app/appearance/langs/ru_RU.json b/app/appearance/langs/ru_RU.json index 4546cbe8d..483f65f6c 100644 --- a/app/appearance/langs/ru_RU.json +++ b/app/appearance/langs/ru_RU.json @@ -1,4 +1,5 @@ { + "workspaceData": "Данные рабочей области", "confirmRemoveRelationField": "Вы уверены, что хотите удалить поле, связанное с ${x}?", "removeButKeepRelationField": "Удалить, но сохранить связанное поле", "exportPDFLowMemory": "Недостаточно доступной памяти для экспорта этого PDF, пожалуйста, уменьшите содержимое или увеличьте доступную память и повторите попытку экспорта", @@ -855,7 +856,7 @@ "moveToBottomRight": "Переместить в нижний правый угол", "accountDisplayTitle": "Отобразить значок заголовка", "accountDisplayVIP": "Отобразить VIP-значок", - "rollbackConfirm": "Операция отката не может быть отменена, вы уверены, что хотите откатить ${date}?", + "rollbackConfirm": "Операция отката не может быть отменена, пожалуйста, будьте осторожны. Вы уверены, что хотите откатить ${name} к ${time}?", "pdfTip": "Экспорт PDF не поддерживает темную тему", "pdfConfirm": "Вы хотите продолжить экспорт с выбранной светлой темой?", "import": "Импортировать", diff --git a/app/appearance/langs/zh_CHT.json b/app/appearance/langs/zh_CHT.json index c6c916072..7edbc7e08 100644 --- a/app/appearance/langs/zh_CHT.json +++ b/app/appearance/langs/zh_CHT.json @@ -1,4 +1,5 @@ { + "workspaceData": "工作空間數據", "confirmRemoveRelationField": "確定同時刪除關聯至 ${x} 中的字段嗎?", "removeButKeepRelationField": "刪除,但保留關聯字段", "exportPDFLowMemory": "系統可用記憶體不足,無法導出該 PDF,請減少內容或者增加可用記憶體後再嘗試導出", @@ -855,7 +856,7 @@ "moveToBottomRight": "移動到下側右方", "accountDisplayTitle": "首欄顯示頭銜", "accountDisplayVIP": "首欄顯示 VIP", - "rollbackConfirm": "回復操作無法撤銷,確定要將 ${date} 回復嗎?", + "rollbackConfirm": "回滾操作無法撤銷,請謹慎決定。確定要將 ${name} 回滾到 ${time} 嗎?", "pdfTip": "PDF 匯出不支援深色主題", "pdfConfirm": "是否使用已選擇的淺色主題繼續匯出?", "import": "導入", diff --git a/app/appearance/langs/zh_CN.json b/app/appearance/langs/zh_CN.json index eeecea70e..99a546c06 100644 --- a/app/appearance/langs/zh_CN.json +++ b/app/appearance/langs/zh_CN.json @@ -1,4 +1,5 @@ { + "workspaceData": "工作空间数据", "confirmRemoveRelationField": "确定同时删除关联至 ${x} 中的字段吗?", "removeButKeepRelationField": "删除,但保留关联字段", "exportPDFLowMemory": "系统可用内存不足,无法导出该 PDF,请减少内容或者增加可用内存后再尝试导出", @@ -855,7 +856,7 @@ "moveToBottomRight": "移动到下侧右方", "accountDisplayTitle": "顶栏显示头衔", "accountDisplayVIP": "顶栏显示 VIP", - "rollbackConfirm": "回滚操作无法撤销,确定要将 ${date} 回滚吗?", + "rollbackConfirm": "回滚操作无法撤销,请谨慎决定。确定要将 ${name} 回滚到 ${time} 吗?", "pdfTip": "PDF 导出不支持深色主题", "pdfConfirm": "是否使用已选择的浅色主题继续导出?", "import": "导入", diff --git a/app/src/history/doc.ts b/app/src/history/doc.ts index 0df93c922..4c3be571d 100644 --- a/app/src/history/doc.ts +++ b/app/src/history/doc.ts @@ -130,9 +130,12 @@ export const openDocHistory = (options: { if (type === "close") { dialog.destroy(); } else if (type === "rollback" && !isLoading) { - getHistoryPath(target.parentElement, opElement.value, options.id, (dataPath) => { + getHistoryPath(target.parentElement, opElement.value, options.id, (item) => { + let dataPath = item.path; isLoading = false; - confirmDialog("⚠️ " + window.siyuan.languages.rollback, `${window.siyuan.languages.rollbackConfirm.replace("${date}", target.parentElement.textContent.trim())}`, () => { + let confirmTip = window.siyuan.languages.rollbackConfirm.replace("${name}", item.title) + .replace("${time}", target.previousElementSibling.previousElementSibling.textContent.trim()); + confirmDialog("⚠️ " + window.siyuan.languages.rollback, confirmTip, () => { fetchPost("/api/history/rollbackDocHistory", { notebook: options.notebookId, historyPath: dataPath @@ -143,7 +146,8 @@ export const openDocHistory = (options: { event.preventDefault(); break; } else if (target.classList.contains("b3-list-item") && !isLoading) { - getHistoryPath(target, opElement.value, options.id, (dataPath) => { + getHistoryPath(target, opElement.value, options.id, (item) => { + let dataPath = item.path; fetchPost("/api/history/getDocHistoryContent", { historyPath: dataPath, }, (response) => { @@ -180,7 +184,7 @@ export const openDocHistory = (options: { }); }; -const getHistoryPath = (target: Element, op: string, id: string, cb: (path: string) => void) => { +const getHistoryPath = (target: Element, op: string, id: string, cb: (item: any) => void) => { isLoading = true; const path = target.getAttribute("data-path"); if (path) { @@ -194,6 +198,6 @@ const getHistoryPath = (target: Element, op: string, id: string, cb: (path: stri type: 3, created }, (response) => { - cb(response.data.items[0].path); + cb(response.data.items[0]); }); }; diff --git a/app/src/history/history.ts b/app/src/history/history.ts index 3e40e1535..25c25f7b2 100644 --- a/app/src/history/history.ts +++ b/app/src/history/history.ts @@ -1,19 +1,19 @@ -import { Dialog } from "../dialog"; -import { confirmDialog } from "../dialog/confirmDialog"; -import { Constants } from "../constants"; -import { hasClosestByClassName } from "../protyle/util/hasClosest"; -import { renderAssetsPreview } from "../asset/renderAssets"; -import { Protyle } from "../protyle"; -import { disabledProtyle, onGet } from "../protyle/util/onGet"; +import {Dialog} from "../dialog"; +import {confirmDialog} from "../dialog/confirmDialog"; +import {Constants} from "../constants"; +import {hasClosestByClassName} from "../protyle/util/hasClosest"; +import {renderAssetsPreview} from "../asset/renderAssets"; +import {Protyle} from "../protyle"; +import {disabledProtyle, onGet} from "../protyle/util/onGet"; import * as dayjs from "dayjs"; -import { fetchPost } from "../util/fetch"; -import { escapeAttr, escapeHtml } from "../util/escape"; -import { isMobile } from "../util/functions"; -import { showDiff } from "./diff"; -import { setStorageVal } from "../protyle/util/compatibility"; -import { openModel } from "../mobile/menu/model"; -import { closeModel } from "../mobile/util/closePanel"; -import { App } from "../index"; +import {fetchPost} from "../util/fetch"; +import {escapeAttr, escapeHtml} from "../util/escape"; +import {isMobile} from "../util/functions"; +import {showDiff} from "./diff"; +import {setStorageVal} from "../protyle/util/compatibility"; +import {openModel} from "../mobile/menu/model"; +import {closeModel} from "../mobile/util/closePanel"; +import {App} from "../index"; let historyEditor: Protyle; @@ -530,8 +530,18 @@ const bindEvent = (app: App, element: Element, dialog?: Dialog) => { event.preventDefault(); break; } else if (target.classList.contains("b3-list-item__action") && type === "rollback" && !window.siyuan.config.readonly) { - confirmDialog("⚠️ " + window.siyuan.languages.rollback, `${window.siyuan.languages.rollbackConfirm.replace("${date}", target.parentElement.textContent.trim())}`, () => { - const dataType = target.parentElement.getAttribute("data-type"); + const dataType = target.parentElement.getAttribute("data-type"); + let name = target.previousElementSibling.previousElementSibling.textContent.trim(); + let time = dayjs(parseInt(target.parentElement.getAttribute("data-created")) * 1000).format("YYYY-MM-DD HH:mm:ss"); + if (dataType === "notebook") { + time = target.parentElement.parentElement.previousElementSibling.textContent.trim(); + } else if (dataType === "repoitem") { + name = window.siyuan.languages.workspaceData; + time = target.parentElement.querySelector("span[data-type='hCreated']").textContent.trim(); + } + let confirmTip = window.siyuan.languages.rollbackConfirm.replace("${name}", name) + .replace("${time}", time); + confirmDialog("⚠️ " + window.siyuan.languages.rollback, confirmTip, () => { if (dataType === "assets") { fetchPost("/api/history/rollbackAssetsHistory", { historyPath: target.parentElement.getAttribute("data-path")