dsh-gallery 1.4.2 → 1.6.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +247 -0
- package/README.md +49 -8
- package/client.js +924 -24
- package/host/constants.js +14 -0
- package/host/context.js +33 -0
- package/host/frames.js +26 -0
- package/host/groups.js +128 -33
- package/host/http.js +584 -47
- package/host/manifest.js +400 -0
- package/host/scan.js +223 -22
- package/host/session-index.js +22 -4
- package/host/settings.js +4 -0
- package/host/tools.js +206 -2
- package/host/trash.js +324 -0
- package/index.js +20 -0
- package/package.json +1 -1
package/client.js
CHANGED
|
@@ -1046,6 +1046,11 @@ async function encodeMaskPngBytes(imageData, width, height) {
|
|
|
1046
1046
|
groupInput: '素材 {n}',
|
|
1047
1047
|
groupIntermediate: '过程稿 {n}',
|
|
1048
1048
|
groupUnknown: '未归类 {n}',
|
|
1049
|
+
// v1.6.4:跨对话共用 —— 同一个文件被多个对话引用(不合并、不去重,只标归属)
|
|
1050
|
+
groupShared: '共用 {n}',
|
|
1051
|
+
groupSharedTip: '这 {n} 张是同一个文件,{who} 也在用。在任一对话里删除或隐藏,两边会一起生效;同名但不同路径的两份文件互不影响。',
|
|
1052
|
+
sharedWithSome: '其他对话',
|
|
1053
|
+
sharedWithMany: '{first} 等 {n} 个对话',
|
|
1049
1054
|
groupTruncated: '仅显示最近 {shown} 个,共 {total} 个',
|
|
1050
1055
|
groupShowMore: '再显示 {step} 张 · 已显示 {shown} / 共 {total}',
|
|
1051
1056
|
groupHistoryTitle: '历史资产',
|
|
@@ -1124,9 +1129,9 @@ async function encodeMaskPngBytes(imageData, width, height) {
|
|
|
1124
1129
|
ctxCopy: '写进输入框',
|
|
1125
1130
|
ctxDelete: '删除文件',
|
|
1126
1131
|
ctxDeleteSelected: '删除选中的 {n} 个文件',
|
|
1127
|
-
ctxDeleteManyTitle: '
|
|
1132
|
+
ctxDeleteManyTitle: '把 {n} 个文件移到回收区?可撤销',
|
|
1128
1133
|
ctxDeleteManySummary: '共 {n} 个文件',
|
|
1129
|
-
ctxDeletePartial: '
|
|
1134
|
+
ctxDeletePartial: '已移到回收区 {n} 个,{fail} 个失败',
|
|
1130
1135
|
batchDeleteSelected: '删除所选',
|
|
1131
1136
|
batchDeleteHint: '删除选中的全部文件(会二次确认,不可恢复)',
|
|
1132
1137
|
// 2026-11-25 按标签圈选:把某一类下的文件一次选中,再交给批量动作
|
|
@@ -1140,8 +1145,8 @@ async function encodeMaskPngBytes(imageData, width, height) {
|
|
|
1140
1145
|
batchInvertHint: '选中当前列表里还没选中的文件',
|
|
1141
1146
|
ctxCopyFileSelected: '复制选中的 {n} 个文件',
|
|
1142
1147
|
labelEditSelected: '改这 {n} 张的标签',
|
|
1143
|
-
ctxDeleteConfirm: '
|
|
1144
|
-
ctxDeleteYes: '
|
|
1148
|
+
ctxDeleteConfirm: '移到回收区?可撤销(Ctrl+Z)',
|
|
1149
|
+
ctxDeleteYes: '移到回收区',
|
|
1145
1150
|
ctxDeleteNo: '取消',
|
|
1146
1151
|
// 批注删除按钮的 title 与卡片删除共用 t('delete')
|
|
1147
1152
|
delete: '删除',
|
|
@@ -1270,6 +1275,18 @@ async function encodeMaskPngBytes(imageData, width, height) {
|
|
|
1270
1275
|
hiddenCount: '已隐藏 {count} 个',
|
|
1271
1276
|
hiddenClear: '全部恢复',
|
|
1272
1277
|
hiddenClearing: '恢复中…',
|
|
1278
|
+
// v1.5.0 隐私:本地登记说明与清空入口
|
|
1279
|
+
privacyLabel: '本地登记(隐私)',
|
|
1280
|
+
privacyHint: '下面这些文件在 ~/.dsh/ 下,明文保存,从不外发',
|
|
1281
|
+
privacyClearContext: '清空浏览记录',
|
|
1282
|
+
privacyClearContextHint: '删掉「你看过哪几张图」的记录;不影响标签、遮罩、反馈',
|
|
1283
|
+
privacyClearAnnotations: '清空全部标注',
|
|
1284
|
+
privacyClearAnnotationsHint: '删掉手动标签、截帧登记、反馈与判定标记;需要点两次确认,不可恢复',
|
|
1285
|
+
privacyClearAnnotationsConfirm: '确认清空?(再点一次)',
|
|
1286
|
+
privacyArmHint: '再点一次才会真的删;点这一下什么都没动',
|
|
1287
|
+
privacyClearing: '正在清空…',
|
|
1288
|
+
privacyCleared: '已清空 {n} 条本地登记',
|
|
1289
|
+
privacyClearFailed: '清空失败:{message}',
|
|
1273
1290
|
hiddenClearHint: '让所有被隐藏的文件重新出现在列表里(不会删除文件)',
|
|
1274
1291
|
hiddenCleared: '已全部恢复',
|
|
1275
1292
|
hiddenMore: '还有 {count} 个未显示',
|
|
@@ -1278,6 +1295,9 @@ async function encodeMaskPngBytes(imageData, width, height) {
|
|
|
1278
1295
|
thumbFailed: '无法加载',
|
|
1279
1296
|
dims: '{w} × {h}',
|
|
1280
1297
|
dimsUnknown: '尺寸未知',
|
|
1298
|
+
// v1.6.3:同一视图里的同名文件(不是重复,是两份不同目录的真文件)
|
|
1299
|
+
sameNameIn: '同名 {n} 份 · {dir}',
|
|
1300
|
+
rootDir: '根目录',
|
|
1281
1301
|
close: '关闭',
|
|
1282
1302
|
prev: '上一张',
|
|
1283
1303
|
next: '下一张',
|
|
@@ -1300,6 +1320,55 @@ async function encodeMaskPngBytes(imageData, width, height) {
|
|
|
1300
1320
|
ctxCopyFileHint: '把该文件写入系统剪贴板,可在别的对话或资源管理器里粘贴',
|
|
1301
1321
|
batchCopyFiles: '复制所选文件',
|
|
1302
1322
|
batchCopyHint: '把选中的文件写入系统剪贴板,可在别的对话或资源管理器里粘贴',
|
|
1323
|
+
// v1.5.0 导出交付清单:CSV 进 Excel、JSON 给下一轮,落在 ~/.dsh/gallery-exports/
|
|
1324
|
+
batchExportManifest: '导出清单',
|
|
1325
|
+
batchExportHint: '把选中的这批导出成交付清单(CSV 给 Excel 看、JSON 给下一轮读),存到 ~/.dsh/gallery-exports/;同名不覆盖',
|
|
1326
|
+
exportOk: '已导出 {n} 条:{name}',
|
|
1327
|
+
exportEmpty: '这批没有可导出的文件(可能还没打分类)',
|
|
1328
|
+
exportFailed: '导出清单失败:{message}',
|
|
1329
|
+
// v1.6.0:清单落盘后给三个便捷出口(打开文件夹 / 复制路径 / 写进输入框)
|
|
1330
|
+
exportOpenDir: '打开文件夹',
|
|
1331
|
+
exportCopyPath: '复制路径',
|
|
1332
|
+
exportToComposer: '写进输入框',
|
|
1333
|
+
// v1.6.2:导出记录(常驻,事后照样能再引用一次)
|
|
1334
|
+
exportHistoryEntry: '导出记录',
|
|
1335
|
+
exportHistoryOpen: '导出记录',
|
|
1336
|
+
exportHistoryTitle: '导出记录',
|
|
1337
|
+
exportHistoryHint: '以前导出的交付清单都在这;点「写进输入框」就能把这批清单再递给助手',
|
|
1338
|
+
exportHistoryEmpty: '还没有导出过清单',
|
|
1339
|
+
exportHistoryLoading: '读取中…',
|
|
1340
|
+
exportHistoryFailed: '读不到导出记录:{message}',
|
|
1341
|
+
exportHistorySource: '来源',
|
|
1342
|
+
exportHistoryCount: '{n} 条',
|
|
1343
|
+
exportHistoryMissing: '文件已不在(可能被移走或删了)',
|
|
1344
|
+
exportHistoryRefresh: '刷新',
|
|
1345
|
+
exportHistoryLegacy: '早期导出',
|
|
1346
|
+
exportHistoryGlobal: '全局资产',
|
|
1347
|
+
exportHistoryUnknownSource: '未记录来源',
|
|
1348
|
+
exportPathCopied: '清单路径已复制到剪贴板',
|
|
1349
|
+
exportPathCopyFailed: '复制路径失败,请手动选中提示里的路径',
|
|
1350
|
+
exportOpenFailed: '打不开导出文件夹:{message}',
|
|
1351
|
+
exportDraftReady: '清单路径已写进输入框(只写不发)',
|
|
1352
|
+
exportDraftInClipboard: '写不进输入框,路径已放剪贴板',
|
|
1353
|
+
// v1.6.0 撤销(Ctrl+Z):删除移到回收区、隐藏取消隐藏,两类都能撤
|
|
1354
|
+
undoAction: '撤销 (Ctrl+Z)',
|
|
1355
|
+
undoNothing: '没有可撤销的操作',
|
|
1356
|
+
whereGlobal: '全局资产',
|
|
1357
|
+
whereSession: '当前对话',
|
|
1358
|
+
// v1.6.2:撤销提示要能看出「是哪个对话、哪一类」——
|
|
1359
|
+
// 老板切了几个对话后,只写「当前对话」等于没说。
|
|
1360
|
+
whereSessionNamed: '对话「{name}」',
|
|
1361
|
+
kindImage: '图片',
|
|
1362
|
+
kindFile: '文件',
|
|
1363
|
+
kindMedia: '音视频',
|
|
1364
|
+
undoOtherScope: '这里没有可撤销的操作;最近一批在「{where}」的{kind}里,切过去再按 Ctrl+Z',
|
|
1365
|
+
undoDeleteOk: '已移到回收区:{n} 个文件(按 Ctrl+Z 可撤回)',
|
|
1366
|
+
undoHideOk: '已隐藏 {n} 个文件(按 Ctrl+Z 可撤回)',
|
|
1367
|
+
undoDeleteDone: '已撤销:{n} 个文件回到原位({where} · {kind})',
|
|
1368
|
+
undoDeletePartial: '撤销完成 {n} 个;{fail} 个失败、{conflict} 个原位已有同名文件(未覆盖)',
|
|
1369
|
+
undoDeleteNone: '没能撤回来:这批可能已过保留期被清理',
|
|
1370
|
+
undoHideDone: '已撤销隐藏:{n} 个文件回到列表({where} · {kind})',
|
|
1371
|
+
undoFailed: '撤销失败:{message}',
|
|
1303
1372
|
copyOk: '已复制 {n} 个文件到剪贴板;切到目标对话后右键「粘贴」或按 Ctrl+V',
|
|
1304
1373
|
copyOkInternal: '已复制 {n} 个文件(系统剪贴板不可用,仅插件内粘贴有效)',
|
|
1305
1374
|
copyFailed: '复制失败:{message}',
|
|
@@ -1498,6 +1567,11 @@ async function encodeMaskPngBytes(imageData, width, height) {
|
|
|
1498
1567
|
groupInput: 'Source {n}',
|
|
1499
1568
|
groupIntermediate: 'WIP {n}',
|
|
1500
1569
|
groupUnknown: 'Unclassified {n}',
|
|
1570
|
+
// v1.6.4: assets referenced by more than one chat (kept in both, labelled)
|
|
1571
|
+
groupShared: 'Shared {n}',
|
|
1572
|
+
groupSharedTip: '{n} of these are the same file(s) {who} also uses. Deleting or hiding in one place affects both; same-name files in different folders stay independent.',
|
|
1573
|
+
sharedWithSome: 'other chats',
|
|
1574
|
+
sharedWithMany: '{first} and {n} chats',
|
|
1501
1575
|
groupTruncated: 'Showing latest {shown} of {total}',
|
|
1502
1576
|
groupShowMore: 'Show {step} more · {shown} of {total}',
|
|
1503
1577
|
groupHistoryTitle: 'Older assets',
|
|
@@ -1575,9 +1649,9 @@ async function encodeMaskPngBytes(imageData, width, height) {
|
|
|
1575
1649
|
ctxCopy: 'Write into chat input',
|
|
1576
1650
|
ctxDelete: 'Delete file',
|
|
1577
1651
|
ctxDeleteSelected: 'Delete {n} selected files',
|
|
1578
|
-
ctxDeleteManyTitle: '
|
|
1652
|
+
ctxDeleteManyTitle: 'Move {n} files to Trash? This can be undone',
|
|
1579
1653
|
ctxDeleteManySummary: '{n} files',
|
|
1580
|
-
ctxDeletePartial: '
|
|
1654
|
+
ctxDeletePartial: 'Moved {n} to Trash, {fail} failed',
|
|
1581
1655
|
batchDeleteSelected: 'Delete selected',
|
|
1582
1656
|
batchDeleteHint: 'Delete every selected file (asks for confirmation, cannot be undone)',
|
|
1583
1657
|
legendPick: 'Pick',
|
|
@@ -1590,8 +1664,8 @@ async function encodeMaskPngBytes(imageData, width, height) {
|
|
|
1590
1664
|
batchInvertHint: 'Select the files in the current list that are not selected yet',
|
|
1591
1665
|
ctxCopyFileSelected: 'Copy {n} selected files',
|
|
1592
1666
|
labelEditSelected: 'Re-label these {n} files',
|
|
1593
|
-
ctxDeleteConfirm: '
|
|
1594
|
-
ctxDeleteYes: '
|
|
1667
|
+
ctxDeleteConfirm: 'Move to Trash? You can undo with Ctrl+Z',
|
|
1668
|
+
ctxDeleteYes: 'Move to Trash',
|
|
1595
1669
|
ctxDeleteNo: 'Cancel',
|
|
1596
1670
|
delete: 'Delete',
|
|
1597
1671
|
ctxHiddenDone: 'Hidden. Restore it in settings later.',
|
|
@@ -1716,6 +1790,17 @@ async function encodeMaskPngBytes(imageData, width, height) {
|
|
|
1716
1790
|
hiddenCount: '{count} hidden',
|
|
1717
1791
|
hiddenClear: 'Restore all',
|
|
1718
1792
|
hiddenClearing: 'Restoring…',
|
|
1793
|
+
privacyLabel: 'Local records (privacy)',
|
|
1794
|
+
privacyHint: 'These files live under ~/.dsh/ in plain text and are never sent anywhere',
|
|
1795
|
+
privacyClearContext: 'Clear view history',
|
|
1796
|
+
privacyClearContextHint: 'Delete the "which images you opened" record; tags, masks and feedback stay',
|
|
1797
|
+
privacyClearAnnotations: 'Clear all annotations',
|
|
1798
|
+
privacyClearAnnotationsHint: 'Delete manual labels, frame records, feedback and marks; two clicks required, cannot be undone',
|
|
1799
|
+
privacyClearAnnotationsConfirm: 'Confirm clear? (click again)',
|
|
1800
|
+
privacyArmHint: 'Nothing has been deleted yet — click again to confirm',
|
|
1801
|
+
privacyClearing: 'Clearing…',
|
|
1802
|
+
privacyCleared: 'Cleared {n} local records',
|
|
1803
|
+
privacyClearFailed: 'Clear failed: {message}',
|
|
1719
1804
|
hiddenClearHint: 'Show all hidden files again (files are not deleted)',
|
|
1720
1805
|
hiddenCleared: 'All restored',
|
|
1721
1806
|
hiddenMore: '{count} more not shown',
|
|
@@ -1724,6 +1809,8 @@ async function encodeMaskPngBytes(imageData, width, height) {
|
|
|
1724
1809
|
thumbFailed: 'Cannot load',
|
|
1725
1810
|
dims: '{w} × {h}',
|
|
1726
1811
|
dimsUnknown: 'Size unknown',
|
|
1812
|
+
sameNameIn: '{n} with the same name · {dir}',
|
|
1813
|
+
rootDir: 'root folder',
|
|
1727
1814
|
close: 'Close',
|
|
1728
1815
|
prev: 'Previous',
|
|
1729
1816
|
next: 'Next',
|
|
@@ -1746,6 +1833,49 @@ async function encodeMaskPngBytes(imageData, width, height) {
|
|
|
1746
1833
|
ctxCopyFileHint: 'Write this file to the system clipboard; paste it in another chat or Explorer',
|
|
1747
1834
|
batchCopyFiles: 'Copy selected files',
|
|
1748
1835
|
batchCopyHint: 'Write the selected files to the system clipboard; paste them in another chat or Explorer',
|
|
1836
|
+
batchExportManifest: 'Export list',
|
|
1837
|
+
batchExportHint: 'Export the selection as a delivery list (CSV for Excel, JSON for the next round) into ~/.dsh/gallery-exports/; existing files are never overwritten',
|
|
1838
|
+
exportOk: 'Exported {n} items: {name}',
|
|
1839
|
+
exportEmpty: 'Nothing exportable in this batch (maybe no category yet)',
|
|
1840
|
+
exportFailed: 'Export failed: {message}',
|
|
1841
|
+
exportOpenDir: 'Open folder',
|
|
1842
|
+
exportCopyPath: 'Copy path',
|
|
1843
|
+
exportToComposer: 'Write to input',
|
|
1844
|
+
exportHistoryEntry: 'Export history',
|
|
1845
|
+
exportHistoryOpen: 'Export history',
|
|
1846
|
+
exportHistoryTitle: 'Export history',
|
|
1847
|
+
exportHistoryHint: 'Every delivery list you exported is listed here; "Write to input" hands the path to the assistant again',
|
|
1848
|
+
exportHistoryEmpty: 'No lists exported yet',
|
|
1849
|
+
exportHistoryLoading: 'Loading…',
|
|
1850
|
+
exportHistoryFailed: 'Could not read the export history: {message}',
|
|
1851
|
+
exportHistorySource: 'Source',
|
|
1852
|
+
exportHistoryCount: '{n} items',
|
|
1853
|
+
exportHistoryMissing: 'File is gone (moved or deleted)',
|
|
1854
|
+
exportHistoryRefresh: 'Refresh',
|
|
1855
|
+
exportHistoryLegacy: 'Earlier export',
|
|
1856
|
+
exportHistoryGlobal: 'All assets',
|
|
1857
|
+
exportHistoryUnknownSource: 'Source not recorded',
|
|
1858
|
+
exportPathCopied: 'List path copied to clipboard',
|
|
1859
|
+
exportPathCopyFailed: 'Copy failed — select the path in the notice manually',
|
|
1860
|
+
exportOpenFailed: 'Could not open the export folder: {message}',
|
|
1861
|
+
exportDraftReady: 'List path written to the input box (written, not sent)',
|
|
1862
|
+
exportDraftInClipboard: 'Could not write to the input box; path is on the clipboard',
|
|
1863
|
+
undoAction: 'Undo (Ctrl+Z)',
|
|
1864
|
+
undoNothing: 'Nothing to undo',
|
|
1865
|
+
whereGlobal: 'All assets',
|
|
1866
|
+
whereSession: 'This chat',
|
|
1867
|
+
whereSessionNamed: 'chat "{name}"',
|
|
1868
|
+
kindImage: 'images',
|
|
1869
|
+
kindFile: 'files',
|
|
1870
|
+
kindMedia: 'media',
|
|
1871
|
+
undoOtherScope: 'Nothing to undo here; the latest batch was in {kind} of "{where}" — switch there and press Ctrl+Z',
|
|
1872
|
+
undoDeleteOk: 'Moved {n} file(s) to Trash (press Ctrl+Z to undo)',
|
|
1873
|
+
undoHideOk: 'Hidden {n} file(s) (press Ctrl+Z to undo)',
|
|
1874
|
+
undoDeleteDone: 'Undone: {n} file(s) restored ({where} · {kind})',
|
|
1875
|
+
undoDeletePartial: 'Restored {n}; {fail} failed, {conflict} already exist at the original path (not overwritten)',
|
|
1876
|
+
undoDeleteNone: 'Nothing could be restored — this batch may have passed its retention window',
|
|
1877
|
+
undoHideDone: 'Undone: {n} file(s) shown again ({where} · {kind})',
|
|
1878
|
+
undoFailed: 'Undo failed: {message}',
|
|
1749
1879
|
copyOk: 'Copied {n} file(s) to the clipboard; right-click "Paste" or press Ctrl+V in the target chat',
|
|
1750
1880
|
copyOkInternal: 'Copied {n} file(s) (system clipboard unavailable; in-plugin paste only)',
|
|
1751
1881
|
copyFailed: 'Copy failed: {message}',
|
|
@@ -2669,6 +2799,23 @@ async function encodeMaskPngBytes(imageData, width, height) {
|
|
|
2669
2799
|
white-space: nowrap;
|
|
2670
2800
|
}
|
|
2671
2801
|
.dg-groupChips { display: inline-flex; gap: 5px; flex: 0 0 auto; }
|
|
2802
|
+
/**
|
|
2803
|
+
* v1.6.4:组头「共用 N」—— 同一个文件同时被别的对话引用。
|
|
2804
|
+
* 虚线框 + 琥珀色,刻意与分类 chips(绿/橙/灰实心)区分:它不是分类,是归属提示。
|
|
2805
|
+
*/
|
|
2806
|
+
.dg-groupShared {
|
|
2807
|
+
flex: 0 0 auto;
|
|
2808
|
+
margin-left: 2px;
|
|
2809
|
+
padding: 1px 6px;
|
|
2810
|
+
border-radius: 9px;
|
|
2811
|
+
border: 1px dashed rgba(208, 139, 22, 0.55);
|
|
2812
|
+
font-size: 10px;
|
|
2813
|
+
font-weight: 600;
|
|
2814
|
+
line-height: 1.6;
|
|
2815
|
+
color: #D08B16;
|
|
2816
|
+
white-space: nowrap;
|
|
2817
|
+
cursor: help;
|
|
2818
|
+
}
|
|
2672
2819
|
.dg-chip {
|
|
2673
2820
|
padding: 1px 7px;
|
|
2674
2821
|
border-radius: 9px;
|
|
@@ -2726,6 +2873,15 @@ async function encodeMaskPngBytes(imageData, width, height) {
|
|
|
2726
2873
|
.dg-meta { padding: 6px 8px 8px; display: flex; flex-direction: column; gap: 2px; min-width: 0; }
|
|
2727
2874
|
.dg-name { font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
|
|
2728
2875
|
.dg-dim { font-size: 11px; color: var(--dsw-alias-label-secondary); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
|
|
2876
|
+
/* v1.6.3:同一视图里出现同名文件时的「同名 N 份 · 所在目录」提示。
|
|
2877
|
+
老板 11-25 截图:一组里并排两张「老人手部_GPT25_0.png」,看着像重复,
|
|
2878
|
+
实际一个是「漫剧手册分析/」、一个是他自己拷的「GPT25备用/」。
|
|
2879
|
+
只在重名时出现,其余卡片视觉零变化;颜色用琥珀色以示「这不是重复」。 */
|
|
2880
|
+
.dg-dir {
|
|
2881
|
+
font-size: 10px; line-height: 1.2;
|
|
2882
|
+
color: #d08b16;
|
|
2883
|
+
white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
|
|
2884
|
+
}
|
|
2729
2885
|
.dg-more {
|
|
2730
2886
|
margin: 12px 0 4px;
|
|
2731
2887
|
padding: 8px 10px;
|
|
@@ -3787,6 +3943,59 @@ async function encodeMaskPngBytes(imageData, width, height) {
|
|
|
3787
3943
|
}
|
|
3788
3944
|
.dg-pasteOk { border-color: rgba(94,214,150,0.6); }
|
|
3789
3945
|
.dg-pasteFail { border-color: rgba(255,107,107,0.6); color: #ffd2d2; }
|
|
3946
|
+
/* v1.6.0 带按钮的提示(导出清单 / 撤销):有按钮就必须能点,所以这一档放开 pointer-events。 */
|
|
3947
|
+
/* v1.6.2 修「一字一行」:原来这条是 flex 横排,长路径 + word-break:break-all 被压到 1 字符宽,
|
|
3948
|
+
整条提示竖成一根柱子(老板截图)。改成上下两段:文字占一行(超长省略),按钮在下面一行。 */
|
|
3949
|
+
.dg-pasteNoticeAction {
|
|
3950
|
+
pointer-events: auto; display: flex; flex-direction: column; align-items: stretch; gap: 8px;
|
|
3951
|
+
max-width: 92%; word-break: normal;
|
|
3952
|
+
}
|
|
3953
|
+
.dg-pasteText { flex: 0 0 auto; min-width: 0; word-break: break-word; }
|
|
3954
|
+
.dg-pasteBtns { display: flex; align-items: center; gap: 6px; flex: 0 0 auto; flex-wrap: wrap; justify-content: center; }
|
|
3955
|
+
.dg-pasteBtn {
|
|
3956
|
+
font: inherit; font-size: 12px; cursor: pointer; white-space: nowrap;
|
|
3957
|
+
padding: 3px 9px; border-radius: 5px; color: #e8eaed;
|
|
3958
|
+
background: rgba(255,255,255,0.10); border: 1px solid rgba(255,255,255,0.22);
|
|
3959
|
+
}
|
|
3960
|
+
.dg-pasteBtn:hover { background: rgba(255,255,255,0.18); }
|
|
3961
|
+
.dg-pasteBtn:active { background: rgba(255,255,255,0.26); }
|
|
3962
|
+
|
|
3963
|
+
/* ===== 导出记录面板(v1.6.2) =====
|
|
3964
|
+
复用设置面板的遮罩与卡片骨架(.dg-settingsLayer / .dg-settings),
|
|
3965
|
+
这里只把它加宽一点,并把「文件名 / 来源时间条数 / 两个按钮」压成一行。 */
|
|
3966
|
+
.dg-exportPanel { max-width: 560px; }
|
|
3967
|
+
.dg-exportHint {
|
|
3968
|
+
padding: 8px 12px 0; font-size: 11px; line-height: 1.5; opacity: .78;
|
|
3969
|
+
}
|
|
3970
|
+
.dg-exportList {
|
|
3971
|
+
padding: 8px 12px; display: flex; flex-direction: column; gap: 6px;
|
|
3972
|
+
overflow: auto; flex: 1 1 auto; min-height: 0;
|
|
3973
|
+
}
|
|
3974
|
+
.dg-exportRow {
|
|
3975
|
+
display: flex; align-items: center; gap: 8px; padding: 7px 8px;
|
|
3976
|
+
border: 1px solid var(--dsw-alias-border-l1); border-radius: 6px;
|
|
3977
|
+
background: var(--dsw-alias-bg-layer-2);
|
|
3978
|
+
}
|
|
3979
|
+
.dg-exportMain { flex: 1 1 auto; min-width: 0; }
|
|
3980
|
+
.dg-exportName {
|
|
3981
|
+
font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
|
|
3982
|
+
}
|
|
3983
|
+
.dg-exportMeta {
|
|
3984
|
+
font-size: 11px; opacity: .72; margin-top: 2px;
|
|
3985
|
+
white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
|
|
3986
|
+
}
|
|
3987
|
+
.dg-exportMetaGone { color: #ff9b9b; opacity: 1; }
|
|
3988
|
+
.dg-exportActs { display: flex; gap: 6px; flex: 0 0 auto; }
|
|
3989
|
+
.dg-exportEmpty { padding: 20px 4px; text-align: center; font-size: 12px; opacity: .7; }
|
|
3990
|
+
.dg-exportFail { color: #ff9b9b; opacity: 1; }
|
|
3991
|
+
.dg-exportFoot {
|
|
3992
|
+
display: flex; align-items: center; gap: 8px; padding: 8px 12px;
|
|
3993
|
+
border-top: 1px solid var(--dsw-alias-border-l1); background: var(--dsw-alias-bg-layer-2);
|
|
3994
|
+
}
|
|
3995
|
+
.dg-exportDir {
|
|
3996
|
+
flex: 1 1 auto; min-width: 0; font-size: 11px; opacity: .7;
|
|
3997
|
+
white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
|
|
3998
|
+
}
|
|
3790
3999
|
|
|
3791
4000
|
/* v1.0.2 图片裁剪层:绿框 + 八向手柄 + 像素级取色放大镜(照老板给的参考图对齐)
|
|
3792
4001
|
坐标系说明:裁剪框/放大镜都用 getBoundingClientRect 的**视口坐标**定位,
|
|
@@ -6386,8 +6595,128 @@ ${absPath}
|
|
|
6386
6595
|
])
|
|
6387
6596
|
}
|
|
6388
6597
|
|
|
6598
|
+
/**
|
|
6599
|
+
* 同名文件判定(v1.6.3)。
|
|
6600
|
+
*
|
|
6601
|
+
* 老板 11-25 截图:一个对话组里并排两张 `老人手部_GPT25_0.png`,看着就像重复展示。
|
|
6602
|
+
* 实测是两份**真文件**:`漫剧手册分析/` 一份、`退订漫剧/图卡/GPT25备用/` 一份
|
|
6603
|
+
* (后者是他自己拷的备用件),尺寸相同、时间不同。
|
|
6604
|
+
* 卡片原先只显示文件名,两份并排自然分不出 → 这里给「同名 N 份」标出所在目录。
|
|
6605
|
+
*
|
|
6606
|
+
* 只统计**同一视图**内(同组 / 扁平列表)的同名,跨组不参与(跨组共用另有角标语义)。
|
|
6607
|
+
*/
|
|
6608
|
+
function countNamesOf(list) {
|
|
6609
|
+
const counts = new Map()
|
|
6610
|
+
for (const it of Array.isArray(list) ? list : []) {
|
|
6611
|
+
const n = it?.name ?? String(it?.relPath ?? '').split('/').pop()
|
|
6612
|
+
if (n === undefined || n === null || n === '') continue
|
|
6613
|
+
counts.set(n, (counts.get(n) ?? 0) + 1)
|
|
6614
|
+
}
|
|
6615
|
+
return counts
|
|
6616
|
+
}
|
|
6617
|
+
|
|
6618
|
+
/**
|
|
6619
|
+
* 跨对话共用索引(v1.6.4)。
|
|
6620
|
+
*
|
|
6621
|
+
* 老板 11-25 定的口径:两个对话引用同一张图是**事实**(两边的日志都精确引用过),
|
|
6622
|
+
* 既不合并、也不去重 —— 但要把「归属」标出来,让人一眼看出这不是重复数据,
|
|
6623
|
+
* 而是同一个文件同时属于两个对话。
|
|
6624
|
+
*
|
|
6625
|
+
* 顺带把删除/隐藏的边界讲清(这是老板拍板的前提):
|
|
6626
|
+
* · 同名但不同路径的两份真文件 → 各自独立,删一份不动另一份;
|
|
6627
|
+
* · 同一路径的共用件 → 本来就是同一个文件,删/隐必然两处一起生效。
|
|
6628
|
+
*
|
|
6629
|
+
* 按 `data` 引用缓存:面板每帧都会问一次,全库几千条重算会拖慢滚轮与拖动。
|
|
6630
|
+
*/
|
|
6631
|
+
const SHARE_INDEX_CACHE = new WeakMap()
|
|
6632
|
+
|
|
6633
|
+
function shareIndexOf(data) {
|
|
6634
|
+
const none = { byRel: new Map(), countByGroup: new WeakMap() }
|
|
6635
|
+
if (data === null || typeof data !== 'object') return none
|
|
6636
|
+
const cached = SHARE_INDEX_CACHE.get(data)
|
|
6637
|
+
if (cached !== undefined) return cached
|
|
6638
|
+
|
|
6639
|
+
const groups = Array.isArray(data.groups) ? data.groups : []
|
|
6640
|
+
const byRel = new Map()
|
|
6641
|
+
for (const g of groups) {
|
|
6642
|
+
// 「历史资产」池不是真的对话归属,算进来会把一大堆图误标成共用
|
|
6643
|
+
if (g?.isHistory === true) continue
|
|
6644
|
+
const title = String(g?.title ?? '')
|
|
6645
|
+
for (const f of Array.isArray(g?.files) ? g.files : []) {
|
|
6646
|
+
const rel = String(f?.relPath ?? '')
|
|
6647
|
+
if (rel === '') continue
|
|
6648
|
+
const owners = byRel.get(rel)
|
|
6649
|
+
if (owners === undefined) byRel.set(rel, [title])
|
|
6650
|
+
else if (!owners.includes(title)) owners.push(title)
|
|
6651
|
+
}
|
|
6652
|
+
}
|
|
6653
|
+
|
|
6654
|
+
const countByGroup = new WeakMap()
|
|
6655
|
+
for (const g of groups) {
|
|
6656
|
+
if (g?.isHistory === true) continue
|
|
6657
|
+
let n = 0
|
|
6658
|
+
for (const f of Array.isArray(g?.files) ? g.files : []) {
|
|
6659
|
+
const owners = byRel.get(String(f?.relPath ?? ''))
|
|
6660
|
+
if (Array.isArray(owners) && owners.length > 1) n += 1
|
|
6661
|
+
}
|
|
6662
|
+
if (n > 0) countByGroup.set(g, n)
|
|
6663
|
+
}
|
|
6664
|
+
|
|
6665
|
+
const built = { byRel, countByGroup }
|
|
6666
|
+
SHARE_INDEX_CACHE.set(data, built)
|
|
6667
|
+
return built
|
|
6668
|
+
}
|
|
6669
|
+
|
|
6670
|
+
/** 兜底:后端没给 `sharedPeers` 时,按已加载的组内条目现算共用对象。 */
|
|
6671
|
+
function sharedPeersOf(group, shareInfo) {
|
|
6672
|
+
const selfTitle = String(group?.title ?? '')
|
|
6673
|
+
const out = []
|
|
6674
|
+
for (const f of Array.isArray(group?.files) ? group.files : []) {
|
|
6675
|
+
const owners = shareInfo.byRel.get(String(f?.relPath ?? ''))
|
|
6676
|
+
if (!Array.isArray(owners)) continue
|
|
6677
|
+
for (const title of owners) {
|
|
6678
|
+
if (title !== selfTitle && !out.includes(title)) out.push(title)
|
|
6679
|
+
}
|
|
6680
|
+
}
|
|
6681
|
+
return out
|
|
6682
|
+
}
|
|
6683
|
+
|
|
6684
|
+
/**
|
|
6685
|
+
* 组头「共用 N」的悬停说明。
|
|
6686
|
+
*
|
|
6687
|
+
* 共用对象可能一大串(实测有 85 张图牵扯 27 个对话),全塞进组头会撑爆,
|
|
6688
|
+
* 所以明细放悬停里,最多点 3 个名字,其余折成「等 N 个对话」。
|
|
6689
|
+
* 末尾必须把删除/隐藏的边界讲明 —— 这是老板拍板时问的那一句。
|
|
6690
|
+
*/
|
|
6691
|
+
function sharedTipOf(t, n, peers) {
|
|
6692
|
+
const names = (Array.isArray(peers) ? peers : [])
|
|
6693
|
+
.map((s) => String(s ?? '').trim())
|
|
6694
|
+
.filter((s) => s !== '')
|
|
6695
|
+
let who
|
|
6696
|
+
if (names.length === 0) {
|
|
6697
|
+
who = t('sharedWithSome')
|
|
6698
|
+
} else if (names.length <= 3) {
|
|
6699
|
+
who = names.map((s) => `「${s}」`).join('、')
|
|
6700
|
+
} else {
|
|
6701
|
+
who = format(t('sharedWithMany'), {
|
|
6702
|
+
n: names.length,
|
|
6703
|
+
first: names.slice(0, 3).map((s) => `「${s}」`).join('、'),
|
|
6704
|
+
})
|
|
6705
|
+
}
|
|
6706
|
+
return format(t('groupSharedTip'), { n, who })
|
|
6707
|
+
}
|
|
6708
|
+
|
|
6709
|
+
/** 相对路径的所在目录(取尾两段,足够区分同名文件;根目录返回空串)。 */
|
|
6710
|
+
function dirLabelOf(relPath) {
|
|
6711
|
+
const rel = String(relPath ?? '').replace(/\\/g, '/')
|
|
6712
|
+
const cut = rel.lastIndexOf('/')
|
|
6713
|
+
if (cut < 0) return ''
|
|
6714
|
+
const segs = rel.slice(0, cut).split('/').filter((s) => s !== '')
|
|
6715
|
+
return segs.slice(-2).join('/')
|
|
6716
|
+
}
|
|
6717
|
+
|
|
6389
6718
|
/** 单张缩略图卡片:独立加载、独立失败,互不影响。 */
|
|
6390
|
-
function Card({ item, t, onOpen, limiter, onContextMenu, onDoubleClick }) {
|
|
6719
|
+
function Card({ item, t, onOpen, limiter, onContextMenu, onDoubleClick, nameCounts }) {
|
|
6391
6720
|
const [state, setState] = React.useState({ status: 'pending' })
|
|
6392
6721
|
const [node, setNode] = React.useState(null)
|
|
6393
6722
|
// v0.17.0:单击延迟计时器(双击时取消,避免「闪一下大图」)
|
|
@@ -6473,6 +6802,12 @@ ${absPath}
|
|
|
6473
6802
|
? format(t('dims'), { w: item.width, h: item.height })
|
|
6474
6803
|
: t('dimsUnknown')
|
|
6475
6804
|
|
|
6805
|
+
// v1.6.3:同名文件 → 显示「同名 N 份 · 所在目录」,让两份真文件一眼可分
|
|
6806
|
+
const sameCount = nameCounts instanceof Map
|
|
6807
|
+
? (nameCounts.get(item.name) ?? 0)
|
|
6808
|
+
: 0
|
|
6809
|
+
const dirLabel = sameCount > 1 ? dirLabelOf(item.relPath) : ''
|
|
6810
|
+
|
|
6476
6811
|
return h('button', {
|
|
6477
6812
|
type: 'button',
|
|
6478
6813
|
ref: setNode,
|
|
@@ -6533,6 +6868,16 @@ ${absPath}
|
|
|
6533
6868
|
: t('loading')),
|
|
6534
6869
|
),
|
|
6535
6870
|
h('div', { className: 'dg-meta', key: 'meta' }, [
|
|
6871
|
+
// v1.6.3:同名提醒放在文件名上方,只在重名时出现;目录用琥珀色,
|
|
6872
|
+
// 与「分类角标」的绿/橙/灰错开,避免被误读成又一个分类。
|
|
6873
|
+
sameCount > 1
|
|
6874
|
+
? h('span', {
|
|
6875
|
+
className: 'dg-dir',
|
|
6876
|
+
key: 'dir',
|
|
6877
|
+
title: `${item.relPath}`,
|
|
6878
|
+
'data-gallery-same-name': String(sameCount),
|
|
6879
|
+
}, format(t('sameNameIn'), { n: sameCount, dir: dirLabel === '' ? t('rootDir') : dirLabel }))
|
|
6880
|
+
: null,
|
|
6536
6881
|
h('span', { className: 'dg-name', key: 'name' }, item.name),
|
|
6537
6882
|
h('span', { className: 'dg-dim', key: 'dim' }, dims),
|
|
6538
6883
|
h('span', { className: 'dg-dim', key: 'time' }, formatTime(item.mtime)),
|
|
@@ -9026,6 +9371,39 @@ function AnnotationLayer({ t, annotations, onAdd, onRemove, active, dragging, fr
|
|
|
9026
9371
|
}, [info, t])
|
|
9027
9372
|
|
|
9028
9373
|
/** 全部恢复:清空隐藏列表,让被隐藏的条目重新出现在列表里。 */
|
|
9374
|
+
/**
|
|
9375
|
+
* v1.5.0 隐私:清空本地登记。
|
|
9376
|
+
*
|
|
9377
|
+
* 两段式:先 dryRun 拿条数与 digest,再带着同一个 digest 真删 ——
|
|
9378
|
+
* Host 侧会校验 digest,中途登记有变化就拒绝,避免「看着 3 条、删掉 30 条」。
|
|
9379
|
+
* 「清空全部标注」额外要求点两次(clearArm),因为那批数据不可再生。
|
|
9380
|
+
*/
|
|
9381
|
+
const [privacyBusy, setPrivacyBusy] = React.useState('')
|
|
9382
|
+
const [privacyNote, setPrivacyNote] = React.useState('')
|
|
9383
|
+
const [clearArm, setClearArm] = React.useState('')
|
|
9384
|
+
const clearLocal = React.useCallback(async (scope) => {
|
|
9385
|
+
if (privacyBusy !== '') return
|
|
9386
|
+
setPrivacyBusy(scope)
|
|
9387
|
+
setPrivacyNote('')
|
|
9388
|
+
setError(null)
|
|
9389
|
+
try {
|
|
9390
|
+
const dry = await callHost('clearState', { scope, dryRun: true })
|
|
9391
|
+
if (dry?.ok !== true) throw new Error(dry?.error?.message ?? t('errorTitle'))
|
|
9392
|
+
const counts = dry.counts ?? {}
|
|
9393
|
+
const total = Object.keys(counts).reduce((n, k) => n + (Number(counts[k]) || 0), 0)
|
|
9394
|
+
const done = await callHost('clearState', { scope, dryRun: false, digest: dry.digest })
|
|
9395
|
+
if (done?.ok !== true) throw new Error(done?.error?.message ?? t('errorTitle'))
|
|
9396
|
+
setPrivacyNote(format(t('privacyCleared'), { n: total }))
|
|
9397
|
+
setClearArm('')
|
|
9398
|
+
setTimeout(() => setPrivacyNote(''), 6000)
|
|
9399
|
+
if (typeof onSaved === 'function') onSaved()
|
|
9400
|
+
} catch (e) {
|
|
9401
|
+
setPrivacyNote(format(t('privacyClearFailed'), { message: String(e?.message ?? e) }))
|
|
9402
|
+
} finally {
|
|
9403
|
+
setPrivacyBusy('')
|
|
9404
|
+
}
|
|
9405
|
+
}, [privacyBusy, t, onSaved])
|
|
9406
|
+
|
|
9029
9407
|
const clearHidden = React.useCallback(async () => {
|
|
9030
9408
|
if (info === null || info.hiddenCount === 0) return
|
|
9031
9409
|
setClearing(true)
|
|
@@ -9164,6 +9542,47 @@ function AnnotationLayer({ t, annotations, onAdd, onRemove, active, dragging, fr
|
|
|
9164
9542
|
error === null ? null : h('p', { className: 'dg-status dg-error', key: 'err' }, error),
|
|
9165
9543
|
saved ? h('p', { className: 'dg-status dg-ok', key: 'ok' }, t('savedImmediately')) : null,
|
|
9166
9544
|
|
|
9545
|
+
// ---- v1.5.0 本地登记(隐私):看清存了什么,也能自己清干净 ----
|
|
9546
|
+
h('div', { className: 'dg-field', key: 'privacy' }, [
|
|
9547
|
+
h('div', { className: 'dg-fieldHead', key: 'head' }, [
|
|
9548
|
+
h('span', { className: 'dg-fieldLabel', key: 'l' }, t('privacyLabel')),
|
|
9549
|
+
h('span', { className: 'dg-fieldHint', key: 'h' }, t('privacyHint')),
|
|
9550
|
+
]),
|
|
9551
|
+
h('div', { className: 'dg-settingsActions', key: 'ops' }, [
|
|
9552
|
+
h('button', {
|
|
9553
|
+
type: 'button', className: 'dg-btn dg-btnSmall', key: 'clearCtx',
|
|
9554
|
+
'data-gallery-clear-context': true,
|
|
9555
|
+
disabled: privacyBusy !== '',
|
|
9556
|
+
title: t('privacyClearContextHint'),
|
|
9557
|
+
onClick: () => { void clearLocal('context') },
|
|
9558
|
+
}, privacyBusy === 'context' ? t('privacyClearing') : t('privacyClearContext')),
|
|
9559
|
+
h('button', {
|
|
9560
|
+
type: 'button',
|
|
9561
|
+
className: `dg-btn dg-btnSmall${clearArm === 'annotations' ? ' dg-dangerBtn' : ''}`,
|
|
9562
|
+
key: 'clearAnn',
|
|
9563
|
+
'data-gallery-clear-annotations': true,
|
|
9564
|
+
'data-armed': clearArm === 'annotations' ? '1' : '0',
|
|
9565
|
+
disabled: privacyBusy !== '',
|
|
9566
|
+
title: t('privacyClearAnnotationsHint'),
|
|
9567
|
+
onClick: () => {
|
|
9568
|
+
if (clearArm !== 'annotations') {
|
|
9569
|
+
setClearArm('annotations')
|
|
9570
|
+
setPrivacyNote(t('privacyArmHint'))
|
|
9571
|
+
return
|
|
9572
|
+
}
|
|
9573
|
+
void clearLocal('annotations')
|
|
9574
|
+
},
|
|
9575
|
+
}, privacyBusy === 'annotations'
|
|
9576
|
+
? t('privacyClearing')
|
|
9577
|
+
: (clearArm === 'annotations'
|
|
9578
|
+
? t('privacyClearAnnotationsConfirm')
|
|
9579
|
+
: t('privacyClearAnnotations'))),
|
|
9580
|
+
]),
|
|
9581
|
+
privacyNote === ''
|
|
9582
|
+
? null
|
|
9583
|
+
: h('p', { className: 'dg-status', key: 'note' }, privacyNote),
|
|
9584
|
+
]),
|
|
9585
|
+
|
|
9167
9586
|
h('div', { className: 'dg-settingsActions', key: 'actions' }, [
|
|
9168
9587
|
h('button', {
|
|
9169
9588
|
type: 'button', className: 'dg-btn', key: 'reset',
|
|
@@ -9526,6 +9945,12 @@ function AnnotationLayer({ t, annotations, onAdd, onRemove, active, dragging, fr
|
|
|
9526
9945
|
const [page, setPage] = React.useState(1)
|
|
9527
9946
|
// 设置面板开关(改产出根目录)
|
|
9528
9947
|
const [settingsOpen, setSettingsOpen] = React.useState(false)
|
|
9948
|
+
/**
|
|
9949
|
+
* 导出记录面板(v1.6.2)。
|
|
9950
|
+
* 老板的原话:导出完只有一条几秒就消失的提示,事后想再用这批清单,
|
|
9951
|
+
* 只能自己去 `~\.dsh\gallery-exports\` 里翻,而且多次导出的文件混在一起认不出。
|
|
9952
|
+
* 这里常驻一个入口,列历史清单(来源 / 时间 / 条数),点一下就「写进输入框」。 */
|
|
9953
|
+
const [exportHistoryOpen, setExportHistoryOpen] = React.useState(false)
|
|
9529
9954
|
// 全局分组:哪些组是展开的(键是 sessionId 或 '__history__')
|
|
9530
9955
|
const [openGroups, setOpenGroups] = React.useState(new Set())
|
|
9531
9956
|
// 每组额外取回来的明细(首次只有 60 张,点「再显示」再追加 60 张)。
|
|
@@ -10343,9 +10768,82 @@ function AnnotationLayer({ t, annotations, onAdd, onRemove, active, dragging, fr
|
|
|
10343
10768
|
})
|
|
10344
10769
|
}, [])
|
|
10345
10770
|
|
|
10771
|
+
/**
|
|
10772
|
+
* 粘贴/操作提示(成功/失败)。
|
|
10773
|
+
*
|
|
10774
|
+
* v1.6.0:支持带按钮 —— 导出清单后要能「打开文件夹 / 复制路径 / 写进输入框」,
|
|
10775
|
+
* 删除或隐藏后要能点「撤销」。带按钮时停留 6 秒(默认 3 秒),且允许鼠标点。
|
|
10776
|
+
*
|
|
10777
|
+
* 声明位置刻意早于 doHide / doDelete:useCallback 的依赖数组在**渲染时立即求值**,
|
|
10778
|
+
* 引用后面声明的 const 会直接 TDZ 白屏(v0.16.0 踩过)。
|
|
10779
|
+
*/
|
|
10780
|
+
const [pasteNotice, setPasteNotice] = React.useState(null)
|
|
10781
|
+
const showPasteNotice = React.useCallback((kindOf, text, actions) => {
|
|
10782
|
+
setPasteNotice({
|
|
10783
|
+
kind: kindOf,
|
|
10784
|
+
text,
|
|
10785
|
+
actions: Array.isArray(actions) && actions.length > 0 ? actions : null,
|
|
10786
|
+
})
|
|
10787
|
+
}, [])
|
|
10788
|
+
|
|
10789
|
+
/**
|
|
10790
|
+
* 撤销栈(Ctrl+Z):只记「还能撤的动作」,最多 10 步,先进后出。
|
|
10791
|
+
*
|
|
10792
|
+
* 用 ref 而不是 state:撤销是「按下快捷键那一刻取最新值」,
|
|
10793
|
+
* 不需要触发重渲染,也不该因为加一条记录就整面板重画。
|
|
10794
|
+
*/
|
|
10795
|
+
const undoStackRef = React.useRef([])
|
|
10796
|
+
// 提示条上的「撤销」按钮点下去要走同一个执行器;执行器在下面才声明,
|
|
10797
|
+
// 所以这里留一个 ref 由 effect 回填(别在提示按钮里直接引用后面声明的 const)。
|
|
10798
|
+
const undoRef = React.useRef(null)
|
|
10799
|
+
/**
|
|
10800
|
+
* 撤销「作用域」键:全局资产 / 某个对话 / 各类画廊(图片、文件、音视频)各算一个。
|
|
10801
|
+
*
|
|
10802
|
+
* 2026-11-25(老板报):原来撤销就是一个先进后出的栈,按删除倒序撤,
|
|
10803
|
+
* 跟「现在在看哪个对话」完全无关 —— 在 A 对话里点 Ctrl+Z,可能把 B 对话
|
|
10804
|
+
* 刚删的东西搬回来,看着莫名其妙。现在每批操作记下它发生在哪个视图,
|
|
10805
|
+
* Ctrl+Z 只撤**当前视图**里的那一批;当前视图没有就直说「最近一批在 XX 里」。
|
|
10806
|
+
*/
|
|
10807
|
+
const viewKeyOf = React.useCallback(
|
|
10808
|
+
() => `${kind}|${scope}|${scope === 'session' ? String(sessionId ?? '') : ''}`,
|
|
10809
|
+
[kind, scope, sessionId],
|
|
10810
|
+
)
|
|
10811
|
+
/**
|
|
10812
|
+
* 当前对话标题(v1.6.2)。
|
|
10813
|
+
* 老板的原话:撤销提示只写「当前对话」,看不出是哪一段 —— 切了几个对话之后
|
|
10814
|
+
* 根本不知道自己刚撤的是哪一批。这里从 scan 结果的 groups 里取 isCurrent 那组的
|
|
10815
|
+
* title(会话视图只有一个组,取不到 isCurrent 就退到第一个)。
|
|
10816
|
+
*/
|
|
10817
|
+
const currentSessionTitleOf = React.useCallback(() => {
|
|
10818
|
+
const groups = Array.isArray(view?.data?.groups) ? view.data.groups : []
|
|
10819
|
+
const hit = groups.find((g) => g?.isCurrent === true) ?? (scope === 'session' ? groups[0] : undefined)
|
|
10820
|
+
return String(hit?.title ?? '').trim()
|
|
10821
|
+
}, [view, scope])
|
|
10822
|
+
const whereOf = React.useCallback(() => {
|
|
10823
|
+
if (scope !== 'session') return t('whereGlobal')
|
|
10824
|
+
const title = currentSessionTitleOf()
|
|
10825
|
+
return title === '' ? t('whereSession') : format(t('whereSessionNamed'), { name: title })
|
|
10826
|
+
}, [scope, t, currentSessionTitleOf])
|
|
10827
|
+
const kindLabelOf = React.useCallback(
|
|
10828
|
+
() => (kind === 'file' ? t('kindFile') : kind === 'media' ? t('kindMedia') : t('kindImage')),
|
|
10829
|
+
[kind, t],
|
|
10830
|
+
)
|
|
10831
|
+
const pushUndo = React.useCallback((entry) => {
|
|
10832
|
+
const stack = undoStackRef.current
|
|
10833
|
+
stack.push({
|
|
10834
|
+
...entry,
|
|
10835
|
+
at: Date.now(),
|
|
10836
|
+
view: viewKeyOf(),
|
|
10837
|
+
where: whereOf(),
|
|
10838
|
+
kindLabel: kindLabelOf(),
|
|
10839
|
+
})
|
|
10840
|
+
while (stack.length > 20) stack.shift()
|
|
10841
|
+
}, [viewKeyOf, whereOf, kindLabelOf])
|
|
10842
|
+
|
|
10346
10843
|
/**
|
|
10347
10844
|
* 隐藏条目(只从列表移除,不动文件)。
|
|
10348
10845
|
* 2026-11-25:接受单个条目或 relPath 数组;批量隐藏一次写完。
|
|
10846
|
+
* v1.6.0:隐藏可撤销(写进撤销栈 + 提示条带「撤销」按钮)。
|
|
10349
10847
|
*/
|
|
10350
10848
|
const doHide = React.useCallback(async (target) => {
|
|
10351
10849
|
const rels = (Array.isArray(target) ? target : [target?.relPath ?? ''])
|
|
@@ -10357,11 +10855,16 @@ function AnnotationLayer({ t, annotations, onAdd, onRemove, active, dragging, fr
|
|
|
10357
10855
|
if (payload?.ok === false) throw new Error(payload?.error?.message ?? t('errorTitle'))
|
|
10358
10856
|
setSelected(new Set())
|
|
10359
10857
|
setBatchMode(false)
|
|
10858
|
+
pushUndo({ kind: 'hide', rels })
|
|
10859
|
+
showPasteNotice('ok', format(t('undoHideOk'), { n: rels.length }), [
|
|
10860
|
+
{ label: t('undoAction'), onClick: () => { void undoRef.current?.() } },
|
|
10861
|
+
])
|
|
10360
10862
|
await load(undefined, kind, scope, page).then((data) => setView({ status: 'ready', data })).catch(() => {})
|
|
10361
10863
|
} catch (error) {
|
|
10362
10864
|
console.error('dsh-gallery: 隐藏失败', error)
|
|
10865
|
+
showPasteNotice('fail', t('ctxHideFailed'))
|
|
10363
10866
|
}
|
|
10364
|
-
}, [load, kind, scope, page, t])
|
|
10867
|
+
}, [load, kind, scope, page, t, showPasteNotice, pushUndo])
|
|
10365
10868
|
|
|
10366
10869
|
/** 在资源管理器里定位。 */
|
|
10367
10870
|
const doReveal = React.useCallback(async (item) => {
|
|
@@ -10373,11 +10876,7 @@ function AnnotationLayer({ t, annotations, onAdd, onRemove, active, dragging, fr
|
|
|
10373
10876
|
}
|
|
10374
10877
|
}, [t])
|
|
10375
10878
|
|
|
10376
|
-
/**
|
|
10377
|
-
const [pasteNotice, setPasteNotice] = React.useState(null)
|
|
10378
|
-
const showPasteNotice = React.useCallback((kindOf, text) => {
|
|
10379
|
-
setPasteNotice({ kind: kindOf, text })
|
|
10380
|
-
}, [])
|
|
10879
|
+
/** 粘贴/操作提示(成功/失败)的声明已提前到 doHide 之前(带按钮 + 撤销栈)。 */
|
|
10381
10880
|
|
|
10382
10881
|
/**
|
|
10383
10882
|
* 执行删除(需二次确认)。
|
|
@@ -10394,10 +10893,20 @@ function AnnotationLayer({ t, annotations, onAdd, onRemove, active, dragging, fr
|
|
|
10394
10893
|
try {
|
|
10395
10894
|
const payload = await callHost('delete', { paths: rels, confirm: true })
|
|
10396
10895
|
if (payload?.ok === false) throw new Error(payload?.error?.message ?? t('errorTitle'))
|
|
10896
|
+
const deletedCount = Array.isArray(payload?.deletedPaths) ? payload.deletedPaths.length : 0
|
|
10897
|
+
const undoToken = String(payload?.undoToken ?? '')
|
|
10397
10898
|
const failed = (Array.isArray(payload?.failed) ? payload.failed.length : 0)
|
|
10398
10899
|
+ (Array.isArray(payload?.notFound) ? payload.notFound.length : 0)
|
|
10900
|
+
const undoActions = undoToken === ''
|
|
10901
|
+
? null
|
|
10902
|
+
: [{ label: t('undoAction'), onClick: () => { void undoRef.current?.() } }]
|
|
10903
|
+
if (deletedCount > 0 && undoToken !== '') {
|
|
10904
|
+
pushUndo({ kind: 'delete', token: undoToken, count: deletedCount })
|
|
10905
|
+
}
|
|
10399
10906
|
if (failed > 0) {
|
|
10400
|
-
showPasteNotice('fail', format(t('ctxDeletePartial'), { n:
|
|
10907
|
+
showPasteNotice('fail', format(t('ctxDeletePartial'), { n: deletedCount, fail: failed }), undoActions)
|
|
10908
|
+
} else if (deletedCount > 0) {
|
|
10909
|
+
showPasteNotice('ok', format(t('undoDeleteOk'), { n: deletedCount }), undoActions)
|
|
10401
10910
|
}
|
|
10402
10911
|
setDeleteTarget(null)
|
|
10403
10912
|
setSelected(new Set())
|
|
@@ -10409,7 +10918,7 @@ function AnnotationLayer({ t, annotations, onAdd, onRemove, active, dragging, fr
|
|
|
10409
10918
|
setDeleteTarget(null)
|
|
10410
10919
|
showPasteNotice('fail', t('ctxDeleteFailed'))
|
|
10411
10920
|
}
|
|
10412
|
-
}, [deleteTarget, load, kind, scope, page, t, showPasteNotice])
|
|
10921
|
+
}, [deleteTarget, load, kind, scope, page, t, showPasteNotice, pushUndo])
|
|
10413
10922
|
|
|
10414
10923
|
const refresh = React.useCallback(async () => {
|
|
10415
10924
|
setRefreshing(true)
|
|
@@ -10426,7 +10935,8 @@ function AnnotationLayer({ t, annotations, onAdd, onRemove, active, dragging, fr
|
|
|
10426
10935
|
// ---- v0.16.0 粘贴:剪贴板图片/文件作为「素材」落当前对话 ----
|
|
10427
10936
|
React.useEffect(() => {
|
|
10428
10937
|
if (pasteNotice === null) return undefined
|
|
10429
|
-
|
|
10938
|
+
// 带按钮的提示多留一会儿,够手点;纯文字提示 3 秒就够。
|
|
10939
|
+
const timer = setTimeout(() => setPasteNotice(null), pasteNotice.actions === null ? 3000 : 6000)
|
|
10430
10940
|
return () => clearTimeout(timer)
|
|
10431
10941
|
}, [pasteNotice])
|
|
10432
10942
|
|
|
@@ -10699,6 +11209,119 @@ function AnnotationLayer({ t, annotations, onAdd, onRemove, active, dragging, fr
|
|
|
10699
11209
|
}
|
|
10700
11210
|
}, [callHost, t, showPasteNotice])
|
|
10701
11211
|
|
|
11212
|
+
/**
|
|
11213
|
+
* 导出记录(v1.6.2)。
|
|
11214
|
+
*
|
|
11215
|
+
* 老板要的是「事后还能用」:一次导出只弹几秒提示,等于只有当场能引用;
|
|
11216
|
+
* 多次导出后文件名又认不出谁是谁。这里把 host 侧的登记读回来,
|
|
11217
|
+
* 列成一张常驻的表 —— 每条都能重新「写进输入框」,新开对话也能直接接上。
|
|
11218
|
+
*/
|
|
11219
|
+
const [exportHistory, setExportHistory] = React.useState({ status: 'idle', items: [], dir: '' })
|
|
11220
|
+
const loadExportHistory = React.useCallback(async () => {
|
|
11221
|
+
setExportHistory((prev) => ({ ...prev, status: 'loading' }))
|
|
11222
|
+
try {
|
|
11223
|
+
const payload = await callHost('exportList', {})
|
|
11224
|
+
if (payload?.ok !== true) throw new Error(payload?.error?.message ?? 'exportList failed')
|
|
11225
|
+
setExportHistory({
|
|
11226
|
+
status: 'ready',
|
|
11227
|
+
dir: String(payload?.dir ?? ''),
|
|
11228
|
+
items: Array.isArray(payload?.items) ? payload.items : [],
|
|
11229
|
+
})
|
|
11230
|
+
} catch (error) {
|
|
11231
|
+
setExportHistory({ status: 'failed', dir: '', items: [], message: String(error?.message ?? error) })
|
|
11232
|
+
}
|
|
11233
|
+
}, [callHost])
|
|
11234
|
+
const openExportHistory = React.useCallback(() => {
|
|
11235
|
+
setExportHistoryOpen(true)
|
|
11236
|
+
void loadExportHistory()
|
|
11237
|
+
}, [loadExportHistory])
|
|
11238
|
+
|
|
11239
|
+
/**
|
|
11240
|
+
* 导出交付清单(v1.5.0)。
|
|
11241
|
+
*
|
|
11242
|
+
* 与 Agent 的第 5 个工具 `gallery_manifest` 走 Host 侧同一个 buildManifest:
|
|
11243
|
+
* 您导出的 CSV 和模型读到的清单,条数、分类计数、来源时间码必须完全一致。
|
|
11244
|
+
* 落盘位置在 DSH_HOME/gallery-exports/,**不在扫描根内** ——
|
|
11245
|
+
* 清单是 .csv/.json,而扫描会认这两类扩展名,写进产出目录就会变成一堆新「资产」。
|
|
11246
|
+
*/
|
|
11247
|
+
const doExportManifest = React.useCallback(async (relPaths) => {
|
|
11248
|
+
const paths = [...new Set((Array.isArray(relPaths) ? relPaths : [])
|
|
11249
|
+
.map((p) => String(p ?? '')).filter((p) => p !== ''))]
|
|
11250
|
+
if (paths.length === 0) return false
|
|
11251
|
+
try {
|
|
11252
|
+
// v1.6.2:把「这批是哪儿导的」一起交给 host ——
|
|
11253
|
+
// 文件名因此变成 `交付清单_<来源>_<时间>_<分类>_<N>张.csv`,导出记录里也有来源。
|
|
11254
|
+
const sourceLabel = scope === 'session'
|
|
11255
|
+
? (currentSessionTitleOf() || t('whereSession'))
|
|
11256
|
+
: t('whereGlobal')
|
|
11257
|
+
const payload = await callHost('exportManifest', {
|
|
11258
|
+
relPaths: paths,
|
|
11259
|
+
format: 'both',
|
|
11260
|
+
includeNotes: true,
|
|
11261
|
+
sourceLabel,
|
|
11262
|
+
sessionTitle: scope === 'session' ? currentSessionTitleOf() : '',
|
|
11263
|
+
})
|
|
11264
|
+
if (payload?.ok !== true) throw new Error(payload?.error?.message ?? 'exportManifest failed')
|
|
11265
|
+
const files = Array.isArray(payload.files) ? payload.files : []
|
|
11266
|
+
// 主路径给 CSV(Excel 直接能开);JSON 落在同名 .json,路径只差扩展名。
|
|
11267
|
+
const csvFile = files.find((f) => String(f?.path ?? '').toLowerCase().endsWith('.csv')) ?? files[0]
|
|
11268
|
+
const head = String(csvFile?.path ?? '') || String(payload.dir ?? '')
|
|
11269
|
+
const count = Number(payload.count) || paths.length
|
|
11270
|
+
// v1.6.2:提示里只报文件名。以前整条绝对路径塞进去,窄面板下被压成一字一行。
|
|
11271
|
+
const baseName = String(payload?.base ?? '')
|
|
11272
|
+
const fileName = baseName !== ''
|
|
11273
|
+
? `${baseName}.csv`
|
|
11274
|
+
: (String(csvFile?.path ?? '').split(/[\\/]/).pop() ?? '')
|
|
11275
|
+
/**
|
|
11276
|
+
* v1.6.0:落盘地址不再只躺着给人看,三个按钮各管一件事 ——
|
|
11277
|
+
* · 打开文件夹:系统文件管理器打开导出目录(Host 只认这一个目录,不收任意路径);
|
|
11278
|
+
* · 复制路径:粘到别处 / 发给别人;
|
|
11279
|
+
* · 写进输入框:把路径递给助手,下一轮直接读这份清单。
|
|
11280
|
+
* v1.6.2:再加「导出记录」—— 提示几秒就消失,得留个能翻旧账的入口。
|
|
11281
|
+
*/
|
|
11282
|
+
showPasteNotice('ok', format(t('exportOk'), { n: count, name: fileName }), [
|
|
11283
|
+
{
|
|
11284
|
+
label: t('exportHistoryOpen'),
|
|
11285
|
+
onClick: () => { openExportHistory() },
|
|
11286
|
+
},
|
|
11287
|
+
{
|
|
11288
|
+
label: t('exportOpenDir'),
|
|
11289
|
+
onClick: () => {
|
|
11290
|
+
void callHost('openExportDir', {}).then((r) => {
|
|
11291
|
+
if (r?.ok === false) throw new Error(r?.error?.message ?? t('exportOpenFailed'))
|
|
11292
|
+
}).catch((error) => {
|
|
11293
|
+
showPasteNotice('fail', format(t('exportOpenFailed'), { message: String(error?.message ?? error) }))
|
|
11294
|
+
})
|
|
11295
|
+
},
|
|
11296
|
+
},
|
|
11297
|
+
{
|
|
11298
|
+
label: t('exportCopyPath'),
|
|
11299
|
+
onClick: () => {
|
|
11300
|
+
void copyText(head).then((ok) => {
|
|
11301
|
+
showPasteNotice(ok ? 'ok' : 'fail', ok ? t('exportPathCopied') : t('exportPathCopyFailed'))
|
|
11302
|
+
})
|
|
11303
|
+
},
|
|
11304
|
+
},
|
|
11305
|
+
{
|
|
11306
|
+
label: t('exportToComposer'),
|
|
11307
|
+
onClick: () => {
|
|
11308
|
+
void writeDraftToComposer(`交付清单(${count} 条):${head}`, sessionId).then((result) => {
|
|
11309
|
+
if (result?.ok === true) showPasteNotice('ok', t('exportDraftReady'))
|
|
11310
|
+
else { void copyText(head); showPasteNotice('fail', t('exportDraftInClipboard')) }
|
|
11311
|
+
}).catch(() => {
|
|
11312
|
+
void copyText(head)
|
|
11313
|
+
showPasteNotice('fail', t('exportDraftInClipboard'))
|
|
11314
|
+
})
|
|
11315
|
+
},
|
|
11316
|
+
},
|
|
11317
|
+
])
|
|
11318
|
+
return true
|
|
11319
|
+
} catch (error) {
|
|
11320
|
+
showPasteNotice('fail', format(t('exportFailed'), { message: String(error?.message ?? error) }))
|
|
11321
|
+
return false
|
|
11322
|
+
}
|
|
11323
|
+
}, [callHost, t, showPasteNotice, sessionId, scope, currentSessionTitleOf, openExportHistory])
|
|
11324
|
+
|
|
10702
11325
|
React.useEffect(() => {
|
|
10703
11326
|
let alive = true
|
|
10704
11327
|
const controller = new AbortController()
|
|
@@ -10765,14 +11388,30 @@ function AnnotationLayer({ t, annotations, onAdd, onRemove, active, dragging, fr
|
|
|
10765
11388
|
if (!canPartial) { void refresh(); return }
|
|
10766
11389
|
|
|
10767
11390
|
// 逐个组重取明细
|
|
11391
|
+
//
|
|
11392
|
+
// 🔴 2026-11-25 修(老板实测「全局里其他对话资产显示不全」):
|
|
11393
|
+
// 旧调用只传了 { kind, scope, sessionId, page },**没传 groupKey**,
|
|
11394
|
+
// 服务端按 groupKey 找不到组,直接回 { ok:true, files:[] };
|
|
11395
|
+
// 前端拿到空数组后把整组 files 覆盖成空 —— 那一组就只剩几条纹丝不动的旧卡。
|
|
11396
|
+
// 同时 limit 被 clamp 到 60,大组重取也会被截断。
|
|
11397
|
+
// 现在:带 groupKey、要全量;空返回但声称有内容时不信它,整表重来。
|
|
10768
11398
|
const fresh = new Map()
|
|
10769
11399
|
let needFull = false
|
|
10770
11400
|
for (const c of changed) {
|
|
10771
11401
|
const sid = String(c?.sessionId ?? '')
|
|
10772
11402
|
if (sid === '') { needFull = true; break }
|
|
10773
11403
|
try {
|
|
10774
|
-
const p = await callHost('groupMore', {
|
|
11404
|
+
const p = await callHost('groupMore', {
|
|
11405
|
+
kind,
|
|
11406
|
+
scope: 'global',
|
|
11407
|
+
sessionId: sid,
|
|
11408
|
+
groupKey: sid,
|
|
11409
|
+
offset: 0,
|
|
11410
|
+
limit: 5000,
|
|
11411
|
+
})
|
|
10775
11412
|
if (p?.ok === false) { needFull = true; break }
|
|
11413
|
+
const got = Array.isArray(p?.files) ? p.files : []
|
|
11414
|
+
if (got.length === 0 && Number(p?.total) > 0) { needFull = true; break }
|
|
10776
11415
|
fresh.set(sid, p)
|
|
10777
11416
|
} catch { needFull = true; break }
|
|
10778
11417
|
}
|
|
@@ -10791,10 +11430,20 @@ function AnnotationLayer({ t, annotations, onAdd, onRemove, active, dragging, fr
|
|
|
10791
11430
|
const files = Array.isArray(p?.files) ? p.files
|
|
10792
11431
|
: (Array.isArray(p?.items) ? p.items : null)
|
|
10793
11432
|
if (files === null) { sawUnknownGroup = true; continue }
|
|
11433
|
+
// 原本有内容却回空:不信它,整表重来。少画几张顶多刷新一下,
|
|
11434
|
+
// 把整组抹掉才是真事故(老板报过「其他对话资产显示不全」)。
|
|
11435
|
+
if (files.length === 0 && Number(nextGroups[idx].fileCount) > 0) {
|
|
11436
|
+
sawUnknownGroup = true
|
|
11437
|
+
continue
|
|
11438
|
+
}
|
|
10794
11439
|
nextGroups[idx] = {
|
|
10795
11440
|
...nextGroups[idx],
|
|
10796
11441
|
files,
|
|
10797
|
-
|
|
11442
|
+
// groupMore 回的是 total 而不是 fileCount,这里两个都认:
|
|
11443
|
+
// 只认 fileCount 会一直沿用旧值,「再显示」按钮的判据就飘了。
|
|
11444
|
+
fileCount: typeof p.fileCount === 'number'
|
|
11445
|
+
? p.fileCount
|
|
11446
|
+
: (Number(p.total) || files.length),
|
|
10798
11447
|
returnedCount: files.length,
|
|
10799
11448
|
counts: p.counts ?? nextGroups[idx].counts,
|
|
10800
11449
|
latestMtime: p.latestMtime ?? nextGroups[idx].latestMtime,
|
|
@@ -10828,6 +11477,92 @@ function AnnotationLayer({ t, annotations, onAdd, onRemove, active, dragging, fr
|
|
|
10828
11477
|
if (typeof fn === 'function') fn()
|
|
10829
11478
|
}, [])
|
|
10830
11479
|
|
|
11480
|
+
/**
|
|
11481
|
+
* 撤销最近一步(Ctrl+Z 与提示条上的「撤销」按钮共用这一条路)。
|
|
11482
|
+
*
|
|
11483
|
+
* 只认两类动作:删除(把这一批从回收区搬回原位)、隐藏(取消隐藏)。
|
|
11484
|
+
* 每撤一步就弹掉栈里一条;栈空时明确说一句「没有可撤销的操作」,
|
|
11485
|
+
* 不静默无反应 —— 否则人会以为快捷键没生效。
|
|
11486
|
+
*/
|
|
11487
|
+
const runUndo = React.useCallback(async () => {
|
|
11488
|
+
const stack = undoStackRef.current
|
|
11489
|
+
const key = viewKeyOf()
|
|
11490
|
+
// 只撤「当前视图」里的那一批;跨视图不撤,避免把人别处删的东西搬回来
|
|
11491
|
+
let idx = -1
|
|
11492
|
+
for (let i = stack.length - 1; i >= 0; i -= 1) {
|
|
11493
|
+
if (stack[i].view === key) { idx = i; break }
|
|
11494
|
+
}
|
|
11495
|
+
if (idx < 0) {
|
|
11496
|
+
const last = stack[stack.length - 1]
|
|
11497
|
+
if (last === undefined) {
|
|
11498
|
+
showPasteNotice('fail', t('undoNothing'))
|
|
11499
|
+
} else {
|
|
11500
|
+
showPasteNotice('fail', format(t('undoOtherScope'), {
|
|
11501
|
+
where: String(last.where ?? ''), kind: String(last.kindLabel ?? ''),
|
|
11502
|
+
}))
|
|
11503
|
+
}
|
|
11504
|
+
return
|
|
11505
|
+
}
|
|
11506
|
+
const [entry] = stack.splice(idx, 1)
|
|
11507
|
+
try {
|
|
11508
|
+
if (entry.kind === 'delete') {
|
|
11509
|
+
const payload = await callHost('undoDelete', { token: entry.token })
|
|
11510
|
+
if (payload?.ok === false && (payload?.restored ?? 0) === 0
|
|
11511
|
+
&& !Array.isArray(payload?.conflicts) && !Array.isArray(payload?.failed)) {
|
|
11512
|
+
throw new Error(payload?.error?.message ?? t('undoDeleteNone'))
|
|
11513
|
+
}
|
|
11514
|
+
const restored = Number(payload?.restored) || 0
|
|
11515
|
+
const conflicts = Array.isArray(payload?.conflicts) ? payload.conflicts.length : 0
|
|
11516
|
+
const failedCount = Array.isArray(payload?.failed) ? payload.failed.length : 0
|
|
11517
|
+
if (restored === 0) {
|
|
11518
|
+
showPasteNotice('fail', t('undoDeleteNone'))
|
|
11519
|
+
} else if (conflicts > 0 || failedCount > 0) {
|
|
11520
|
+
showPasteNotice('fail', format(t('undoDeletePartial'), {
|
|
11521
|
+
n: restored, fail: failedCount, conflict: conflicts,
|
|
11522
|
+
}))
|
|
11523
|
+
} else {
|
|
11524
|
+
showPasteNotice('ok', format(t('undoDeleteDone'), {
|
|
11525
|
+
n: restored, where: String(entry.where ?? ''), kind: String(entry.kindLabel ?? ''),
|
|
11526
|
+
}))
|
|
11527
|
+
}
|
|
11528
|
+
} else if (entry.kind === 'hide') {
|
|
11529
|
+
const rels = Array.isArray(entry.rels) ? entry.rels : []
|
|
11530
|
+
const payload = await callHost('unhide', { paths: rels })
|
|
11531
|
+
if (payload?.ok === false) throw new Error(payload?.error?.message ?? t('ctxHideFailed'))
|
|
11532
|
+
showPasteNotice('ok', format(t('undoHideDone'), {
|
|
11533
|
+
n: rels.length, where: String(entry.where ?? ''), kind: String(entry.kindLabel ?? ''),
|
|
11534
|
+
}))
|
|
11535
|
+
}
|
|
11536
|
+
kickChanges()
|
|
11537
|
+
await load(undefined, kind, scope, page)
|
|
11538
|
+
.then((data) => setView({ status: 'ready', data }))
|
|
11539
|
+
.catch(() => { /* 刷新失败保持当前列表,撤销本身已生效 */ })
|
|
11540
|
+
} catch (error) {
|
|
11541
|
+
showPasteNotice('fail', format(t('undoFailed'), { message: String(error?.message ?? error) }))
|
|
11542
|
+
}
|
|
11543
|
+
}, [callHost, load, kind, scope, page, t, showPasteNotice, kickChanges, viewKeyOf])
|
|
11544
|
+
|
|
11545
|
+
React.useEffect(() => { undoRef.current = runUndo }, [runUndo])
|
|
11546
|
+
|
|
11547
|
+
/**
|
|
11548
|
+
* Ctrl+Z / Cmd+Z:撤销最近一次删除或隐藏。
|
|
11549
|
+
*
|
|
11550
|
+
* 光标在输入框里一律放行 —— 那里要撤的是人自己打的字。
|
|
11551
|
+
* Ctrl+Shift+Z 也不拦(留给「重做」,本版没做,别占着坑还不干活)。
|
|
11552
|
+
*/
|
|
11553
|
+
React.useEffect(() => {
|
|
11554
|
+
const onKey = (event) => {
|
|
11555
|
+
if (!(event.ctrlKey || event.metaKey)) return
|
|
11556
|
+
if (event.shiftKey || event.altKey) return
|
|
11557
|
+
if (String(event.key).toLowerCase() !== 'z') return
|
|
11558
|
+
if (isTypingTarget(event.target)) return
|
|
11559
|
+
event.preventDefault()
|
|
11560
|
+
void runUndo()
|
|
11561
|
+
}
|
|
11562
|
+
window.addEventListener('keydown', onKey)
|
|
11563
|
+
return () => window.removeEventListener('keydown', onKey)
|
|
11564
|
+
}, [runUndo])
|
|
11565
|
+
|
|
10831
11566
|
// 兜底自动刷新:轮询已覆盖绝大部分,这里放长周期防漏(外部程序写入 fs.watch 漏报时)
|
|
10832
11567
|
React.useEffect(() => {
|
|
10833
11568
|
if (viewer !== null) return undefined
|
|
@@ -10987,6 +11722,17 @@ function AnnotationLayer({ t, annotations, onAdd, onRemove, active, dragging, fr
|
|
|
10987
11722
|
onClick: () => setSettingsOpen(true),
|
|
10988
11723
|
}, '⚙')
|
|
10989
11724
|
|
|
11725
|
+
// 导出记录入口(v1.6.2):常驻在标题栏,不依赖「有没有选中」——
|
|
11726
|
+
// 老板要的就是隔天/换个对话还能把上次导的清单拎出来用。
|
|
11727
|
+
const exportHistoryBtn = h('button', {
|
|
11728
|
+
type: 'button',
|
|
11729
|
+
key: 'exportHistory',
|
|
11730
|
+
className: 'dg-btn dg-btnIcon',
|
|
11731
|
+
'data-gallery-export-history': true,
|
|
11732
|
+
title: t('exportHistoryHint'),
|
|
11733
|
+
onClick: () => { openExportHistory() },
|
|
11734
|
+
}, '\u{1F4C1}')
|
|
11735
|
+
|
|
10990
11736
|
const header = h('div', { className: 'dg-header', key: 'header' }, [
|
|
10991
11737
|
h('div', { className: 'dg-headerInfo', key: 'info' }, [
|
|
10992
11738
|
h('span', { className: 'dg-title', key: 'title' },
|
|
@@ -11035,6 +11781,7 @@ function AnnotationLayer({ t, annotations, onAdd, onRemove, active, dragging, fr
|
|
|
11035
11781
|
return !v
|
|
11036
11782
|
}),
|
|
11037
11783
|
}, batchMode ? t('batchModeExit') : t('batchModeEnter')),
|
|
11784
|
+
exportHistoryBtn,
|
|
11038
11785
|
settingsBtn,
|
|
11039
11786
|
h('button', {
|
|
11040
11787
|
type: 'button',
|
|
@@ -11352,6 +12099,13 @@ function AnnotationLayer({ t, annotations, onAdd, onRemove, active, dragging, fr
|
|
|
11352
12099
|
title: t('batchCopyHint'),
|
|
11353
12100
|
onClick: () => { void doCopyAssets([...selected]) },
|
|
11354
12101
|
}, `⧉ ${t('batchCopyFiles')} (${selectedCount})`),
|
|
12102
|
+
// v1.5.0 导出交付清单:CSV 进 Excel 做物料表、JSON 给下一轮/脚本读
|
|
12103
|
+
h('button', {
|
|
12104
|
+
type: 'button', className: 'dg-btn dg-btnSmall', key: 'exportManifest',
|
|
12105
|
+
'data-gallery-batch-export': true,
|
|
12106
|
+
title: t('batchExportHint'),
|
|
12107
|
+
onClick: () => { void doExportManifest([...selected]) },
|
|
12108
|
+
}, `\u{1F4CB} ${t('batchExportManifest')} (${selectedCount})`),
|
|
11355
12109
|
// 2026-11-25 批量删除:一次删掉全部选中,二次确认后不可恢复
|
|
11356
12110
|
h('button', {
|
|
11357
12111
|
type: 'button', className: 'dg-btn dg-btnSmall dg-dangerBtn', key: 'deleteSel',
|
|
@@ -11696,13 +12450,16 @@ function AnnotationLayer({ t, annotations, onAdd, onRemove, active, dragging, fr
|
|
|
11696
12450
|
|
|
11697
12451
|
if (useGroups) {
|
|
11698
12452
|
|
|
11699
|
-
const cardFor = (item, groupKey, listForViewer, groupMeta) => {
|
|
12453
|
+
const cardFor = (item, groupKey, listForViewer, groupMeta, nameCounts) => {
|
|
11700
12454
|
// 分组里的文件也走同一套卡片组件
|
|
11701
12455
|
const enriched = {
|
|
11702
12456
|
...item,
|
|
11703
12457
|
name: item.name ?? item.relPath.split('/').pop(),
|
|
11704
12458
|
extension: item.extension ?? ('.' + (item.relPath.split('.').pop() || '')),
|
|
11705
12459
|
}
|
|
12460
|
+
// v1.6.3:同名统计由调用方算一次传进来(这里不再逐卡重算 O(n),
|
|
12461
|
+
// 「再显示」把一组堆到上千张时逐卡重算会明显卡顿)。
|
|
12462
|
+
const sameNames = nameCounts instanceof Map ? nameCounts : countNamesOf(listForViewer)
|
|
11706
12463
|
// 音视频分组视图:必须走 MediaCard,否则会被当成图片卡片渲染(v0.10.1)
|
|
11707
12464
|
if (kind === 'media') {
|
|
11708
12465
|
return wrapCard(h(MediaCard, {
|
|
@@ -11756,6 +12513,7 @@ function AnnotationLayer({ t, annotations, onAdd, onRemove, active, dragging, fr
|
|
|
11756
12513
|
item: enriched,
|
|
11757
12514
|
t,
|
|
11758
12515
|
limiter: limiter.current,
|
|
12516
|
+
nameCounts: sameNames,
|
|
11759
12517
|
onContextMenu: openContextMenu,
|
|
11760
12518
|
// v0.17.0:双击写进输入框
|
|
11761
12519
|
onDoubleClick: (target, event) => { handleCardDoubleClick(target, event) },
|
|
@@ -11778,6 +12536,8 @@ function AnnotationLayer({ t, annotations, onAdd, onRemove, active, dragging, fr
|
|
|
11778
12536
|
// 左侧会话列表快照只取一次:宿主渐进渲染,折叠行不在 DOM,
|
|
11779
12537
|
// 因此按「ID + 归一化标题」双重判定,而不是逐组查行是否存在。
|
|
11780
12538
|
const sidebarSnapshot = readSidebarSessions()
|
|
12539
|
+
// v1.6.4:共用归属索引(整块只建一次;后端给了 sharedCount 时只作兜底)
|
|
12540
|
+
const shareInfo = shareIndexOf(data)
|
|
11781
12541
|
const groupNodes = data.groups.map((group, gi) => {
|
|
11782
12542
|
const groupKey = group.sessionId ?? '__history__'
|
|
11783
12543
|
const isOpen = openGroups.has(groupKey)
|
|
@@ -11789,6 +12549,16 @@ function AnnotationLayer({ t, annotations, onAdd, onRemove, active, dragging, fr
|
|
|
11789
12549
|
const allFiles = [...(Array.isArray(group.files) ? group.files : []), ...extra]
|
|
11790
12550
|
const visibleFiles = allFiles.filter(
|
|
11791
12551
|
(f) => categoryFilter[bucketOf(f)] !== false)
|
|
12552
|
+
// v1.6.3:本组同名表(每组算一次)
|
|
12553
|
+
const groupNameCounts = countNamesOf(visibleFiles)
|
|
12554
|
+
// v1.6.4:跨对话共用。后端按**全量**算好(前端每组只拿 60 条,自己数会偏小);
|
|
12555
|
+
// 旧版后端没有这个字段时,退回前端按已加载条目录算。
|
|
12556
|
+
const sharedCount = typeof group.sharedCount === 'number'
|
|
12557
|
+
? group.sharedCount
|
|
12558
|
+
: (shareInfo.countByGroup.get(group) ?? 0)
|
|
12559
|
+
const sharedPeers = Array.isArray(group.sharedPeers)
|
|
12560
|
+
? group.sharedPeers
|
|
12561
|
+
: sharedPeersOf(group, shareInfo)
|
|
11792
12562
|
|
|
11793
12563
|
const chips = []
|
|
11794
12564
|
if (group.counts.final > 0) {
|
|
@@ -11852,6 +12622,15 @@ function AnnotationLayer({ t, annotations, onAdd, onRemove, active, dragging, fr
|
|
|
11852
12622
|
h('span', { className: 'dg-groupDate', key: 'd' },
|
|
11853
12623
|
group.isHistory ? format(t('groupFiles'), { n: group.fileCount }) : formatTime(group.createdAt)),
|
|
11854
12624
|
h('span', { className: 'dg-groupChips', key: 'c' }, chips),
|
|
12625
|
+
// v1.6.4:共用归属标注 —— 只在真有共用件时出现,「历史资产」池不标
|
|
12626
|
+
sharedCount > 0 && group.isHistory !== true
|
|
12627
|
+
? h('span', {
|
|
12628
|
+
className: 'dg-groupShared',
|
|
12629
|
+
key: 'sh',
|
|
12630
|
+
'data-gallery-group-shared': String(sharedCount),
|
|
12631
|
+
title: sharedTipOf(t, sharedCount, sharedPeers),
|
|
12632
|
+
}, format(t('groupShared'), { n: sharedCount }))
|
|
12633
|
+
: null,
|
|
11855
12634
|
]),
|
|
11856
12635
|
isOpen
|
|
11857
12636
|
? [
|
|
@@ -11872,7 +12651,7 @@ function AnnotationLayer({ t, annotations, onAdd, onRemove, active, dragging, fr
|
|
|
11872
12651
|
h('div', { className: 'dg-groupBody', key: 'body' }, [
|
|
11873
12652
|
visibleFiles.length > 0
|
|
11874
12653
|
? h('div', { className: `dg-grid${kind === 'file' ? ' dg-fileGrid' : ''}`, key: 'grid' },
|
|
11875
|
-
visibleFiles.map((f) => cardFor(f, headKey, visibleFiles, group)))
|
|
12654
|
+
visibleFiles.map((f) => cardFor(f, headKey, visibleFiles, group, groupNameCounts)))
|
|
11876
12655
|
: h('div', { className: 'dg-groupEmpty', key: 'empty' }, t('groupEmpty')),
|
|
11877
12656
|
allFiles.length < Number(group.fileCount ?? 0)
|
|
11878
12657
|
? h('button', {
|
|
@@ -11964,6 +12743,9 @@ function AnnotationLayer({ t, annotations, onAdd, onRemove, active, dragging, fr
|
|
|
11964
12743
|
onContextMenu: openContextMenu,
|
|
11965
12744
|
}), item, item.relPath))
|
|
11966
12745
|
|
|
12746
|
+
// v1.6.3:扁平视图(当前对话)也按同一份同名表标注目录,
|
|
12747
|
+
// 否则「图片」视图会与分组视图两套口径(分组有提示、扁平没有)。
|
|
12748
|
+
const flatNameCounts = countNamesOf(visibleItems)
|
|
11967
12749
|
const gridChildren = visibleItems.map((item) => wrapCard(kind === 'file'
|
|
11968
12750
|
? h(FileCard, {
|
|
11969
12751
|
key: item.relPath,
|
|
@@ -11994,6 +12776,7 @@ function AnnotationLayer({ t, annotations, onAdd, onRemove, active, dragging, fr
|
|
|
11994
12776
|
item,
|
|
11995
12777
|
t,
|
|
11996
12778
|
limiter: limiter.current,
|
|
12779
|
+
nameCounts: flatNameCounts,
|
|
11997
12780
|
onContextMenu: openContextMenu,
|
|
11998
12781
|
// v0.17.0:双击写进输入框(扁平视图)
|
|
11999
12782
|
onDoubleClick: (target, event) => { handleCardDoubleClick(target, event) },
|
|
@@ -12174,6 +12957,103 @@ function AnnotationLayer({ t, annotations, onAdd, onRemove, active, dragging, fr
|
|
|
12174
12957
|
})
|
|
12175
12958
|
: null
|
|
12176
12959
|
|
|
12960
|
+
/**
|
|
12961
|
+
* 导出记录面板(v1.6.2)。
|
|
12962
|
+
* 列表只做三件事:说清「这批是哪来的、什么时候、多少条」,并允许再引用一次。
|
|
12963
|
+
* 每条的「写进输入框」把 CSV 绝对路径递给助手 —— 这是老板要的「以后还能用」。
|
|
12964
|
+
*/
|
|
12965
|
+
const exportRowAction = (label, onClick, disabled) => h('button', {
|
|
12966
|
+
type: 'button',
|
|
12967
|
+
className: 'dg-btn dg-btnSmall',
|
|
12968
|
+
key: `act-${label}`,
|
|
12969
|
+
disabled: disabled === true,
|
|
12970
|
+
onClick,
|
|
12971
|
+
}, label)
|
|
12972
|
+
const exportRows = exportHistory.status === 'failed'
|
|
12973
|
+
? [h('div', { className: 'dg-exportEmpty dg-exportFail', key: 'failed' },
|
|
12974
|
+
format(t('exportHistoryFailed'), { message: String(exportHistory.message ?? '') }))]
|
|
12975
|
+
: exportHistory.items.length === 0
|
|
12976
|
+
? [h('div', { className: 'dg-exportEmpty', key: 'empty' },
|
|
12977
|
+
exportHistory.status === 'loading' ? t('exportHistoryLoading') : t('exportHistoryEmpty'))]
|
|
12978
|
+
: exportHistory.items.map((row, index) => {
|
|
12979
|
+
const file = String(row?.file ?? '')
|
|
12980
|
+
if (file === '') return null
|
|
12981
|
+
const full = exportHistory.dir === '' ? file : `${exportHistory.dir}\\${file}`
|
|
12982
|
+
const exists = row?.exists !== false
|
|
12983
|
+
const at = Number(row?.at) || 0
|
|
12984
|
+
const total = Number(row?.total)
|
|
12985
|
+
const src = String(row?.sessionTitle ?? '') !== ''
|
|
12986
|
+
? String(row.sessionTitle)
|
|
12987
|
+
: (row?.scope === 'global'
|
|
12988
|
+
? t('exportHistoryGlobal')
|
|
12989
|
+
: (row?.legacy === true ? t('exportHistoryLegacy') : t('exportHistoryUnknownSource')))
|
|
12990
|
+
const meta = [
|
|
12991
|
+
src,
|
|
12992
|
+
at > 0 ? formatTime(at) : '',
|
|
12993
|
+
Number.isFinite(total) && total > 0 ? format(t('exportHistoryCount'), { n: total }) : '',
|
|
12994
|
+
exists ? '' : t('exportHistoryMissing'),
|
|
12995
|
+
].filter((x) => x !== '').join(' · ')
|
|
12996
|
+
return h('div', { className: 'dg-exportRow', key: `export${index}`, 'data-gallery-export-row': index }, [
|
|
12997
|
+
h('div', { className: 'dg-exportMain', key: 'main' }, [
|
|
12998
|
+
h('div', { className: 'dg-exportName', key: 'name', title: file }, file),
|
|
12999
|
+
h('div', { className: `dg-exportMeta${exists ? '' : ' dg-exportMetaGone'}`, key: 'meta' }, meta),
|
|
13000
|
+
]),
|
|
13001
|
+
h('div', { className: 'dg-exportActs', key: 'acts' }, [
|
|
13002
|
+
exportRowAction(t('exportToComposer'), () => {
|
|
13003
|
+
void writeDraftToComposer(`交付清单${Number.isFinite(total) && total > 0 ? `(${total} 条)` : ''}:${full}`, sessionId)
|
|
13004
|
+
.then((result) => {
|
|
13005
|
+
if (result?.ok === true) showPasteNotice('ok', t('exportDraftReady'))
|
|
13006
|
+
else { void copyText(full); showPasteNotice('fail', t('exportDraftInClipboard')) }
|
|
13007
|
+
})
|
|
13008
|
+
.catch(() => {
|
|
13009
|
+
void copyText(full)
|
|
13010
|
+
showPasteNotice('fail', t('exportDraftInClipboard'))
|
|
13011
|
+
})
|
|
13012
|
+
}, !exists),
|
|
13013
|
+
exportRowAction(t('exportCopyPath'), () => {
|
|
13014
|
+
void copyText(full).then((ok) => {
|
|
13015
|
+
showPasteNotice(ok ? 'ok' : 'fail', ok ? t('exportPathCopied') : t('exportPathCopyFailed'))
|
|
13016
|
+
})
|
|
13017
|
+
}, !exists),
|
|
13018
|
+
]),
|
|
13019
|
+
])
|
|
13020
|
+
}).filter((node) => node !== null)
|
|
13021
|
+
|
|
13022
|
+
const exportHistoryLayer = exportHistoryOpen
|
|
13023
|
+
? h('div', { className: 'dg-settingsLayer', key: 'exportHistoryLayer' }, [
|
|
13024
|
+
h('div', { className: 'dg-settings dg-exportPanel', 'data-gallery-export-panel': true }, [
|
|
13025
|
+
h('div', { className: 'dg-settingsHead', key: 'head' }, [
|
|
13026
|
+
h('span', { className: 'dg-settingsTitle', key: 'title' }, t('exportHistoryTitle')),
|
|
13027
|
+
h('button', {
|
|
13028
|
+
type: 'button', className: 'dg-btn dg-btnSmall', key: 'refresh',
|
|
13029
|
+
'data-gallery-export-refresh': true,
|
|
13030
|
+
onClick: () => { void loadExportHistory() },
|
|
13031
|
+
}, t('exportHistoryRefresh')),
|
|
13032
|
+
h('button', {
|
|
13033
|
+
type: 'button', className: 'dg-btn dg-btnSmall', key: 'close',
|
|
13034
|
+
'data-gallery-export-close': true,
|
|
13035
|
+
onClick: () => setExportHistoryOpen(false),
|
|
13036
|
+
}, '✕'),
|
|
13037
|
+
]),
|
|
13038
|
+
h('div', { className: 'dg-exportHint', key: 'hint' }, t('exportHistoryHint')),
|
|
13039
|
+
h('div', { className: 'dg-exportList', key: 'list' }, exportRows),
|
|
13040
|
+
h('div', { className: 'dg-exportFoot', key: 'foot' }, [
|
|
13041
|
+
h('span', { className: 'dg-exportDir', key: 'dir', title: exportHistory.dir }, exportHistory.dir),
|
|
13042
|
+
h('button', {
|
|
13043
|
+
type: 'button', className: 'dg-btn dg-btnSmall', key: 'open',
|
|
13044
|
+
onClick: () => {
|
|
13045
|
+
void callHost('openExportDir', {}).then((r) => {
|
|
13046
|
+
if (r?.ok === false) throw new Error(r?.error?.message ?? t('exportOpenFailed'))
|
|
13047
|
+
}).catch((error) => {
|
|
13048
|
+
showPasteNotice('fail', format(t('exportOpenFailed'), { message: String(error?.message ?? error) }))
|
|
13049
|
+
})
|
|
13050
|
+
},
|
|
13051
|
+
}, t('exportOpenDir')),
|
|
13052
|
+
]),
|
|
13053
|
+
]),
|
|
13054
|
+
])
|
|
13055
|
+
: null
|
|
13056
|
+
|
|
12177
13057
|
// 反馈篮(S3-a):列出已标记条目 + 带批注的卡片(v0.14.3 批注并入反馈)
|
|
12178
13058
|
// 批注属于「反馈」这一侧:它不进 marks(不参与表态/筛选/落盘),
|
|
12179
13059
|
// 但只要有批注,这张卡就出现在反馈篮里,草稿会按 Annotation N 逐条带出说明与框选区域。
|
|
@@ -12424,6 +13304,7 @@ function AnnotationLayer({ t, annotations, onAdd, onRemove, active, dragging, fr
|
|
|
12424
13304
|
viewerLayer,
|
|
12425
13305
|
mediaLayer,
|
|
12426
13306
|
settingsLayer,
|
|
13307
|
+
exportHistoryLayer,
|
|
12427
13308
|
ctxLayer,
|
|
12428
13309
|
pasteLayer,
|
|
12429
13310
|
confirmLayer,
|
|
@@ -12434,10 +13315,29 @@ function AnnotationLayer({ t, annotations, onAdd, onRemove, active, dragging, fr
|
|
|
12434
13315
|
? null
|
|
12435
13316
|
: h('div', {
|
|
12436
13317
|
className: 'dg-pasteNotice'
|
|
12437
|
-
+ (pasteNotice.kind === 'ok' ? ' dg-pasteOk' : ' dg-pasteFail')
|
|
13318
|
+
+ (pasteNotice.kind === 'ok' ? ' dg-pasteOk' : ' dg-pasteFail')
|
|
13319
|
+
+ (pasteNotice.actions === null ? '' : ' dg-pasteNoticeAction'),
|
|
12438
13320
|
key: 'pasteNotice',
|
|
12439
13321
|
'data-gallery-paste-notice': pasteNotice.kind,
|
|
12440
|
-
},
|
|
13322
|
+
}, [
|
|
13323
|
+
h('span', { className: 'dg-pasteText', key: 'text' }, pasteNotice.text),
|
|
13324
|
+
pasteNotice.actions === null
|
|
13325
|
+
? null
|
|
13326
|
+
: h('span', { className: 'dg-pasteBtns', key: 'btns' },
|
|
13327
|
+
pasteNotice.actions.map((action, index) => h('button', {
|
|
13328
|
+
type: 'button',
|
|
13329
|
+
className: 'dg-pasteBtn',
|
|
13330
|
+
key: `a${index}`,
|
|
13331
|
+
'data-gallery-paste-action': index,
|
|
13332
|
+
// 按下就 preventDefault:别让按钮抢走焦点,也别触发网格的键盘处理
|
|
13333
|
+
onMouseDown: (event) => event.preventDefault(),
|
|
13334
|
+
onClick: () => {
|
|
13335
|
+
// 先收掉提示,再执行;执行完自己会给新提示(或不需要)
|
|
13336
|
+
setPasteNotice(null)
|
|
13337
|
+
try { action.onClick?.() } catch (error) { console.warn('dsh-gallery: 提示按钮失败', error) }
|
|
13338
|
+
},
|
|
13339
|
+
}, action.label))),
|
|
13340
|
+
]),
|
|
12441
13341
|
])
|
|
12442
13342
|
}
|
|
12443
13343
|
|