fix: 让 filetree 右键删除复用批量选择
This commit is contained in:
@@ -3834,6 +3834,13 @@ const SIDEBAR_TREE_JS: &str = r##"
|
|||||||
void copyTreeContextValue(documentId || detail.assetId || detail.rowId || '', 'copy-id');
|
void copyTreeContextValue(documentId || detail.assetId || detail.rowId || '', 'copy-id');
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
if (action === 'delete-trash' && detail.contextKind === 'filetree') {
|
||||||
|
var selectedFileTreeRows = selectedSidebarFileTreeRows();
|
||||||
|
if (selectedFileTreeRows.length > 1) {
|
||||||
|
void deleteSelectedSidebarFileTreeRows(trigger || document.body);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
if (action === 'delete-trash' && isAsset) {
|
if (action === 'delete-trash' && isAsset) {
|
||||||
if (!window.confirm('确定要将“' + title + '”删除到垃圾桶吗?')) return;
|
if (!window.confirm('确定要将“' + title + '”删除到垃圾桶吗?')) return;
|
||||||
recordFileTreeAction('delete-trash', detail);
|
recordFileTreeAction('delete-trash', detail);
|
||||||
@@ -10127,6 +10134,8 @@ mod tests {
|
|||||||
fn sidebar_filetree_delete_keys_support_mixed_doc_and_asset_selection() {
|
fn sidebar_filetree_delete_keys_support_mixed_doc_and_asset_selection() {
|
||||||
assert!(SIDEBAR_TREE_JS.contains("function deleteSelectedSidebarFileTreeRows"));
|
assert!(SIDEBAR_TREE_JS.contains("function deleteSelectedSidebarFileTreeRows"));
|
||||||
assert!(SIDEBAR_TREE_JS.contains("event.key === 'Delete' || event.key === 'Backspace'"));
|
assert!(SIDEBAR_TREE_JS.contains("event.key === 'Delete' || event.key === 'Backspace'"));
|
||||||
|
assert!(SIDEBAR_TREE_JS.contains("selectedFileTreeRows.length > 1"));
|
||||||
|
assert!(SIDEBAR_TREE_JS.contains("deleteSelectedSidebarFileTreeRows(trigger || document.body)"));
|
||||||
assert!(SIDEBAR_TREE_JS.contains(
|
assert!(SIDEBAR_TREE_JS.contains(
|
||||||
"currentSourceKind() === 'local_folder' && fileTreeRowKind(row) === 'asset'"
|
"currentSourceKind() === 'local_folder' && fileTreeRowKind(row) === 'asset'"
|
||||||
));
|
));
|
||||||
|
|||||||
@@ -130,11 +130,13 @@ async function main() {
|
|||||||
await dialog.accept();
|
await dialog.accept();
|
||||||
return message;
|
return message;
|
||||||
});
|
});
|
||||||
await page.locator(selectors[1]).press("Delete", {
|
await page.locator(selectors[1]).click({
|
||||||
|
button: "right",
|
||||||
timeout: UI_TIMEOUT_MS,
|
timeout: UI_TIMEOUT_MS,
|
||||||
});
|
});
|
||||||
|
await page.locator('.mnote-tree-context-menu__item[data-action="delete-trash"]').click({ timeout: UI_TIMEOUT_MS });
|
||||||
const confirmText = await dialogPromise;
|
const confirmText = await dialogPromise;
|
||||||
assert.match(confirmText, /2 个附件/, `bulk delete 确认文案应包含附件数量: ${confirmText}`);
|
assert.match(confirmText, /2 个附件/, `右键 bulk delete 确认文案应包含附件数量: ${confirmText}`);
|
||||||
|
|
||||||
await page.waitForFunction(() => document.documentElement.getAttribute("data-mnote-filetree-bulk-delete-applied") === "true", null, {
|
await page.waitForFunction(() => document.documentElement.getAttribute("data-mnote-filetree-bulk-delete-applied") === "true", null, {
|
||||||
timeout: UI_TIMEOUT_MS,
|
timeout: UI_TIMEOUT_MS,
|
||||||
|
|||||||
Reference in New Issue
Block a user