Repository navigation
v0.1.15
🐞 修复:旧版 WebView 打开 PDF 直接失败
部分 Android 设备报 「PDF 打开失败:Promise.withResolvers is not a function」,PDF 完全打不开。
原因:pdfjs-dist 4.x 使用了 Promise.withResolvers(ES2024,需要 Chrome 119+),而 Vite 的 build.target 只做语法降级、不会补 API;系统 WebView 版本偏低的机器(Chrome < 119)一打开 PDF 就抛错。
修复:
- 新增
src/lib/polyfills.js:纯语句 + 全部特性检测(现代浏览器上完全是 no-op),补齐Promise.withResolvers / any / allSettled / try、Array/String的at/findLast/toSorted/toReversed/toSpliced/with、replaceAll、Object.hasOwn/fromEntries/groupBy、Map.groupBy、Set集合运算、URL.canParse、AbortSignal.timeout、structuredClone main.jsx最先导入该补丁,确保在App → pdfEngine → pdfjs求值前完成打补丁vite.config.js新增pdfWorkerPolyfills插件:把同一份补丁原样前置进 pdfjs 的 worker 产物(worker 是独立线程,主线程补丁到不了它,而 worker 里同样调用了这些 API)——构建日志里 worker 体积 +14.2 kB 就是注入结果- 新增
npm run verify:polyfills(tools/verify-polyfills.mjs):先删掉 27 个 API 模拟旧 WebView,再加载补丁逐项断言行为,作为回归守卫
💡 仍建议在设备上更新「Android System WebView」/ Chrome,以获得完整性能与新特性支持。
产物说明
app-debug.apk— debug 签名,直接安装即用app-release-unsigned.apk— 未签名,需自行apksigner签名后安装Note-Studio-0.1.15-Windows.exe— Windows 便携版
⚠️ 三个产物均为本机构建,包含被.gitignore排除的 PDF 工作室运行时(dart-pdf-editor/open-pdf-studio);CI 干净 checkout 构建不出这些目录,同名覆盖了 CI 上传的缺运行时版本。
Full Changelog: v0.1.14...v0.1.15