From 8ece62c075e2ac8ec57dc4c4bb7877204f48911a Mon Sep 17 00:00:00 2001 From: Vanessa Date: Thu, 17 Apr 2025 23:33:04 +0800 Subject: [PATCH] :art: https://github.com/siyuan-note/siyuan/issues/14619 --- app/pnpm-lock.yaml | 126 +++++++++++++++---------------- app/src/protyle/wysiwyg/index.ts | 3 +- 2 files changed, 65 insertions(+), 64 deletions(-) diff --git a/app/pnpm-lock.yaml b/app/pnpm-lock.yaml index 82bef52be..fc4a27837 100644 --- a/app/pnpm-lock.yaml +++ b/app/pnpm-lock.yaml @@ -23,10 +23,10 @@ importers: version: 18.19.86 '@typescript-eslint/eslint-plugin': specifier: ^8.15.0 - version: 8.29.1(@typescript-eslint/parser@8.29.1(eslint@9.24.0)(typescript@4.9.5))(eslint@9.24.0)(typescript@4.9.5) + version: 8.30.1(@typescript-eslint/parser@8.30.1(eslint@9.24.0)(typescript@4.9.5))(eslint@9.24.0)(typescript@4.9.5) '@typescript-eslint/parser': specifier: ^8.15.0 - version: 8.29.1(eslint@9.24.0)(typescript@4.9.5) + version: 8.30.1(eslint@9.24.0)(typescript@4.9.5) blueimp-md5: specifier: ^2.19.0 version: 2.19.0 @@ -131,8 +131,8 @@ packages: resolution: {integrity: sha512-Qkzpg2s9GnVV2I2BjRksUi43U5e6+zaQMcjoJy0C+C5oxaKl+fmckGDQFtRpZpZV0NQekuZZ+tGz7EA9TVnQtQ==} engines: {node: '>=12'} - '@electron/node-gyp@git+https://github.com/electron/node-gyp.git#06b29aafb7708acef8b3669835c8a7857ebc92d2': - resolution: {commit: 06b29aafb7708acef8b3669835c8a7857ebc92d2, repo: https://github.com/electron/node-gyp.git, type: git} + '@electron/node-gyp@https://codeload.github.com/electron/node-gyp/tar.gz/06b29aafb7708acef8b3669835c8a7857ebc92d2': + resolution: {tarball: https://codeload.github.com/electron/node-gyp/tar.gz/06b29aafb7708acef8b3669835c8a7857ebc92d2} version: 10.2.0-electron.1 engines: {node: '>=12.13.0'} hasBin: true @@ -303,8 +303,8 @@ packages: cpu: [x64] os: [win32] - '@eslint-community/eslint-utils@4.6.0': - resolution: {integrity: sha512-WhCn7Z7TauhBtmzhvKpoQs0Wwb/kBcy4CwpuI0/eEIr2Lx2auxmulAzLr91wVZJaz47iUZdkXOK7WlAfxGKCnA==} + '@eslint-community/eslint-utils@4.6.1': + resolution: {integrity: sha512-KTsJMmobmbrFLe3LDh0PC2FXpcSYJt/MLjlkh/9LEnmKYLSYmT/0EW9JWANjeoemiuZrmogti0tW5Ch+qNUYDw==} engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0} peerDependencies: eslint: ^6.0.0 || ^7.0.0 || >=8.0.0 @@ -586,51 +586,51 @@ packages: '@types/yauzl@2.10.3': resolution: {integrity: sha512-oJoftv0LSuaDZE3Le4DbKX+KS9G36NzOeSap90UIK0yMA/NhKJhqlSGtNDORNRaIbQfzjXDrQa0ytJ6mNRGz/Q==} - '@typescript-eslint/eslint-plugin@8.29.1': - resolution: {integrity: sha512-ba0rr4Wfvg23vERs3eB+P3lfj2E+2g3lhWcCVukUuhtcdUx5lSIFZlGFEBHKr+3zizDa/TvZTptdNHVZWAkSBg==} + '@typescript-eslint/eslint-plugin@8.30.1': + resolution: {integrity: sha512-v+VWphxMjn+1t48/jO4t950D6KR8JaJuNXzi33Ve6P8sEmPr5k6CEXjdGwT6+LodVnEa91EQCtwjWNUCPweo+Q==} engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0} peerDependencies: '@typescript-eslint/parser': ^8.0.0 || ^8.0.0-alpha.0 eslint: ^8.57.0 || ^9.0.0 typescript: '>=4.8.4 <5.9.0' - '@typescript-eslint/parser@8.29.1': - resolution: {integrity: sha512-zczrHVEqEaTwh12gWBIJWj8nx+ayDcCJs06yoNMY0kwjMWDM6+kppljY+BxWI06d2Ja+h4+WdufDcwMnnMEWmg==} + '@typescript-eslint/parser@8.30.1': + resolution: {integrity: sha512-H+vqmWwT5xoNrXqWs/fesmssOW70gxFlgcMlYcBaWNPIEWDgLa4W9nkSPmhuOgLnXq9QYgkZ31fhDyLhleCsAg==} engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0} peerDependencies: eslint: ^8.57.0 || ^9.0.0 typescript: '>=4.8.4 <5.9.0' - '@typescript-eslint/scope-manager@8.29.1': - resolution: {integrity: sha512-2nggXGX5F3YrsGN08pw4XpMLO1Rgtnn4AzTegC2MDesv6q3QaTU5yU7IbS1tf1IwCR0Hv/1EFygLn9ms6LIpDA==} + '@typescript-eslint/scope-manager@8.30.1': + resolution: {integrity: sha512-+C0B6ChFXZkuaNDl73FJxRYT0G7ufVPOSQkqkpM/U198wUwUFOtgo1k/QzFh1KjpBitaK7R1tgjVz6o9HmsRPg==} engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0} - '@typescript-eslint/type-utils@8.29.1': - resolution: {integrity: sha512-DkDUSDwZVCYN71xA4wzySqqcZsHKic53A4BLqmrWFFpOpNSoxX233lwGu/2135ymTCR04PoKiEEEvN1gFYg4Tw==} + '@typescript-eslint/type-utils@8.30.1': + resolution: {integrity: sha512-64uBF76bfQiJyHgZISC7vcNz3adqQKIccVoKubyQcOnNcdJBvYOILV1v22Qhsw3tw3VQu5ll8ND6hycgAR5fEA==} engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0} peerDependencies: eslint: ^8.57.0 || ^9.0.0 typescript: '>=4.8.4 <5.9.0' - '@typescript-eslint/types@8.29.1': - resolution: {integrity: sha512-VT7T1PuJF1hpYC3AGm2rCgJBjHL3nc+A/bhOp9sGMKfi5v0WufsX/sHCFBfNTx2F+zA6qBc/PD0/kLRLjdt8mQ==} + '@typescript-eslint/types@8.30.1': + resolution: {integrity: sha512-81KawPfkuulyWo5QdyG/LOKbspyyiW+p4vpn4bYO7DM/hZImlVnFwrpCTnmNMOt8CvLRr5ojI9nU1Ekpw4RcEw==} engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0} - '@typescript-eslint/typescript-estree@8.29.1': - resolution: {integrity: sha512-l1enRoSaUkQxOQnbi0KPUtqeZkSiFlqrx9/3ns2rEDhGKfTa+88RmXqedC1zmVTOWrLc2e6DEJrTA51C9iLH5g==} + '@typescript-eslint/typescript-estree@8.30.1': + resolution: {integrity: sha512-kQQnxymiUy9tTb1F2uep9W6aBiYODgq5EMSk6Nxh4Z+BDUoYUSa029ISs5zTzKBFnexQEh71KqwjKnRz58lusQ==} engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0} peerDependencies: typescript: '>=4.8.4 <5.9.0' - '@typescript-eslint/utils@8.29.1': - resolution: {integrity: sha512-QAkFEbytSaB8wnmB+DflhUPz6CLbFWE2SnSCrRMEa+KnXIzDYbpsn++1HGvnfAsUY44doDXmvRkO5shlM/3UfA==} + '@typescript-eslint/utils@8.30.1': + resolution: {integrity: sha512-T/8q4R9En2tcEsWPQgB5BQ0XJVOtfARcUvOa8yJP3fh9M/mXraLxZrkCfGb6ChrO/V3W+Xbd04RacUEqk1CFEQ==} engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0} peerDependencies: eslint: ^8.57.0 || ^9.0.0 typescript: '>=4.8.4 <5.9.0' - '@typescript-eslint/visitor-keys@8.29.1': - resolution: {integrity: sha512-RGLh5CRaUEf02viP5c1Vh1cMGffQscyHe7HPAzGpfmfflFg1wUz2rYxd+OZqwpeypYvZ8UxSxuIpF++fmOzEcg==} + '@typescript-eslint/visitor-keys@8.30.1': + resolution: {integrity: sha512-aEhgas7aJ6vZnNFC7K4/vMGDGyOiqWcYZPpIWrTKuTAlsvDNKy2GFDqh9smL+iq069ZvR0YzEeq0B8NJlLzjFA==} engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0} '@webassemblyjs/ast@1.14.1': @@ -900,8 +900,8 @@ packages: camel-case@4.1.2: resolution: {integrity: sha512-gxGWBrTT1JuMx6R+o5PTXMmUnhnVzLQ9SNutD4YqKtI6ap897t3tKECYla6gCWEkplXnlNybEkZg9GEGxKFCgw==} - caniuse-lite@1.0.30001713: - resolution: {integrity: sha512-wCIWIg+A4Xr7NfhTuHdX+/FKh3+Op3LBbSp2N5Pfx6T/LhdQy3GTyoTg48BReaW/MyMNZAkTadsBtai3ldWK0Q==} + caniuse-lite@1.0.30001714: + resolution: {integrity: sha512-mtgapdwDLSSBnCI3JokHM7oEQBLxiJKVRtg10AxM1AyeiKcM96f0Mkbqeq+1AbiCtvMcHRulAAEMu693JrSWqg==} chalk@4.1.2: resolution: {integrity: sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==} @@ -1177,8 +1177,8 @@ packages: electron-publish@26.0.11: resolution: {integrity: sha512-a8QRH0rAPIWH9WyyS5LbNvW9Ark6qe63/LqDB7vu2JXYpi0Gma5Q60Dh4tmTqhOBQt0xsrzD8qE7C+D7j+B24A==} - electron-to-chromium@1.5.136: - resolution: {integrity: sha512-kL4+wUTD7RSA5FHx5YwWtjDnEEkIIikFgWHR4P6fqjw1PPLlqYkxeOb++wAauAssat0YClCy8Y3C5SxgSkjibQ==} + electron-to-chromium@1.5.137: + resolution: {integrity: sha512-/QSJaU2JyIuTbbABAo/crOs+SuAZLS+fVVS10PVrIT9hrRkmZl8Hb0xPSkKRUUWHQtYzXHpQUW3Dy5hwMzGZkA==} electron-winstaller@5.4.0: resolution: {integrity: sha512-bO3y10YikuUwUuDUQRM4KfwNkKhnpVO7IPdbsrejwN9/AABJzzTQ4GeHwyzNSrVO+tEH3/Np255a3sVZpZDjvg==} @@ -2796,7 +2796,7 @@ snapshots: transitivePeerDependencies: - supports-color - '@electron/node-gyp@git+https://github.com/electron/node-gyp.git#06b29aafb7708acef8b3669835c8a7857ebc92d2': + '@electron/node-gyp@https://codeload.github.com/electron/node-gyp/tar.gz/06b29aafb7708acef8b3669835c8a7857ebc92d2': dependencies: env-paths: 2.2.1 exponential-backoff: 3.1.2 @@ -2833,7 +2833,7 @@ snapshots: '@electron/rebuild@3.7.0': dependencies: - '@electron/node-gyp': git+https://github.com/electron/node-gyp.git#06b29aafb7708acef8b3669835c8a7857ebc92d2 + '@electron/node-gyp': https://codeload.github.com/electron/node-gyp/tar.gz/06b29aafb7708acef8b3669835c8a7857ebc92d2 '@malept/cross-spawn-promise': 2.0.0 chalk: 4.1.2 debug: 4.4.0 @@ -2857,7 +2857,7 @@ snapshots: '@electron/universal@2.0.1': dependencies: - '@electron/asar': 3.2.18 + '@electron/asar': 3.4.1 '@malept/cross-spawn-promise': 2.0.0 debug: 4.4.0 dir-compare: 4.2.0 @@ -2947,7 +2947,7 @@ snapshots: '@esbuild/win32-x64@0.19.12': optional: true - '@eslint-community/eslint-utils@4.6.0(eslint@9.24.0)': + '@eslint-community/eslint-utils@4.6.1(eslint@9.24.0)': dependencies: eslint: 9.24.0 eslint-visitor-keys: 3.4.3 @@ -3222,14 +3222,14 @@ snapshots: '@types/node': 18.19.86 optional: true - '@typescript-eslint/eslint-plugin@8.29.1(@typescript-eslint/parser@8.29.1(eslint@9.24.0)(typescript@4.9.5))(eslint@9.24.0)(typescript@4.9.5)': + '@typescript-eslint/eslint-plugin@8.30.1(@typescript-eslint/parser@8.30.1(eslint@9.24.0)(typescript@4.9.5))(eslint@9.24.0)(typescript@4.9.5)': dependencies: '@eslint-community/regexpp': 4.12.1 - '@typescript-eslint/parser': 8.29.1(eslint@9.24.0)(typescript@4.9.5) - '@typescript-eslint/scope-manager': 8.29.1 - '@typescript-eslint/type-utils': 8.29.1(eslint@9.24.0)(typescript@4.9.5) - '@typescript-eslint/utils': 8.29.1(eslint@9.24.0)(typescript@4.9.5) - '@typescript-eslint/visitor-keys': 8.29.1 + '@typescript-eslint/parser': 8.30.1(eslint@9.24.0)(typescript@4.9.5) + '@typescript-eslint/scope-manager': 8.30.1 + '@typescript-eslint/type-utils': 8.30.1(eslint@9.24.0)(typescript@4.9.5) + '@typescript-eslint/utils': 8.30.1(eslint@9.24.0)(typescript@4.9.5) + '@typescript-eslint/visitor-keys': 8.30.1 eslint: 9.24.0 graphemer: 1.4.0 ignore: 5.3.2 @@ -3239,27 +3239,27 @@ snapshots: transitivePeerDependencies: - supports-color - '@typescript-eslint/parser@8.29.1(eslint@9.24.0)(typescript@4.9.5)': + '@typescript-eslint/parser@8.30.1(eslint@9.24.0)(typescript@4.9.5)': dependencies: - '@typescript-eslint/scope-manager': 8.29.1 - '@typescript-eslint/types': 8.29.1 - '@typescript-eslint/typescript-estree': 8.29.1(typescript@4.9.5) - '@typescript-eslint/visitor-keys': 8.29.1 + '@typescript-eslint/scope-manager': 8.30.1 + '@typescript-eslint/types': 8.30.1 + '@typescript-eslint/typescript-estree': 8.30.1(typescript@4.9.5) + '@typescript-eslint/visitor-keys': 8.30.1 debug: 4.4.0 eslint: 9.24.0 typescript: 4.9.5 transitivePeerDependencies: - supports-color - '@typescript-eslint/scope-manager@8.29.1': + '@typescript-eslint/scope-manager@8.30.1': dependencies: - '@typescript-eslint/types': 8.29.1 - '@typescript-eslint/visitor-keys': 8.29.1 + '@typescript-eslint/types': 8.30.1 + '@typescript-eslint/visitor-keys': 8.30.1 - '@typescript-eslint/type-utils@8.29.1(eslint@9.24.0)(typescript@4.9.5)': + '@typescript-eslint/type-utils@8.30.1(eslint@9.24.0)(typescript@4.9.5)': dependencies: - '@typescript-eslint/typescript-estree': 8.29.1(typescript@4.9.5) - '@typescript-eslint/utils': 8.29.1(eslint@9.24.0)(typescript@4.9.5) + '@typescript-eslint/typescript-estree': 8.30.1(typescript@4.9.5) + '@typescript-eslint/utils': 8.30.1(eslint@9.24.0)(typescript@4.9.5) debug: 4.4.0 eslint: 9.24.0 ts-api-utils: 2.1.0(typescript@4.9.5) @@ -3267,12 +3267,12 @@ snapshots: transitivePeerDependencies: - supports-color - '@typescript-eslint/types@8.29.1': {} + '@typescript-eslint/types@8.30.1': {} - '@typescript-eslint/typescript-estree@8.29.1(typescript@4.9.5)': + '@typescript-eslint/typescript-estree@8.30.1(typescript@4.9.5)': dependencies: - '@typescript-eslint/types': 8.29.1 - '@typescript-eslint/visitor-keys': 8.29.1 + '@typescript-eslint/types': 8.30.1 + '@typescript-eslint/visitor-keys': 8.30.1 debug: 4.4.0 fast-glob: 3.3.3 is-glob: 4.0.3 @@ -3283,20 +3283,20 @@ snapshots: transitivePeerDependencies: - supports-color - '@typescript-eslint/utils@8.29.1(eslint@9.24.0)(typescript@4.9.5)': + '@typescript-eslint/utils@8.30.1(eslint@9.24.0)(typescript@4.9.5)': dependencies: - '@eslint-community/eslint-utils': 4.6.0(eslint@9.24.0) - '@typescript-eslint/scope-manager': 8.29.1 - '@typescript-eslint/types': 8.29.1 - '@typescript-eslint/typescript-estree': 8.29.1(typescript@4.9.5) + '@eslint-community/eslint-utils': 4.6.1(eslint@9.24.0) + '@typescript-eslint/scope-manager': 8.30.1 + '@typescript-eslint/types': 8.30.1 + '@typescript-eslint/typescript-estree': 8.30.1(typescript@4.9.5) eslint: 9.24.0 typescript: 4.9.5 transitivePeerDependencies: - supports-color - '@typescript-eslint/visitor-keys@8.29.1': + '@typescript-eslint/visitor-keys@8.30.1': dependencies: - '@typescript-eslint/types': 8.29.1 + '@typescript-eslint/types': 8.30.1 eslint-visitor-keys: 4.2.0 '@webassemblyjs/ast@1.14.1': @@ -3560,8 +3560,8 @@ snapshots: browserslist@4.24.4: dependencies: - caniuse-lite: 1.0.30001713 - electron-to-chromium: 1.5.136 + caniuse-lite: 1.0.30001714 + electron-to-chromium: 1.5.137 node-releases: 2.0.19 update-browserslist-db: 1.1.3(browserslist@4.24.4) @@ -3650,7 +3650,7 @@ snapshots: pascal-case: 3.1.2 tslib: 2.8.1 - caniuse-lite@1.0.30001713: {} + caniuse-lite@1.0.30001714: {} chalk@4.1.2: dependencies: @@ -3963,7 +3963,7 @@ snapshots: transitivePeerDependencies: - supports-color - electron-to-chromium@1.5.136: {} + electron-to-chromium@1.5.137: {} electron-winstaller@5.4.0: dependencies: @@ -4086,7 +4086,7 @@ snapshots: eslint@9.24.0: dependencies: - '@eslint-community/eslint-utils': 4.6.0(eslint@9.24.0) + '@eslint-community/eslint-utils': 4.6.1(eslint@9.24.0) '@eslint-community/regexpp': 4.12.1 '@eslint/config-array': 0.20.0 '@eslint/config-helpers': 0.2.1 diff --git a/app/src/protyle/wysiwyg/index.ts b/app/src/protyle/wysiwyg/index.ts index 325685fe5..ac849f521 100644 --- a/app/src/protyle/wysiwyg/index.ts +++ b/app/src/protyle/wysiwyg/index.ts @@ -424,7 +424,7 @@ export class WYSIWYG { } } else if (hasClosestByTag(range.startContainer, "TD") || hasClosestByTag(range.startContainer, "TH")) { tempElement.innerHTML = tempElement.innerHTML.replace(/
/g, "\n").replace(//g, "\n"); - textPlain = tempElement.textContent; + textPlain = tempElement.textContent.endsWith("\n") ? tempElement.textContent.replace(/\n$/, "") : tempElement.textContent; } else if (!hasClosestByTag(range.startContainer, "CODE")) { textPlain = range.toString(); } @@ -1683,6 +1683,7 @@ export class WYSIWYG { textPlain = textPlain || protyle.lute.BlockDOM2StdMd(html).trimEnd(); // 需要 trimEnd,否则 \n 会导致 https://github.com/siyuan-note/siyuan/issues/6218 if (nodeElement.classList.contains("table")) { textPlain = textPlain.replace(/
/g, "\n").replace(//g, "\n"); + textPlain = textPlain.endsWith("\n") ? textPlain.replace(/\n$/, "") : textPlain; } } textPlain = textPlain.replace(/\u00A0/g, " "); // Replace non-breaking spaces with normal spaces when copying https://github.com/siyuan-note/siyuan/issues/9382