@blocklet/editor 1.6.219 → 1.6.221
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -6,6 +6,7 @@ import { fetchEventSource } from '@microsoft/fetch-event-source';
|
|
|
6
6
|
import { $createLinkNode, $isLinkNode } from '@lexical/link';
|
|
7
7
|
import { blockletExists, getBlockletMountPointInfo, isValidUrl } from '../utils';
|
|
8
8
|
import { $getDepth } from '../../lexical-utils';
|
|
9
|
+
const REGEX_INVALID_SEQUENCE = /^[!@#$%^&*()_+\-=\\[\]{};':"\\|,.<>/?].*$/;
|
|
9
10
|
const PLACEHOLDER = '[[PLACEHOLDER]]';
|
|
10
11
|
export const defaultTranslateAPI = async ({ texts, sourceLanguage, targetLanguage }, onData) => {
|
|
11
12
|
if (!blockletExists('did-comments')) {
|
|
@@ -163,7 +164,7 @@ export const $extractTranslationBlocks = (translationNodes) => {
|
|
|
163
164
|
.filter((item) => {
|
|
164
165
|
const trim = item.text?.trim();
|
|
165
166
|
// 如果为空或 url, 则不翻译
|
|
166
|
-
if (!trim || isValidUrl(trim)) {
|
|
167
|
+
if (!trim || isValidUrl(trim) || REGEX_INVALID_SEQUENCE.test(trim)) {
|
|
167
168
|
return false;
|
|
168
169
|
}
|
|
169
170
|
return true;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@blocklet/editor",
|
|
3
|
-
"version": "1.6.
|
|
3
|
+
"version": "1.6.221",
|
|
4
4
|
"main": "lib/index.js",
|
|
5
5
|
"scripts": {
|
|
6
6
|
"dev": "npm run storybook",
|
|
@@ -39,7 +39,7 @@
|
|
|
39
39
|
"dependencies": {
|
|
40
40
|
"@arcblock/ux": "^2.9.68",
|
|
41
41
|
"@blocklet/embed": "^0.1.11",
|
|
42
|
-
"@blocklet/pdf": "1.6.
|
|
42
|
+
"@blocklet/pdf": "1.6.221",
|
|
43
43
|
"@excalidraw/excalidraw": "^0.14.2",
|
|
44
44
|
"@iconify/iconify": "^3.0.1",
|
|
45
45
|
"@lexical/clipboard": "0.13.1",
|
|
@@ -108,5 +108,5 @@
|
|
|
108
108
|
"react": "*",
|
|
109
109
|
"react-dom": "*"
|
|
110
110
|
},
|
|
111
|
-
"gitHead": "
|
|
111
|
+
"gitHead": "f0112b033a68810a1c41806d7c4587b264021a68"
|
|
112
112
|
}
|