🐛 Fixed the issue of scroll wheel modifying font size and the problem of automatic language detection failing

This commit is contained in:
2026-03-28 22:35:09 +08:00
parent 6e49516962
commit 03191a219f
8 changed files with 216 additions and 141 deletions

View File

@@ -78,7 +78,7 @@
"eslint-plugin-vue": "^10.6.2", "eslint-plugin-vue": "^10.6.2",
"globals": "^16.5.0", "globals": "^16.5.0",
"typescript": "^5.9.3", "typescript": "^5.9.3",
"typescript-eslint": "^8.50.1", "typescript-eslint": "^8.51.0",
"unplugin-vue-components": "^30.0.0", "unplugin-vue-components": "^30.0.0",
"vite": "npm:rolldown-vite@latest", "vite": "npm:rolldown-vite@latest",
"vite-plugin-node-polyfills": "^0.24.0", "vite-plugin-node-polyfills": "^0.24.0",
@@ -142,7 +142,6 @@
"resolved": "https://registry.npmmirror.com/@babel/parser/-/parser-7.28.5.tgz", "resolved": "https://registry.npmmirror.com/@babel/parser/-/parser-7.28.5.tgz",
"integrity": "sha512-KKBU1VGYR7ORr3At5HAtUQ+TV3SzRCXmA/8OdDZiLDBIZxVyzXuztPjfLd3BV1PRAQGCMWWSHYhL0F8d5uHBDQ==", "integrity": "sha512-KKBU1VGYR7ORr3At5HAtUQ+TV3SzRCXmA/8OdDZiLDBIZxVyzXuztPjfLd3BV1PRAQGCMWWSHYhL0F8d5uHBDQ==",
"license": "MIT", "license": "MIT",
"peer": true,
"dependencies": { "dependencies": {
"@babel/types": "^7.28.5" "@babel/types": "^7.28.5"
}, },
@@ -610,9 +609,9 @@
} }
}, },
"node_modules/@codemirror/view": { "node_modules/@codemirror/view": {
"version": "6.39.6", "version": "6.39.8",
"resolved": "https://registry.npmmirror.com/@codemirror/view/-/view-6.39.6.tgz", "resolved": "https://registry.npmmirror.com/@codemirror/view/-/view-6.39.8.tgz",
"integrity": "sha512-/N+SoP5NndJjkGInp3BwlUa3KQKD6bDo0TV6ep37ueAdQ7BVu/PqlZNywmgjCq0MQoZadZd8T+MZucSr7fktyQ==", "integrity": "sha512-1rASYd9Z/mE3tkbC9wInRlCNyCkSn+nLsiQKZhEDUUJiUfs/5FHDpCUDaQpoTIaNGeDc6/bhaEAyLmeEucEFPw==",
"license": "MIT", "license": "MIT",
"dependencies": { "dependencies": {
"@codemirror/state": "^6.5.0", "@codemirror/state": "^6.5.0",
@@ -1341,13 +1340,13 @@
} }
}, },
"node_modules/@intlify/core-base": { "node_modules/@intlify/core-base": {
"version": "11.2.7", "version": "11.2.8",
"resolved": "https://registry.npmmirror.com/@intlify/core-base/-/core-base-11.2.7.tgz", "resolved": "https://registry.npmmirror.com/@intlify/core-base/-/core-base-11.2.8.tgz",
"integrity": "sha512-+Ra9I/LAzXDnmv/IrTO03WMCiLya7pHRmGJvNl9fKwx/W4REJ0xaMk2PxCRqnxcBsX443amEMdebQ3R1geiuIw==", "integrity": "sha512-nBq6Y1tVkjIUsLsdOjDSJj4AsjvD0UG3zsg9Fyc+OivwlA/oMHSKooUy9tpKj0HqZ+NWFifweHavdljlBLTwdA==",
"license": "MIT", "license": "MIT",
"dependencies": { "dependencies": {
"@intlify/message-compiler": "11.2.7", "@intlify/message-compiler": "11.2.8",
"@intlify/shared": "11.2.7" "@intlify/shared": "11.2.8"
}, },
"engines": { "engines": {
"node": ">= 16" "node": ">= 16"
@@ -1357,12 +1356,12 @@
} }
}, },
"node_modules/@intlify/message-compiler": { "node_modules/@intlify/message-compiler": {
"version": "11.2.7", "version": "11.2.8",
"resolved": "https://registry.npmmirror.com/@intlify/message-compiler/-/message-compiler-11.2.7.tgz", "resolved": "https://registry.npmmirror.com/@intlify/message-compiler/-/message-compiler-11.2.8.tgz",
"integrity": "sha512-TFamC+GzJAotAFwUNvbtRVBgvuSn2nCwKNresmPUHv3IIVMmXJt7QQJj/DORI1h8hs46ZF6L0Fs2xBohSOE4iQ==", "integrity": "sha512-A5n33doOjmHsBtCN421386cG1tWp5rpOjOYPNsnpjIJbQ4POF0QY2ezhZR9kr0boKwaHjbOifvyQvHj2UTrDFQ==",
"license": "MIT", "license": "MIT",
"dependencies": { "dependencies": {
"@intlify/shared": "11.2.7", "@intlify/shared": "11.2.8",
"source-map-js": "^1.0.2" "source-map-js": "^1.0.2"
}, },
"engines": { "engines": {
@@ -1373,9 +1372,9 @@
} }
}, },
"node_modules/@intlify/shared": { "node_modules/@intlify/shared": {
"version": "11.2.7", "version": "11.2.8",
"resolved": "https://registry.npmmirror.com/@intlify/shared/-/shared-11.2.7.tgz", "resolved": "https://registry.npmmirror.com/@intlify/shared/-/shared-11.2.8.tgz",
"integrity": "sha512-uvlkvc/0uQ4FDlHQZccpUnmcOwNcaI3i+69ck2YJ+GqM35AoVbuS63b+YfirV4G0SZh64Ij2UMcFRMmB4nr95w==", "integrity": "sha512-l6e4NZyUgv8VyXXH4DbuucFOBmxLF56C/mqh2tvApbzl2Hrhi1aTDcuv5TKdxzfHYmpO3UB0Cz04fgDT9vszfw==",
"license": "MIT", "license": "MIT",
"engines": { "engines": {
"node": ">= 16" "node": ">= 16"
@@ -2469,21 +2468,21 @@
"license": "MIT" "license": "MIT"
}, },
"node_modules/@toml-tools/lexer": { "node_modules/@toml-tools/lexer": {
"version": "1.0.0", "version": "1.0.1",
"resolved": "https://registry.npmmirror.com/@toml-tools/lexer/-/lexer-1.0.0.tgz", "resolved": "https://registry.npmmirror.com/@toml-tools/lexer/-/lexer-1.0.1.tgz",
"integrity": "sha512-rVoOC9FibF2CICwCBWQnYcjAEOmLCJExer178K2AsY0Nk9FjJNVoVJuR5UAtuq42BZOajvH+ainf6Gj2GpCnXQ==", "integrity": "sha512-jn2fl8m/9QPcUD507Hbt2W3TVMKzF5HEY8xKIxqY2r2dTG2udeCKlo2ejJ5k/RSOJsWNIuw+Ir/nxW5PItUApA==",
"license": "MIT", "license": "MIT",
"dependencies": { "dependencies": {
"chevrotain": "^11.0.1" "chevrotain": "^11.0.1"
} }
}, },
"node_modules/@toml-tools/parser": { "node_modules/@toml-tools/parser": {
"version": "1.0.0", "version": "1.0.1",
"resolved": "https://registry.npmmirror.com/@toml-tools/parser/-/parser-1.0.0.tgz", "resolved": "https://registry.npmmirror.com/@toml-tools/parser/-/parser-1.0.1.tgz",
"integrity": "sha512-j8cd3A3ccLHppGoWI69urbiVJslrpwI6sZ61ySDUPxM/FTkQWRx/JkkF8aipnl0Ds0feWXyjyvmWzn70mIohYg==", "integrity": "sha512-W+YdnB8KDgKjIqhoArEXjiTTPnKSXVvI/B+raHfou9+sip3rxhzVsELn46GG7dZyNHyu9pS+gYgYrdF9c5AQDg==",
"license": "MIT", "license": "MIT",
"dependencies": { "dependencies": {
"@toml-tools/lexer": "^1.0.0", "@toml-tools/lexer": "^1.0.1",
"chevrotain": "^11.0.1" "chevrotain": "^11.0.1"
} }
}, },
@@ -2865,23 +2864,25 @@
"resolved": "https://registry.npmmirror.com/@types/whatwg-mimetype/-/whatwg-mimetype-3.0.2.tgz", "resolved": "https://registry.npmmirror.com/@types/whatwg-mimetype/-/whatwg-mimetype-3.0.2.tgz",
"integrity": "sha512-c2AKvDT8ToxLIOUlN51gTiHXflsfIFisS4pO7pDPoKouJCESkhZnEy623gwP9laCy5lnLDAw1vAzu2vM2YLOrA==", "integrity": "sha512-c2AKvDT8ToxLIOUlN51gTiHXflsfIFisS4pO7pDPoKouJCESkhZnEy623gwP9laCy5lnLDAw1vAzu2vM2YLOrA==",
"dev": true, "dev": true,
"license": "MIT" "license": "MIT",
"optional": true,
"peer": true
}, },
"node_modules/@typescript-eslint/eslint-plugin": { "node_modules/@typescript-eslint/eslint-plugin": {
"version": "8.50.1", "version": "8.51.0",
"resolved": "https://registry.npmmirror.com/@typescript-eslint/eslint-plugin/-/eslint-plugin-8.50.1.tgz", "resolved": "https://registry.npmmirror.com/@typescript-eslint/eslint-plugin/-/eslint-plugin-8.51.0.tgz",
"integrity": "sha512-PKhLGDq3JAg0Jk/aK890knnqduuI/Qj+udH7wCf0217IGi4gt+acgCyPVe79qoT+qKUvHMDQkwJeKW9fwl8Cyw==", "integrity": "sha512-XtssGWJvypyM2ytBnSnKtHYOGT+4ZwTnBVl36TA4nRO2f4PRNGz5/1OszHzcZCvcBMh+qb7I06uoCmLTRdR9og==",
"dev": true, "dev": true,
"license": "MIT", "license": "MIT",
"dependencies": { "dependencies": {
"@eslint-community/regexpp": "^4.10.0", "@eslint-community/regexpp": "^4.10.0",
"@typescript-eslint/scope-manager": "8.50.1", "@typescript-eslint/scope-manager": "8.51.0",
"@typescript-eslint/type-utils": "8.50.1", "@typescript-eslint/type-utils": "8.51.0",
"@typescript-eslint/utils": "8.50.1", "@typescript-eslint/utils": "8.51.0",
"@typescript-eslint/visitor-keys": "8.50.1", "@typescript-eslint/visitor-keys": "8.51.0",
"ignore": "^7.0.0", "ignore": "^7.0.0",
"natural-compare": "^1.4.0", "natural-compare": "^1.4.0",
"ts-api-utils": "^2.1.0" "ts-api-utils": "^2.2.0"
}, },
"engines": { "engines": {
"node": "^18.18.0 || ^20.9.0 || >=21.1.0" "node": "^18.18.0 || ^20.9.0 || >=21.1.0"
@@ -2891,7 +2892,7 @@
"url": "https://opencollective.com/typescript-eslint" "url": "https://opencollective.com/typescript-eslint"
}, },
"peerDependencies": { "peerDependencies": {
"@typescript-eslint/parser": "^8.50.1", "@typescript-eslint/parser": "^8.51.0",
"eslint": "^8.57.0 || ^9.0.0", "eslint": "^8.57.0 || ^9.0.0",
"typescript": ">=4.8.4 <6.0.0" "typescript": ">=4.8.4 <6.0.0"
} }
@@ -2907,16 +2908,16 @@
} }
}, },
"node_modules/@typescript-eslint/parser": { "node_modules/@typescript-eslint/parser": {
"version": "8.50.1", "version": "8.51.0",
"resolved": "https://registry.npmmirror.com/@typescript-eslint/parser/-/parser-8.50.1.tgz", "resolved": "https://registry.npmmirror.com/@typescript-eslint/parser/-/parser-8.51.0.tgz",
"integrity": "sha512-hM5faZwg7aVNa819m/5r7D0h0c9yC4DUlWAOvHAtISdFTc8xB86VmX5Xqabrama3wIPJ/q9RbGS1worb6JfnMg==", "integrity": "sha512-3xP4XzzDNQOIqBMWogftkwxhg5oMKApqY0BAflmLZiFYHqyhSOxv/cd/zPQLTcCXr4AkaKb25joocY0BD1WC6A==",
"dev": true, "dev": true,
"license": "MIT", "license": "MIT",
"dependencies": { "dependencies": {
"@typescript-eslint/scope-manager": "8.50.1", "@typescript-eslint/scope-manager": "8.51.0",
"@typescript-eslint/types": "8.50.1", "@typescript-eslint/types": "8.51.0",
"@typescript-eslint/typescript-estree": "8.50.1", "@typescript-eslint/typescript-estree": "8.51.0",
"@typescript-eslint/visitor-keys": "8.50.1", "@typescript-eslint/visitor-keys": "8.51.0",
"debug": "^4.3.4" "debug": "^4.3.4"
}, },
"engines": { "engines": {
@@ -2932,14 +2933,14 @@
} }
}, },
"node_modules/@typescript-eslint/project-service": { "node_modules/@typescript-eslint/project-service": {
"version": "8.50.1", "version": "8.51.0",
"resolved": "https://registry.npmmirror.com/@typescript-eslint/project-service/-/project-service-8.50.1.tgz", "resolved": "https://registry.npmmirror.com/@typescript-eslint/project-service/-/project-service-8.51.0.tgz",
"integrity": "sha512-E1ur1MCVf+YiP89+o4Les/oBAVzmSbeRB0MQLfSlYtbWU17HPxZ6Bhs5iYmKZRALvEuBoXIZMOIRRc/P++Ortg==", "integrity": "sha512-Luv/GafO07Z7HpiI7qeEW5NW8HUtZI/fo/kE0YbtQEFpJRUuR0ajcWfCE5bnMvL7QQFrmT/odMe8QZww8X2nfQ==",
"dev": true, "dev": true,
"license": "MIT", "license": "MIT",
"dependencies": { "dependencies": {
"@typescript-eslint/tsconfig-utils": "^8.50.1", "@typescript-eslint/tsconfig-utils": "^8.51.0",
"@typescript-eslint/types": "^8.50.1", "@typescript-eslint/types": "^8.51.0",
"debug": "^4.3.4" "debug": "^4.3.4"
}, },
"engines": { "engines": {
@@ -2954,14 +2955,14 @@
} }
}, },
"node_modules/@typescript-eslint/scope-manager": { "node_modules/@typescript-eslint/scope-manager": {
"version": "8.50.1", "version": "8.51.0",
"resolved": "https://registry.npmmirror.com/@typescript-eslint/scope-manager/-/scope-manager-8.50.1.tgz", "resolved": "https://registry.npmmirror.com/@typescript-eslint/scope-manager/-/scope-manager-8.51.0.tgz",
"integrity": "sha512-mfRx06Myt3T4vuoHaKi8ZWNTPdzKPNBhiblze5N50//TSHOAQQevl/aolqA/BcqqbJ88GUnLqjjcBc8EWdBcVw==", "integrity": "sha512-JhhJDVwsSx4hiOEQPeajGhCWgBMBwVkxC/Pet53EpBVs7zHHtayKefw1jtPaNRXpI9RA2uocdmpdfE7T+NrizA==",
"dev": true, "dev": true,
"license": "MIT", "license": "MIT",
"dependencies": { "dependencies": {
"@typescript-eslint/types": "8.50.1", "@typescript-eslint/types": "8.51.0",
"@typescript-eslint/visitor-keys": "8.50.1" "@typescript-eslint/visitor-keys": "8.51.0"
}, },
"engines": { "engines": {
"node": "^18.18.0 || ^20.9.0 || >=21.1.0" "node": "^18.18.0 || ^20.9.0 || >=21.1.0"
@@ -2972,9 +2973,9 @@
} }
}, },
"node_modules/@typescript-eslint/tsconfig-utils": { "node_modules/@typescript-eslint/tsconfig-utils": {
"version": "8.50.1", "version": "8.51.0",
"resolved": "https://registry.npmmirror.com/@typescript-eslint/tsconfig-utils/-/tsconfig-utils-8.50.1.tgz", "resolved": "https://registry.npmmirror.com/@typescript-eslint/tsconfig-utils/-/tsconfig-utils-8.51.0.tgz",
"integrity": "sha512-ooHmotT/lCWLXi55G4mvaUF60aJa012QzvLK0Y+Mp4WdSt17QhMhWOaBWeGTFVkb2gDgBe19Cxy1elPXylslDw==", "integrity": "sha512-Qi5bSy/vuHeWyir2C8u/uqGMIlIDu8fuiYWv48ZGlZ/k+PRPHtaAu7erpc7p5bzw2WNNSniuxoMSO4Ar6V9OXw==",
"dev": true, "dev": true,
"license": "MIT", "license": "MIT",
"engines": { "engines": {
@@ -2989,17 +2990,17 @@
} }
}, },
"node_modules/@typescript-eslint/type-utils": { "node_modules/@typescript-eslint/type-utils": {
"version": "8.50.1", "version": "8.51.0",
"resolved": "https://registry.npmmirror.com/@typescript-eslint/type-utils/-/type-utils-8.50.1.tgz", "resolved": "https://registry.npmmirror.com/@typescript-eslint/type-utils/-/type-utils-8.51.0.tgz",
"integrity": "sha512-7J3bf022QZE42tYMO6SL+6lTPKFk/WphhRPe9Tw/el+cEwzLz1Jjz2PX3GtGQVxooLDKeMVmMt7fWpYRdG5Etg==", "integrity": "sha512-0XVtYzxnobc9K0VU7wRWg1yiUrw4oQzexCG2V2IDxxCxhqBMSMbjB+6o91A+Uc0GWtgjCa3Y8bi7hwI0Tu4n5Q==",
"dev": true, "dev": true,
"license": "MIT", "license": "MIT",
"dependencies": { "dependencies": {
"@typescript-eslint/types": "8.50.1", "@typescript-eslint/types": "8.51.0",
"@typescript-eslint/typescript-estree": "8.50.1", "@typescript-eslint/typescript-estree": "8.51.0",
"@typescript-eslint/utils": "8.50.1", "@typescript-eslint/utils": "8.51.0",
"debug": "^4.3.4", "debug": "^4.3.4",
"ts-api-utils": "^2.1.0" "ts-api-utils": "^2.2.0"
}, },
"engines": { "engines": {
"node": "^18.18.0 || ^20.9.0 || >=21.1.0" "node": "^18.18.0 || ^20.9.0 || >=21.1.0"
@@ -3014,9 +3015,9 @@
} }
}, },
"node_modules/@typescript-eslint/types": { "node_modules/@typescript-eslint/types": {
"version": "8.50.1", "version": "8.51.0",
"resolved": "https://registry.npmmirror.com/@typescript-eslint/types/-/types-8.50.1.tgz", "resolved": "https://registry.npmmirror.com/@typescript-eslint/types/-/types-8.51.0.tgz",
"integrity": "sha512-v5lFIS2feTkNyMhd7AucE/9j/4V9v5iIbpVRncjk/K0sQ6Sb+Np9fgYS/63n6nwqahHQvbmujeBL7mp07Q9mlA==", "integrity": "sha512-TizAvWYFM6sSscmEakjY3sPqGwxZRSywSsPEiuZF6d5GmGD9Gvlsv0f6N8FvAAA0CD06l3rIcWNbsN1e5F/9Ag==",
"dev": true, "dev": true,
"license": "MIT", "license": "MIT",
"engines": { "engines": {
@@ -3028,21 +3029,21 @@
} }
}, },
"node_modules/@typescript-eslint/typescript-estree": { "node_modules/@typescript-eslint/typescript-estree": {
"version": "8.50.1", "version": "8.51.0",
"resolved": "https://registry.npmmirror.com/@typescript-eslint/typescript-estree/-/typescript-estree-8.50.1.tgz", "resolved": "https://registry.npmmirror.com/@typescript-eslint/typescript-estree/-/typescript-estree-8.51.0.tgz",
"integrity": "sha512-woHPdW+0gj53aM+cxchymJCrh0cyS7BTIdcDxWUNsclr9VDkOSbqC13juHzxOmQ22dDkMZEpZB+3X1WpUvzgVQ==", "integrity": "sha512-1qNjGqFRmlq0VW5iVlcyHBbCjPB7y6SxpBkrbhNWMy/65ZoncXCEPJxkRZL8McrseNH6lFhaxCIaX+vBuFnRng==",
"dev": true, "dev": true,
"license": "MIT", "license": "MIT",
"dependencies": { "dependencies": {
"@typescript-eslint/project-service": "8.50.1", "@typescript-eslint/project-service": "8.51.0",
"@typescript-eslint/tsconfig-utils": "8.50.1", "@typescript-eslint/tsconfig-utils": "8.51.0",
"@typescript-eslint/types": "8.50.1", "@typescript-eslint/types": "8.51.0",
"@typescript-eslint/visitor-keys": "8.50.1", "@typescript-eslint/visitor-keys": "8.51.0",
"debug": "^4.3.4", "debug": "^4.3.4",
"minimatch": "^9.0.4", "minimatch": "^9.0.4",
"semver": "^7.6.0", "semver": "^7.6.0",
"tinyglobby": "^0.2.15", "tinyglobby": "^0.2.15",
"ts-api-utils": "^2.1.0" "ts-api-utils": "^2.2.0"
}, },
"engines": { "engines": {
"node": "^18.18.0 || ^20.9.0 || >=21.1.0" "node": "^18.18.0 || ^20.9.0 || >=21.1.0"
@@ -3082,16 +3083,16 @@
} }
}, },
"node_modules/@typescript-eslint/utils": { "node_modules/@typescript-eslint/utils": {
"version": "8.50.1", "version": "8.51.0",
"resolved": "https://registry.npmmirror.com/@typescript-eslint/utils/-/utils-8.50.1.tgz", "resolved": "https://registry.npmmirror.com/@typescript-eslint/utils/-/utils-8.51.0.tgz",
"integrity": "sha512-lCLp8H1T9T7gPbEuJSnHwnSuO9mDf8mfK/Nion5mZmiEaQD9sWf9W4dfeFqRyqRjF06/kBuTmAqcs9sewM2NbQ==", "integrity": "sha512-11rZYxSe0zabiKaCP2QAwRf/dnmgFgvTmeDTtZvUvXG3UuAdg/GU02NExmmIXzz3vLGgMdtrIosI84jITQOxUA==",
"dev": true, "dev": true,
"license": "MIT", "license": "MIT",
"dependencies": { "dependencies": {
"@eslint-community/eslint-utils": "^4.7.0", "@eslint-community/eslint-utils": "^4.7.0",
"@typescript-eslint/scope-manager": "8.50.1", "@typescript-eslint/scope-manager": "8.51.0",
"@typescript-eslint/types": "8.50.1", "@typescript-eslint/types": "8.51.0",
"@typescript-eslint/typescript-estree": "8.50.1" "@typescript-eslint/typescript-estree": "8.51.0"
}, },
"engines": { "engines": {
"node": "^18.18.0 || ^20.9.0 || >=21.1.0" "node": "^18.18.0 || ^20.9.0 || >=21.1.0"
@@ -3106,13 +3107,13 @@
} }
}, },
"node_modules/@typescript-eslint/visitor-keys": { "node_modules/@typescript-eslint/visitor-keys": {
"version": "8.50.1", "version": "8.51.0",
"resolved": "https://registry.npmmirror.com/@typescript-eslint/visitor-keys/-/visitor-keys-8.50.1.tgz", "resolved": "https://registry.npmmirror.com/@typescript-eslint/visitor-keys/-/visitor-keys-8.51.0.tgz",
"integrity": "sha512-IrDKrw7pCRUR94zeuCSUWQ+w8JEf5ZX5jl/e6AHGSLi1/zIr0lgutfn/7JpfCey+urpgQEdrZVYzCaVVKiTwhQ==", "integrity": "sha512-mM/JRQOzhVN1ykejrvwnBRV3+7yTKK8tVANVN3o1O0t0v7o+jqdVu9crPy5Y9dov15TJk/FTIgoUGHrTOVL3Zg==",
"dev": true, "dev": true,
"license": "MIT", "license": "MIT",
"dependencies": { "dependencies": {
"@typescript-eslint/types": "8.50.1", "@typescript-eslint/types": "8.51.0",
"eslint-visitor-keys": "^4.2.1" "eslint-visitor-keys": "^4.2.1"
}, },
"engines": { "engines": {
@@ -5733,6 +5734,8 @@
"integrity": "sha512-QsCdAUHAmiDeKeaNojb1OHOPF7NjcWPBR7obdu3NwH2a/oyQaLg5d0aaCy/9My6CdPChYF07dvz5chaXBGaD4g==", "integrity": "sha512-QsCdAUHAmiDeKeaNojb1OHOPF7NjcWPBR7obdu3NwH2a/oyQaLg5d0aaCy/9My6CdPChYF07dvz5chaXBGaD4g==",
"dev": true, "dev": true,
"license": "MIT", "license": "MIT",
"optional": true,
"peer": true,
"dependencies": { "dependencies": {
"@types/node": "^20.0.0", "@types/node": "^20.0.0",
"@types/whatwg-mimetype": "^3.0.2", "@types/whatwg-mimetype": "^3.0.2",
@@ -5748,6 +5751,8 @@
"integrity": "sha512-ZsJzA5thDQMSQO788d7IocwwQbI8B5OPzmqNvpf3NY/+MHDAS759Wo0gd2WQeXYt5AAAQjzcrTVC6SKCuYgoCQ==", "integrity": "sha512-ZsJzA5thDQMSQO788d7IocwwQbI8B5OPzmqNvpf3NY/+MHDAS759Wo0gd2WQeXYt5AAAQjzcrTVC6SKCuYgoCQ==",
"dev": true, "dev": true,
"license": "MIT", "license": "MIT",
"optional": true,
"peer": true,
"dependencies": { "dependencies": {
"undici-types": "~6.21.0" "undici-types": "~6.21.0"
} }
@@ -5757,7 +5762,9 @@
"resolved": "https://registry.npmmirror.com/undici-types/-/undici-types-6.21.0.tgz", "resolved": "https://registry.npmmirror.com/undici-types/-/undici-types-6.21.0.tgz",
"integrity": "sha512-iwDZqg0QAGrg9Rav5H4n0M64c3mkR59cJ6wQp+7C4nI0gsmExaedaYLNO44eT4AtBBwjbTiGPMlt2Md0T9H9JQ==", "integrity": "sha512-iwDZqg0QAGrg9Rav5H4n0M64c3mkR59cJ6wQp+7C4nI0gsmExaedaYLNO44eT4AtBBwjbTiGPMlt2Md0T9H9JQ==",
"dev": true, "dev": true,
"license": "MIT" "license": "MIT",
"optional": true,
"peer": true
}, },
"node_modules/has-flag": { "node_modules/has-flag": {
"version": "4.0.0", "version": "4.0.0",
@@ -8160,9 +8167,9 @@
} }
}, },
"node_modules/ts-api-utils": { "node_modules/ts-api-utils": {
"version": "2.1.0", "version": "2.4.0",
"resolved": "https://registry.npmmirror.com/ts-api-utils/-/ts-api-utils-2.1.0.tgz", "resolved": "https://registry.npmmirror.com/ts-api-utils/-/ts-api-utils-2.4.0.tgz",
"integrity": "sha512-CUgTZL1irw8u29bzrOD/nH85jqyc74D6SshFgujOIA7osm2Rz7dYH77agkx7H4FBNxDq7Cjf+IjaX/8zwFW+ZQ==", "integrity": "sha512-3TaVTaAv2gTiMB35i3FiGJaRfwb3Pyn/j3m/bfAvGe8FB7CF6u+LMYqYlDh7reQf7UNvoTvdfAqHGmPGOSsPmA==",
"dev": true, "dev": true,
"license": "MIT", "license": "MIT",
"engines": { "engines": {
@@ -8231,16 +8238,16 @@
} }
}, },
"node_modules/typescript-eslint": { "node_modules/typescript-eslint": {
"version": "8.50.1", "version": "8.51.0",
"resolved": "https://registry.npmmirror.com/typescript-eslint/-/typescript-eslint-8.50.1.tgz", "resolved": "https://registry.npmmirror.com/typescript-eslint/-/typescript-eslint-8.51.0.tgz",
"integrity": "sha512-ytTHO+SoYSbhAH9CrYnMhiLx8To6PSSvqnvXyPUgPETCvB6eBKmTI9w6XMPS3HsBRGkwTVBX+urA8dYQx6bHfQ==", "integrity": "sha512-jh8ZuM5oEh2PSdyQG9YAEM1TCGuWenLSuSUhf/irbVUNW9O5FhbFVONviN2TgMTBnUmyHv7E56rYnfLZK6TkiA==",
"dev": true, "dev": true,
"license": "MIT", "license": "MIT",
"dependencies": { "dependencies": {
"@typescript-eslint/eslint-plugin": "8.50.1", "@typescript-eslint/eslint-plugin": "8.51.0",
"@typescript-eslint/parser": "8.50.1", "@typescript-eslint/parser": "8.51.0",
"@typescript-eslint/typescript-estree": "8.50.1", "@typescript-eslint/typescript-estree": "8.51.0",
"@typescript-eslint/utils": "8.50.1" "@typescript-eslint/utils": "8.51.0"
}, },
"engines": { "engines": {
"node": "^18.18.0 || ^20.9.0 || >=21.1.0" "node": "^18.18.0 || ^20.9.0 || >=21.1.0"
@@ -8946,13 +8953,13 @@
} }
}, },
"node_modules/vue-i18n": { "node_modules/vue-i18n": {
"version": "11.2.7", "version": "11.2.8",
"resolved": "https://registry.npmmirror.com/vue-i18n/-/vue-i18n-11.2.7.tgz", "resolved": "https://registry.npmmirror.com/vue-i18n/-/vue-i18n-11.2.8.tgz",
"integrity": "sha512-LPv8bAY5OA0UvFEXl4vBQOBqJzRrlExy92tWgRuwW7tbykHf7CH71G2Y4TM2OwGcIS4+hyqKHS2EVBqaYwPY9Q==", "integrity": "sha512-vJ123v/PXCZntd6Qj5Jumy7UBmIuE92VrtdX+AXr+1WzdBHojiBxnAxdfctUFL+/JIN+VQH4BhsfTtiGsvVObg==",
"license": "MIT", "license": "MIT",
"dependencies": { "dependencies": {
"@intlify/core-base": "11.2.7", "@intlify/core-base": "11.2.8",
"@intlify/shared": "11.2.7", "@intlify/shared": "11.2.8",
"@vue/devtools-api": "^6.5.0" "@vue/devtools-api": "^6.5.0"
}, },
"engines": { "engines": {
@@ -9041,6 +9048,8 @@
"integrity": "sha512-nt+N2dzIutVRxARx1nghPKGv1xHikU7HKdfafKkLNLindmPU/ch3U31NOCGGA/dmPcmb1VlofO0vnKAcsm0o/Q==", "integrity": "sha512-nt+N2dzIutVRxARx1nghPKGv1xHikU7HKdfafKkLNLindmPU/ch3U31NOCGGA/dmPcmb1VlofO0vnKAcsm0o/Q==",
"dev": true, "dev": true,
"license": "MIT", "license": "MIT",
"optional": true,
"peer": true,
"engines": { "engines": {
"node": ">=12" "node": ">=12"
} }

View File

@@ -183,7 +183,7 @@ const selectLanguage = (languageId: SupportedLanguage) => {
try { try {
const view = editorStore.currentEditor; const view = editorStore.currentEditor;
const state = view.state; const state = view.state;
const dispatch = view.dispatch; const dispatch = view.dispatch.bind(view);
const [targetLanguage, autoDetect] = languageId === 'auto' const [targetLanguage, autoDetect] = languageId === 'auto'
? ['text', true] ? ['text', true]
@@ -510,4 +510,4 @@ const scrollToCurrentLanguage = () => {
background-color: var(--text-muted); background-color: var(--text-muted);
} }
} }
</style> </style>

View File

@@ -92,8 +92,14 @@ export const useEditorStore = defineStore('editor', () => {
// 滚轮缩放扩展 // 滚轮缩放扩展
const wheelZoomExtension = createWheelZoomExtension({ const wheelZoomExtension = createWheelZoomExtension({
increaseFontSize: () => configStore.increaseFontSizeLocal(), increaseFontSize: () => {
decreaseFontSize: () => configStore.decreaseFontSizeLocal(), configStore.increaseFontSizeLocal();
applyFontSettings();
},
decreaseFontSize: () => {
configStore.decreaseFontSizeLocal();
applyFontSettings();
},
onSave: () => configStore.saveFontSize(), onSave: () => configStore.saveFontSize(),
saveDelay: 1000 saveDelay: 1000
}); });

View File

@@ -8,6 +8,7 @@ import { EditorView } from "@codemirror/view";
import { Command } from "@codemirror/view"; import { Command } from "@codemirror/view";
import { LANGUAGES } from "./lang-parser/languages"; import { LANGUAGES } from "./lang-parser/languages";
import { USER_EVENTS, codeBlockEvent, CONTENT_EDIT } from "./annotation"; import { USER_EVENTS, codeBlockEvent, CONTENT_EDIT } from "./annotation";
import * as runtime from "@wailsio/runtime";
/** /**
* 构建块分隔符正则表达式 * 构建块分隔符正则表达式
@@ -62,29 +63,37 @@ function copiedRange(state: EditorState, forCut: boolean = false) {
*/ */
export const codeBlockCopyCut = EditorView.domEventHandlers({ export const codeBlockCopyCut = EditorView.domEventHandlers({
copy(event, view) { copy(event, view) {
event.preventDefault();
let { text } = copiedRange(view.state); let { text } = copiedRange(view.state);
// 将块分隔符替换为双换行符
text = text.replaceAll(blockSeparatorRegex, "\n\n"); text = text.replaceAll(blockSeparatorRegex, "\n\n");
const data = event.clipboardData; // 优先使用 Wails 原生剪贴板 API
if (data) { runtime.Clipboard.SetText(text).catch(() => {
event.preventDefault(); // 降级方案:使用浏览器剪贴板
data.clearData(); const data = event.clipboardData;
data.setData("text/plain", text); if (data) {
} data.clearData();
data.setData("text/plain", text);
}
});
}, },
cut(event, view) { cut(event, view) {
event.preventDefault();
let { text, ranges } = copiedRange(view.state, true); let { text, ranges } = copiedRange(view.state, true);
// 将块分隔符替换为双换行符
text = text.replaceAll(blockSeparatorRegex, "\n\n"); text = text.replaceAll(blockSeparatorRegex, "\n\n");
const data = event.clipboardData; // 优先使用 Wails 原生剪贴板 API
if (data) { runtime.Clipboard.SetText(text).catch(() => {
event.preventDefault(); // 降级方案:使用浏览器剪贴板
data.clearData(); const data = event.clipboardData;
data.setData("text/plain", text); if (data) {
} data.clearData();
data.setData("text/plain", text);
}
});
if (!view.state.readOnly) { if (!view.state.readOnly) {
view.dispatch({ view.dispatch({
@@ -94,20 +103,52 @@ export const codeBlockCopyCut = EditorView.domEventHandlers({
annotations: [codeBlockEvent.of(CONTENT_EDIT)], annotations: [codeBlockEvent.of(CONTENT_EDIT)],
}); });
} }
},
paste(event, view) {
if (view.state.readOnly) {
return false;
}
event.preventDefault();
// 使用 Wails 原生剪贴板 API
runtime.Clipboard.Text()
.then(text => {
if (text) {
doPaste(view, text);
}
})
.catch(error => {
console.error('[Clipboard] Failed to read from system clipboard:', error);
const data = event.clipboardData;
if (data) {
const text = data.getData("text/plain");
if (text) {
doPaste(view, text);
}
}
});
return true;
} }
}); });
/** /**
* 复制和剪切的通用函数 * 复制和剪切的通用函数 - 使用 Wails 原生剪贴板 API
*/ */
const copyCut = (view: EditorView, cut: boolean): boolean => { const copyCut = (view: EditorView, cut: boolean): boolean => {
let { text, ranges } = copiedRange(view.state, cut); let { text, ranges } = copiedRange(view.state, cut);
// 将块分隔符替换为双换行符
text = text.replaceAll(blockSeparatorRegex, "\n\n"); text = text.replaceAll(blockSeparatorRegex, "\n\n");
if (navigator.clipboard && navigator.clipboard.writeText) { runtime.Clipboard.SetText(text).catch(err => {
navigator.clipboard.writeText(text); console.error('[Clipboard] Failed to write to system clipboard:', err);
}
if (navigator.clipboard && navigator.clipboard.writeText) {
navigator.clipboard.writeText(text);
}
});
if (cut && !view.state.readOnly) { if (cut && !view.state.readOnly) {
view.dispatch({ view.dispatch({
@@ -166,20 +207,32 @@ export const cutCommand: Command = (view) => {
}; };
/** /**
* 粘贴命令 * 粘贴命令 - 使用 Wails 原生剪贴板 API
*/ */
export const pasteCommand: Command = (view) => { export const pasteCommand: Command = (view) => {
if (navigator.clipboard && navigator.clipboard.readText) { // 使用 Wails 原生剪贴板 API正确处理系统编码
navigator.clipboard.readText() runtime.Clipboard.Text()
.then(text => { .then(text => {
if (text) {
doPaste(view, text); doPaste(view, text);
}) }
.catch(err => { })
console.error('Failed to read from clipboard:', err); .catch(err => {
}); console.error('[Clipboard] Failed to read from system clipboard:', err);
} else {
console.warn('The clipboard API is not available, please use your browser\'s native paste feature'); if (navigator.clipboard && navigator.clipboard.readText) {
} navigator.clipboard.readText()
.then(text => {
if (text) {
doPaste(view, text);
}
})
.catch(fallbackErr => {
console.error('[Clipboard] Fallback also failed:', fallbackErr);
});
}
});
return true; return true;
}; };

View File

@@ -68,13 +68,20 @@ function createDetectionMap(): Map<string, SupportedLanguage> {
LANGUAGES.forEach(lang => { LANGUAGES.forEach(lang => {
if (lang.detectIds) { if (lang.detectIds) {
lang.detectIds.forEach(detectId => { lang.detectIds.forEach(detectId => {
map.set(detectId, lang.token); // 保留首个映射,避免重复 detectId 覆盖更基础的语言,例如 js -> ts。
if (!map.has(detectId)) {
map.set(detectId, lang.token);
}
}); });
} }
}); });
return map; return map;
} }
function createWorkerUrl(): URL {
return new URL(`${import.meta.env.BASE_URL}langdetect-worker.js`, window.location.href);
}
/** /**
* 检测ID到语言token的映射表 * 检测ID到语言token的映射表
*/ */
@@ -131,7 +138,7 @@ class LanguageDetectionWorker {
*/ */
private initWorker(): void { private initWorker(): void {
try { try {
this.worker = new Worker('/langdetect-worker.js'); this.worker = new Worker(createWorkerUrl());
this.worker.onmessage = (event) => { this.worker.onmessage = (event) => {
const response: WorkerResponse = event.data; const response: WorkerResponse = event.data;
const request = this.pendingRequests.get(response.idx); const request = this.pendingRequests.get(response.idx);
@@ -316,4 +323,4 @@ export async function detectLanguages(contents: string[]): Promise<LanguageDetec
} finally { } finally {
worker.destroy(); worker.destroy();
} }
} }

View File

@@ -46,10 +46,10 @@ function collectBlocksFromTree(tree: Tree, state: EditorState): Block[] | null {
if (child.type.id === BlockDelimiter) { if (child.type.id === BlockDelimiter) {
delimiter = { from: child.from, to: child.to }; delimiter = { from: child.from, to: child.to };
const delimiterText = doc.sliceString(child.from, child.to); const delimiterText = doc.sliceString(child.from, child.to);
const match = delimiterText.match(/∞∞∞([a-zA-Z0-9_-]+)(-a)?\n/); const delimiterInfo = parseDelimiter(delimiterText);
if (match) { if (delimiterInfo) {
language = match[1] || DEFAULT_LANGUAGE; language = delimiterInfo.language;
auto = match[2] === '-a'; auto = delimiterInfo.auto;
} else { } else {
child.node.firstChild?.cursor().iterate(langChild => { child.node.firstChild?.cursor().iterate(langChild => {
if (langChild.type.id === BlockLanguage) { if (langChild.type.id === BlockLanguage) {

View File

@@ -87,7 +87,7 @@ export interface EditorOptions {
// 分隔符格式常量 // 分隔符格式常量
export const DELIMITER_REGEX = /^\n∞∞∞([a-zA-Z0-9_-]+)(-a)?\n/gm; export const DELIMITER_REGEX = /^\n∞∞∞([a-zA-Z0-9_]+)(-a)?\n/gm;
export const DELIMITER_PREFIX = '\n∞∞∞'; export const DELIMITER_PREFIX = '\n∞∞∞';
export const DELIMITER_SUFFIX = '\n'; export const DELIMITER_SUFFIX = '\n';
export const AUTO_DETECT_SUFFIX = '-a'; export const AUTO_DETECT_SUFFIX = '-a';

View File

@@ -1 +1 @@
VERSION=1.5.6 VERSION=1.5.7