@blocklet/editor 2.1.108 → 2.1.109

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.
@@ -9,7 +9,7 @@ export declare const insertNodesAfter: (node: LexicalNode, nodesToInsert: Lexica
9
9
  * - $isTextNode => true
10
10
  * - format 不是 code
11
11
  */
12
- export declare const $isValidTextNode: (node: LexicalNode) => string | false;
12
+ export declare const $isValidTextNode: (node: LexicalNode) => boolean | "";
13
13
  /**
14
14
  * 判断一个 top level node 是否含有效的 TextNode 的 child
15
15
  */
@@ -8,6 +8,7 @@ import { getCSRFToken } from '@blocklet/js-sdk';
8
8
  import { $generateHtmlFromNodes, $generateNodesFromDOM } from '@lexical/html';
9
9
  import { blockletExists, getBlockletMountPointInfo, isValidUrl } from '../utils';
10
10
  import { $getDepth } from '../../lexical-utils';
11
+ import { $isMentionNode } from '../../main/nodes/MentionNode';
11
12
  const REGEX_INVALID_SEQUENCE = /^[#$%^&*()_+\-=\\[\]{};':"\\|,.<>/?]+$/;
12
13
  export const defaultTranslateAPI = async ({ texts, sourceLanguage, targetLanguage }, onData) => {
13
14
  if (!blockletExists('did-comments')) {
@@ -84,7 +85,7 @@ export const insertNodesAfter = (node, nodesToInsert) => {
84
85
  * - format 不是 code
85
86
  */
86
87
  export const $isValidTextNode = (node) => {
87
- return $isTextNode(node) && node.getTextContent().trim();
88
+ return $isTextNode(node) && node.getTextContent().trim() && !$isMentionNode(node);
88
89
  };
89
90
  /**
90
91
  * 判断一个 top level node 是否含有效的 TextNode 的 child
@@ -6,6 +6,7 @@ import { $generateHtmlFromNodes } from '@lexical/html';
6
6
  import { $createEmojiNode } from '../../main/nodes/EmojiNode';
7
7
  import { $createTranslationNode } from './TranslationNode';
8
8
  import { $isExcalidrawNode } from '../../main/nodes/ExcalidrawNode';
9
+ import { $isMentionNode } from '../../main/nodes/MentionNode';
9
10
  /**
10
11
  * Creates a mapping between node keys and sequential IDs
11
12
  * @param reversed If true, maps ID -> key. If false, maps key -> ID
@@ -113,7 +114,7 @@ export const applyTranslations = (editor, translations, displayMode) => {
113
114
  * - format 不是 code
114
115
  */
115
116
  const $isValidTextNode = (node) => {
116
- return $isTextNode(node) && node.getTextContent().trim();
117
+ return $isTextNode(node) && node.getTextContent().trim() && !$isMentionNode(node);
117
118
  };
118
119
  /**
119
120
  * 判断一个 top level node 是否含有效的 TextNode 的 child
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@blocklet/editor",
3
- "version": "2.1.108",
3
+ "version": "2.1.109",
4
4
  "main": "lib/index.js",
5
5
  "publishConfig": {
6
6
  "access": "public"
@@ -65,7 +65,7 @@
65
65
  "ufo": "^1.5.4",
66
66
  "url-join": "^4.0.1",
67
67
  "zustand": "^4.5.5",
68
- "@blocklet/pdf": "^2.1.108"
68
+ "@blocklet/pdf": "^2.1.109"
69
69
  },
70
70
  "devDependencies": {
71
71
  "@babel/core": "^7.25.2",