@lobehub/editor 3.5.0 → 3.6.0

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.
@@ -2296,7 +2296,7 @@ if(this._pendingEditorState===null){rootElement.removeAttribute('autocapitalize'
2296
2296
  * See {@link LexicalNode.exportJSON}
2297
2297
  *
2298
2298
  * @returns A JSON-serializable javascript object
2299
- */},{key:"toJSON",value:function toJSON(){return{editorState:this._editorState.toJSON()};}}]);return LexicalEditor;}();/** @internal */ /** The version with build identifiers for this editor (since 0.17.1) */_defineProperty(LexicalEditor,"version",void 0);LexicalEditor.version='0.39.0+dev.cjs';var pendingNodeToClone=null;function setPendingNodeToClone(pendingNode){pendingNodeToClone=pendingNode;}function getPendingNodeToClone(){var node=pendingNodeToClone;pendingNodeToClone=null;return node;}var keyCounter=1;function resetRandomKey(){keyCounter=1;}function generateRandomKey(){return''+keyCounter++;}/**
2299
+ */},{key:"toJSON",value:function toJSON(){return{editorState:this._editorState.toJSON()};}}]);return LexicalEditor;}();/** @internal */ /** The version with build identifiers for this editor (since 0.17.1) */_defineProperty(LexicalEditor,"version",void 0);LexicalEditor.version='0.39.0+dev.cjs';var pendingNodeToClone=null;function setPendingNodeToClone(pendingNode){pendingNodeToClone=pendingNode;}function getPendingNodeToClone(){var node=pendingNodeToClone;pendingNodeToClone=null;return node;}var keyCounter=1;function resetRandomKey(targetId){if(targetId!==undefined){keyCounter=targetId;}else{keyCounter=1;}}function generateRandomKey(targetId){return''+keyCounter++;}/**
2300
2300
  * @internal
2301
2301
  */function getRegisteredNodeOrThrow(editor,nodeType){var registeredNode=getRegisteredNode(editor,nodeType);if(registeredNode===undefined){{formatDevErrorMessage("registeredNode: Type ".concat(nodeType," not found"));}}return registeredNode;}/**
2302
2302
  * @internal
@@ -11814,10 +11814,14 @@ function getPendingNodeToClone() {
11814
11814
  return node;
11815
11815
  }
11816
11816
  let keyCounter = 1;
11817
- function resetRandomKey() {
11818
- keyCounter = 1;
11817
+ function resetRandomKey(targetId) {
11818
+ if (targetId !== undefined) {
11819
+ keyCounter = targetId;
11820
+ } else {
11821
+ keyCounter = 1;
11822
+ }
11819
11823
  }
11820
- function generateRandomKey() {
11824
+ function generateRandomKey(targetId) {
11821
11825
  return '' + keyCounter++;
11822
11826
  }
11823
11827
 
@@ -7621,8 +7621,8 @@ exports.$addUpdateTag = wi, exports.$applyNodeReplacement = Bi, exports.$caretFr
7621
7621
  return M.test(t) ? 'rtl' : A.test(t) ? 'ltr' : null;
7622
7622
  }, exports.getTransformSetFromKlass = Eo, exports.isBlockDomNode = qi, exports.isCurrentlyReadOnlyMode = $r, exports.isDOMDocumentNode = Uo, exports.isDOMNode = Hi, exports.isDOMTextNode = $o, exports.isDOMUnmanaged = os, exports.isDocumentFragment = Vi, exports.isExactShortcutMatch = pi, exports.isHTMLAnchorElement = function (t) {
7623
7623
  return ji(t) && 'A' === t.tagName;
7624
- }, exports.isHTMLElement = ji, exports.isInlineDomNode = Gi, exports.isLexicalEditor = Ro, exports.isModifierMatch = _i, exports.isSelectionCapturedInDecoratorInput = Lo, exports.isSelectionWithinEditor = Fo, exports.makeStepwiseIterator = Is, exports.removeFromParent = Ho, exports.resetRandomKey = function () {
7625
- Ao = 1;
7624
+ }, exports.isHTMLElement = ji, exports.isInlineDomNode = Gi, exports.isLexicalEditor = Ro, exports.isModifierMatch = _i, exports.isSelectionCapturedInDecoratorInput = Lo, exports.isSelectionWithinEditor = Fo, exports.makeStepwiseIterator = Is, exports.removeFromParent = Ho, exports.resetRandomKey = function (t) {
7625
+ Ao = void 0 !== t ? t : 1;
7626
7626
  }, exports.safeCast = function (t) {
7627
7627
  return t;
7628
7628
  }, exports.setDOMUnmanaged = function (t) {
@@ -5680,8 +5680,8 @@ function no(t) {
5680
5680
  eo = t;
5681
5681
  }
5682
5682
  let ro = 1;
5683
- function io() {
5684
- ro = 1;
5683
+ function io(t) {
5684
+ ro = void 0 !== t ? t : 1;
5685
5685
  }
5686
5686
  function oo(e, n) {
5687
5687
  const r = so(e, n);
@@ -615,7 +615,7 @@ export declare class LexicalEditor {
615
615
  */
616
616
  parseEditorState(
617
617
  maybeStringifiedEditorState: string | SerializedEditorState,
618
- updateFn?: (editorState: EditorState) => void,
618
+ updateFn?: (state: EditorState) => void,
619
619
  ): EditorState;
620
620
  /**
621
621
  * Executes a read of the editor's state, with the
@@ -33,7 +33,7 @@ export declare function $parseSerializedNode(serializedNode: SerializedLexicalNo
33
33
  export declare function parseEditorState(
34
34
  serializedEditorState: SerializedEditorState,
35
35
  editor: LexicalEditor,
36
- updateFn: void | ((editorState: EditorState) => void),
36
+ updateFn: void | ((state: EditorState) => void),
37
37
  ): EditorState;
38
38
  export declare function readEditorState<V>(
39
39
  editor: LexicalEditor | null,
@@ -28,8 +28,8 @@ import { type TextFormatType, TextNode } from './nodes/LexicalTextNode';
28
28
  export declare const emptyFunction: () => void;
29
29
  export declare function setPendingNodeToClone(pendingNode: null | LexicalNode): void;
30
30
  export declare function getPendingNodeToClone(): null | LexicalNode;
31
- export declare function resetRandomKey(): void;
32
- export declare function generateRandomKey(): string;
31
+ export declare function resetRandomKey(targetId?: number): void;
32
+ export declare function generateRandomKey(targetId?: number): string;
33
33
  /**
34
34
  * @internal
35
35
  */
@@ -306,6 +306,6 @@ export declare class TextNode extends LexicalNode {
306
306
  */
307
307
  isTextEntity(): boolean;
308
308
  }
309
- export declare function findParentPreDOMNode(node: Node): Node | null;
309
+ export declare function findParentPreDOMNode(node: Node): any;
310
310
  export declare function $createTextNode(text?: string): TextNode;
311
311
  export declare function $isTextNode(node: LexicalNode | null | undefined): node is TextNode;
@@ -1,7 +1,7 @@
1
1
  'use client';
2
2
 
3
- import { ActionIcon, Flexbox, InputNumber, Text } from '@lobehub/ui';
4
- import { Popover, Switch } from 'antd';
3
+ import { ActionIcon, Flexbox, InputNumber, Popover, Text } from '@lobehub/ui';
4
+ import { Switch } from 'antd';
5
5
  import { MoreHorizontalIcon } from 'lucide-react';
6
6
  import { useCallback } from 'react';
7
7
  import { useTranslation } from "../../../../editor-kernel/react/useTranslation";
@@ -1,7 +1,7 @@
1
1
  function _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it.return != null) it.return(); } finally { if (didErr) throw err; } } }; }
2
2
  function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
3
3
  function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
4
- import { $isElementNode } from 'lexical';
4
+ import { $isElementNode, resetRandomKey } from 'lexical';
5
5
  export function $parseSerializedNodeImpl(serializedNode, editor) {
6
6
  var keepId = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
7
7
  var state = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : null;
@@ -14,11 +14,10 @@ export function $parseSerializedNodeImpl(serializedNode, editor) {
14
14
  if (serializedNode.type !== nodeClass.getType()) {
15
15
  throw new Error("LexicalNode: Node ".concat(nodeClass.name, " does not implement .importJSON()."));
16
16
  }
17
- var node = nodeClass.importJSON(serializedNode);
18
17
  if (keepId && serializedNode.id) {
19
- node.__key = serializedNode.id;
20
- state === null || state === void 0 || state._nodeMap.set(node.__key, node);
18
+ resetRandomKey(Number(serializedNode.id));
21
19
  }
20
+ var node = nodeClass.importJSON(serializedNode);
22
21
  var children = serializedNode.children;
23
22
  if ($isElementNode(node) && Array.isArray(children)) {
24
23
  var childNodes = [];
@@ -1,7 +1,6 @@
1
1
  'use client';
2
2
 
3
- import { ActionIcon, Flexbox } from '@lobehub/ui';
4
- import { Popover } from 'antd';
3
+ import { ActionIcon, Flexbox, Popover } from '@lobehub/ui';
5
4
  import { CircleChevronLeftIcon, CircleChevronRightIcon, CircleChevronUpIcon } from 'lucide-react';
6
5
  import { motion } from 'motion/react';
7
6
  import { styles } from "../style";
@@ -1,7 +1,6 @@
1
1
  'use client';
2
2
 
3
- import { ActionIcon, Flexbox } from '@lobehub/ui';
4
- import { Popover } from 'antd';
3
+ import { ActionIcon, Flexbox, Popover } from '@lobehub/ui';
5
4
  import { CircleChevronLeftIcon, CircleChevronRightIcon, CircleChevronUpIcon } from 'lucide-react';
6
5
  import { motion } from 'motion/react';
7
6
  import { styles } from "../style";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lobehub/editor",
3
- "version": "3.5.0",
3
+ "version": "3.6.0",
4
4
  "description": "A powerful and extensible rich text editor built on Meta's Lexical framework, providing a modern editing experience with React integration.",
5
5
  "keywords": [
6
6
  "lobehub",
@@ -65,7 +65,7 @@
65
65
  "use-merge-value": "^1.2.0"
66
66
  },
67
67
  "peerDependencies": {
68
- "@lobehub/ui": "^4.3.4",
68
+ "@lobehub/ui": "^4.11.5",
69
69
  "antd": "^6.1.1",
70
70
  "motion": "^12.0.0",
71
71
  "react": "^19.0.0",