feat: 0.8.0 文件夹对比深度增强与字符级逐组预算制 - 按扩展名多选过滤(第四维过滤与其他条件取交集、N/总数计数切换)、目录行双击聚合对比(差异导航限定子树内批量审查、双击文件回全局、空差异提示与折叠态自愈)、增量重扫(size+mtime指纹一致零IO沿用、语义开关翻转按semSame纯内存组合零IO、unreadable不缓存与截断弃缓存、重新扫描按钮)、字符级变更组逐组预算制(超限组仅行级配对输出不再牵连其余组、charModePartial部分降级标记与报告说明、全部组降级仍整体降级)、拖拽导入E2E(dropFiles合成DataTransfer覆盖decodeBuffer IPC全链路4用例)、文档与版本号同步
This commit is contained in:
@@ -93,3 +93,30 @@ export async function pasteText(window: Page, side: 'left' | 'right', text: stri
|
||||
await window.getByPlaceholder(/粘贴或输入/).fill(text)
|
||||
await window.getByRole('button', { name: '开始对比' }).click()
|
||||
}
|
||||
|
||||
/**
|
||||
* 向指定选择器元素派发合成拖放(真实 Chromium 支持 DataTransfer/DragEvent 构造)。
|
||||
* 覆盖渲染进程拖拽导入全链路:dropPane 走 file.arrayBuffer → decodeBuffer IPC → 编码探测。
|
||||
* 先派发 dragover(preventDefault 激活 drop 目标)再派发 drop。
|
||||
*/
|
||||
export async function dropFiles(
|
||||
window: Page,
|
||||
selector: string,
|
||||
files: { name: string; content: string; type?: string }[]
|
||||
): Promise<void> {
|
||||
await window.evaluate(
|
||||
({ sel, specs }) => {
|
||||
const el = document.querySelector(sel)
|
||||
if (!el) throw new Error(`dropFiles: selector not found: ${sel}`)
|
||||
const dt = new DataTransfer()
|
||||
for (const f of specs) {
|
||||
dt.items.add(new File([f.content], f.name, { type: f.type ?? 'text/plain' }))
|
||||
}
|
||||
el.dispatchEvent(
|
||||
new DragEvent('dragover', { bubbles: true, cancelable: true, dataTransfer: dt })
|
||||
)
|
||||
el.dispatchEvent(new DragEvent('drop', { bubbles: true, cancelable: true, dataTransfer: dt }))
|
||||
},
|
||||
{ sel: selector, specs: files }
|
||||
)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user