feat: consolidate local-first mnote web runtime

This commit is contained in:
lix-2026
2026-05-28 22:01:44 +08:00
parent 7354807ee9
commit 39b9a0183a
154 changed files with 13591 additions and 12728 deletions
@@ -84,6 +84,20 @@ async function waitForFileExists(filePath, timeoutMs) {
assert(fs.existsSync(filePath), `等待文件出现失败: ${filePath}`);
}
async function expandFileTreeFolder(page, title) {
const folderRow = page.locator('#sidebar-file-tree-root .tree-row[data-row-kind="folder"]', { hasText: title }).first();
await folderRow.waitFor({ state: "visible", timeout: UI_TIMEOUT_MS });
const expanded = await folderRow.getAttribute("aria-expanded");
if (expanded !== "true") {
const toggle = folderRow.locator('[data-rust-action="toggle"]').first();
if (await toggle.count()) {
await toggle.click({ timeout: UI_TIMEOUT_MS });
} else {
await folderRow.click({ timeout: UI_TIMEOUT_MS });
}
}
}
function suggestedFilenames(downloads, startIndex) {
return downloads.slice(startIndex).map((download) => download.suggestedFilename()).sort();
}
@@ -145,6 +159,7 @@ async function main() {
}).catch(() => undefined);
const editorReady = await editorSurface.isVisible().catch(() => false);
await expandFileTreeFolder(page, "README");
const assetRow = page.locator('[data-testid="filetree-asset-row"]', { hasText: "report-a.pdf" }).first();
await assetRow.waitFor({ state: "visible", timeout: UI_TIMEOUT_MS });
await assetRow.click({ button: "right", timeout: UI_TIMEOUT_MS });