Skip to content

An open-source, privacy-first, self-hosted knowledge workspace where humans and AI agents work together 开源、隐私优先、自托管的知识工作空间,让人与智能体在此协作

:art: https://github.com/siyuan-note/siyuan/issues/14619

Vanessa8ece62c075e2
diff --git a/app/pnpm-lock.yaml b/app/pnpm-lock.yaml
index 82bef52bef..fc4a278379 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
'@typescript-eslint/parser':
specifier: ^8.15.0
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/[email protected]':
- resolution: {integrity: sha512-WhCn7Z7TauhBtmzhvKpoQs0Wwb/kBcy4CwpuI0/eEIr2Lx2auxmulAzLr91wVZJaz47iUZdkXOK7WlAfxGKCnA==}
+ '@eslint-community/[email protected]':
+ 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:
resolution: {integrity: sha512-oJoftv0LSuaDZE3Le4DbKX+KS9G36NzOeSap90UIK0yMA/NhKJhqlSGtNDORNRaIbQfzjXDrQa0ytJ6mNRGz/Q==}
- '@typescript-eslint/[email protected]':
- resolution: {integrity: sha512-ba0rr4Wfvg23vERs3eB+P3lfj2E+2g3lhWcCVukUuhtcdUx5lSIFZlGFEBHKr+3zizDa/TvZTptdNHVZWAkSBg==}
+ '@typescript-eslint/[email protected]':
+ 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/[email protected]':
- resolution: {integrity: sha512-zczrHVEqEaTwh12gWBIJWj8nx+ayDcCJs06yoNMY0kwjMWDM6+kppljY+BxWI06d2Ja+h4+WdufDcwMnnMEWmg==}
+ '@typescript-eslint/[email protected]':
+ 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/[email protected]':
- resolution: {integrity: sha512-2nggXGX5F3YrsGN08pw4XpMLO1Rgtnn4AzTegC2MDesv6q3QaTU5yU7IbS1tf1IwCR0Hv/1EFygLn9ms6LIpDA==}
+ '@typescript-eslint/[email protected]':
+ resolution: {integrity: sha512-+C0B6ChFXZkuaNDl73FJxRYT0G7ufVPOSQkqkpM/U198wUwUFOtgo1k/QzFh1KjpBitaK7R1tgjVz6o9HmsRPg==}
engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0}
- '@typescript-eslint/[email protected]':
- resolution: {integrity: sha512-DkDUSDwZVCYN71xA4wzySqqcZsHKic53A4BLqmrWFFpOpNSoxX233lwGu/2135ymTCR04PoKiEEEvN1gFYg4Tw==}
+ '@typescript-eslint/[email protected]':
+ 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/[email protected]':
- resolution: {integrity: sha512-VT7T1PuJF1hpYC3AGm2rCgJBjHL3nc+A/bhOp9sGMKfi5v0WufsX/sHCFBfNTx2F+zA6qBc/PD0/kLRLjdt8mQ==}
+ '@typescript-eslint/[email protected]':
+ resolution: {integrity: sha512-81KawPfkuulyWo5QdyG/LOKbspyyiW+p4vpn4bYO7DM/hZImlVnFwrpCTnmNMOt8CvLRr5ojI9nU1Ekpw4RcEw==}
engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0}
- '@typescript-eslint/[email protected]':
- resolution: {integrity: sha512-l1enRoSaUkQxOQnbi0KPUtqeZkSiFlqrx9/3ns2rEDhGKfTa+88RmXqedC1zmVTOWrLc2e6DEJrTA51C9iLH5g==}
+ '@typescript-eslint/[email protected]':
+ 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/[email protected]':
- resolution: {integrity: sha512-QAkFEbytSaB8wnmB+DflhUPz6CLbFWE2SnSCrRMEa+KnXIzDYbpsn++1HGvnfAsUY44doDXmvRkO5shlM/3UfA==}
+ '@typescript-eslint/[email protected]':
+ 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/[email protected]':
- resolution: {integrity: sha512-RGLh5CRaUEf02viP5c1Vh1cMGffQscyHe7HPAzGpfmfflFg1wUz2rYxd+OZqwpeypYvZ8UxSxuIpF++fmOzEcg==}
+ '@typescript-eslint/[email protected]':
+ resolution: {integrity: sha512-aEhgas7aJ6vZnNFC7K4/vMGDGyOiqWcYZPpIWrTKuTAlsvDNKy2GFDqh9smL+iq069ZvR0YzEeq0B8NJlLzjFA==}
engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0}
'@webassemblyjs/[email protected]':
@@ -900,8 +900,8 @@ packages:
resolution: {integrity: sha512-gxGWBrTT1JuMx6R+o5PTXMmUnhnVzLQ9SNutD4YqKtI6ap897t3tKECYla6gCWEkplXnlNybEkZg9GEGxKFCgw==}
- resolution: {integrity: sha512-wCIWIg+A4Xr7NfhTuHdX+/FKh3+Op3LBbSp2N5Pfx6T/LhdQy3GTyoTg48BReaW/MyMNZAkTadsBtai3ldWK0Q==}
+ resolution: {integrity: sha512-mtgapdwDLSSBnCI3JokHM7oEQBLxiJKVRtg10AxM1AyeiKcM96f0Mkbqeq+1AbiCtvMcHRulAAEMu693JrSWqg==}
resolution: {integrity: sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==}
@@ -1177,8 +1177,8 @@ packages:
resolution: {integrity: sha512-a8QRH0rAPIWH9WyyS5LbNvW9Ark6qe63/LqDB7vu2JXYpi0Gma5Q60Dh4tmTqhOBQt0xsrzD8qE7C+D7j+B24A==}
- resolution: {integrity: sha512-kL4+wUTD7RSA5FHx5YwWtjDnEEkIIikFgWHR4P6fqjw1PPLlqYkxeOb++wAauAssat0YClCy8Y3C5SxgSkjibQ==}
+ resolution: {integrity: sha512-/QSJaU2JyIuTbbABAo/crOs+SuAZLS+fVVS10PVrIT9hrRkmZl8Hb0xPSkKRUUWHQtYzXHpQUW3Dy5hwMzGZkA==}
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/[email protected]':
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/[email protected]':
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/[email protected]':
optional: true
- '@eslint-community/[email protected]([email protected])':
+ '@eslint-community/[email protected]([email protected])':
dependencies:
eslint: 9.24.0
eslint-visitor-keys: 3.4.3
@@ -3222,14 +3222,14 @@ snapshots:
'@types/node': 18.19.86
optional: true
dependencies:
'@eslint-community/regexpp': 4.12.1
- '@typescript-eslint/parser': 8.29.1([email protected])([email protected])
- '@typescript-eslint/scope-manager': 8.29.1
- '@typescript-eslint/type-utils': 8.29.1([email protected])([email protected])
- '@typescript-eslint/utils': 8.29.1([email protected])([email protected])
- '@typescript-eslint/visitor-keys': 8.29.1
+ '@typescript-eslint/parser': 8.30.1([email protected])([email protected])
+ '@typescript-eslint/scope-manager': 8.30.1
+ '@typescript-eslint/type-utils': 8.30.1([email protected])([email protected])
+ '@typescript-eslint/utils': 8.30.1([email protected])([email protected])
+ '@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
dependencies:
- '@typescript-eslint/scope-manager': 8.29.1
- '@typescript-eslint/types': 8.29.1
- '@typescript-eslint/typescript-estree': 8.29.1([email protected])
- '@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([email protected])
+ '@typescript-eslint/visitor-keys': 8.30.1
debug: 4.4.0
eslint: 9.24.0
typescript: 4.9.5
transitivePeerDependencies:
- supports-color
- '@typescript-eslint/[email protected]':
+ '@typescript-eslint/[email protected]':
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
dependencies:
- '@typescript-eslint/typescript-estree': 8.29.1([email protected])
- '@typescript-eslint/utils': 8.29.1([email protected])([email protected])
+ '@typescript-eslint/typescript-estree': 8.30.1([email protected])
+ '@typescript-eslint/utils': 8.30.1([email protected])([email protected])
debug: 4.4.0
eslint: 9.24.0
ts-api-utils: 2.1.0([email protected])
@@ -3267,12 +3267,12 @@ snapshots:
transitivePeerDependencies:
- supports-color
- '@typescript-eslint/[email protected]': {}
+ '@typescript-eslint/[email protected]': {}
- '@typescript-eslint/[email protected]([email protected])':
+ '@typescript-eslint/[email protected]([email protected])':
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
dependencies:
- '@eslint-community/eslint-utils': 4.6.0([email protected])
- '@typescript-eslint/scope-manager': 8.29.1
- '@typescript-eslint/types': 8.29.1
- '@typescript-eslint/typescript-estree': 8.29.1([email protected])
+ '@eslint-community/eslint-utils': 4.6.1([email protected])
+ '@typescript-eslint/scope-manager': 8.30.1
+ '@typescript-eslint/types': 8.30.1
+ '@typescript-eslint/typescript-estree': 8.30.1([email protected])
eslint: 9.24.0
typescript: 4.9.5
transitivePeerDependencies:
- supports-color
- '@typescript-eslint/[email protected]':
+ '@typescript-eslint/[email protected]':
dependencies:
- '@typescript-eslint/types': 8.29.1
+ '@typescript-eslint/types': 8.30.1
eslint-visitor-keys: 4.2.0
'@webassemblyjs/[email protected]':
@@ -3560,8 +3560,8 @@ snapshots:
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([email protected])
@@ -3650,7 +3650,7 @@ snapshots:
pascal-case: 3.1.2
tslib: 2.8.1
dependencies:
@@ -3963,7 +3963,7 @@ snapshots:
transitivePeerDependencies:
- supports-color
dependencies:
@@ -4086,7 +4086,7 @@ snapshots:
dependencies:
- '@eslint-community/eslint-utils': 4.6.0([email protected])
+ '@eslint-community/eslint-utils': 4.6.1([email protected])
'@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 325685fe51..ac849f521d 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(/<br>/g, "\n").replace(/<br\/>/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(/<br>/g, "\n").replace(/<br\/>/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