refactor: remove old autocomplete completely

This commit is contained in:
Jin 2026-03-09 23:41:41 +00:00 committed by JYC333
parent 99937bd8f4
commit d1fc4780b7
7 changed files with 36350 additions and 29 deletions

View File

@ -249,7 +249,7 @@
---
### Step 9: 移除旧库和 Polyfill
### Step 9: 移除旧库和 Polyfill ✅ 完成
**文件变更:**
- `apps/client/package.json` — 移除 `"autocomplete.js": "0.38.1"`
- `apps/client/src/desktop.ts` — 移除 `import "autocomplete.js/index_jquery.js";`
@ -261,6 +261,13 @@
- 完整回归测试
- 构建无错误
**当前完成情况:**
- ✅ 代码中的 `autocomplete.js` 入口 import 与仅为旧库保留的 jQuery 4 polyfill 已移除。
- ✅ `apps/client/package.json` 已删除 `autocomplete.js` 依赖声明。
- ✅ `pnpm install` 已执行完成lockfile / 安装状态已同步。
- ✅ `pnpm exec tsc -p apps/client/tsconfig.app.json --noEmit` 已通过。
- ✅ `pnpm run --filter @triliumnext/client build` 已通过。
---
### Step 10: 更新 E2E 测试

View File

@ -45,7 +45,6 @@
"@univerjs/preset-sheets-sort": "0.17.0",
"@univerjs/presets": "0.17.0",
"@zumer/snapdom": "2.5.0",
"autocomplete.js": "0.38.1",
"bootstrap": "5.3.8",
"boxicons": "2.1.4",
"clsx": "2.1.1",
@ -93,4 +92,4 @@
"script-loader": "0.7.2",
"vite-plugin-static-copy": "3.3.0"
}
}
}

View File

@ -1,5 +1,3 @@
import "autocomplete.js/index_jquery.js";
import type ElectronRemote from "@electron/remote";
import type Electron from "electron";

View File

@ -16,17 +16,6 @@ async function initJQuery() {
const $ = (await import("jquery")).default;
window.$ = $;
window.jQuery = $;
// Polyfill removed jQuery methods for autocomplete.js compatibility
($ as any).isArray = Array.isArray;
($ as any).isFunction = function(obj: any) { return typeof obj === 'function'; };
($ as any).isPlainObject = function(obj: any) {
if (obj == null || typeof obj !== 'object') { return false; }
const proto = Object.getPrototypeOf(obj);
if (proto === null) { return true; }
const Ctor = Object.prototype.hasOwnProperty.call(proto, 'constructor') && proto.constructor;
return typeof Ctor === 'function' && Ctor === Object;
};
}
async function setupGlob() {

View File

@ -1,5 +1,3 @@
import "autocomplete.js/index_jquery.js";
import appContext from "./components/app_context.js";
import glob from "./services/glob.js";
import noteAutocompleteService from "./services/note_autocomplete.js";

View File

@ -8,17 +8,6 @@ async function loadBootstrap() {
}
}
// Polyfill removed jQuery methods for autocomplete.js compatibility
($ as any).isArray = Array.isArray;
($ as any).isFunction = function(obj: any) { return typeof obj === 'function'; };
($ as any).isPlainObject = function(obj: any) {
if (obj == null || typeof obj !== 'object') { return false; }
const proto = Object.getPrototypeOf(obj);
if (proto === null) { return true; }
const Ctor = Object.prototype.hasOwnProperty.call(proto, 'constructor') && proto.constructor;
return typeof Ctor === 'function' && Ctor === Object;
};
(window as any).$ = $;
(window as any).jQuery = $;
await loadBootstrap();

36341
pnpm-lock.yaml generated Normal file

File diff suppressed because it is too large Load Diff