@blocklet/editor 2.1.43 → 2.1.45

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.
@@ -1,4 +1,4 @@
1
- import { ElementNode, LexicalNode, LexicalEditor } from 'lexical';
1
+ import { LexicalEditor } from 'lexical';
2
2
  interface TranslateItem {
3
3
  uid: string;
4
4
  text: string;
@@ -14,14 +14,4 @@ export declare const translateEditorNodes: ({ editor, targetLanguage, translateS
14
14
  detectLanguage: (text: string) => string | null;
15
15
  }) => Promise<void>;
16
16
  export declare const restoreTranslation: (editor: LexicalEditor) => void;
17
- /**
18
- * 判断 node 是否是有效的 TextNode
19
- * - $isTextNode => true
20
- * - format 不是 code
21
- */
22
- export declare const $isValidTextNode: (node: LexicalNode) => string | false;
23
- /**
24
- * 判断一个 top level node 是否含有效的 TextNode 的 child
25
- */
26
- export declare const $hasValidTextNode: (elementNode: ElementNode) => boolean;
27
17
  export {};
@@ -5,6 +5,7 @@ import { $dfs } from '@lexical/utils';
5
5
  import { $generateHtmlFromNodes } from '@lexical/html';
6
6
  import { $createEmojiNode } from '../../main/nodes/EmojiNode';
7
7
  import { $createTranslationNode, TranslationNode } from './TranslationNode';
8
+ import { $isExcalidrawNode } from '../../main/nodes/ExcalidrawNode';
8
9
  /**
9
10
  * Creates a mapping between node keys and sequential IDs
10
11
  * @param reversed If true, maps ID -> key. If false, maps key -> ID
@@ -34,7 +35,9 @@ const nodeToHtml = (editor, node) => {
34
35
  // 剔除嵌套 list 节点
35
36
  children
36
37
  .filter((x) => !$isListNode(x))
37
- .forEach((child) => $dfs(child).forEach((x) => selection.add(x.node.getKey())));
38
+ .forEach((child) => $dfs(child)
39
+ .filter((x) => !$isExcalidrawNode(x.node))
40
+ .forEach((x) => selection.add(x.node.getKey())));
38
41
  const html = $generateHtmlFromNodes(editor, selection);
39
42
  return html;
40
43
  };
@@ -102,12 +105,12 @@ export const restoreTranslation = (editor) => {
102
105
  * - $isTextNode => true
103
106
  * - format 不是 code
104
107
  */
105
- export const $isValidTextNode = (node) => {
108
+ const $isValidTextNode = (node) => {
106
109
  return $isTextNode(node) && node.getTextContent().trim();
107
110
  };
108
111
  /**
109
112
  * 判断一个 top level node 是否含有效的 TextNode 的 child
110
113
  */
111
- export const $hasValidTextNode = (elementNode) => {
114
+ const $hasValidTextNode = (elementNode) => {
112
115
  return elementNode.getChildren().some($isValidTextNode);
113
116
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@blocklet/editor",
3
- "version": "2.1.43",
3
+ "version": "2.1.45",
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.43"
68
+ "@blocklet/pdf": "^2.1.45"
69
69
  },
70
70
  "devDependencies": {
71
71
  "@babel/core": "^7.25.2",