lexical 0.28.1-nightly.20250321.0 → 0.28.1-nightly.20250324.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.
- package/Lexical.dev.js +38 -6
- package/Lexical.dev.mjs +38 -6
- package/Lexical.js.flow +13 -0
- package/Lexical.prod.js +1 -1
- package/Lexical.prod.mjs +1 -1
- package/LexicalEditor.d.ts +3 -1
- package/package.json +1 -1
package/Lexical.dev.js
CHANGED
|
@@ -1749,6 +1749,27 @@ function getPrevElementByKeyOrThrow(key) {
|
|
|
1749
1749
|
return element;
|
|
1750
1750
|
}
|
|
1751
1751
|
|
|
1752
|
+
/**
|
|
1753
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
1754
|
+
*
|
|
1755
|
+
* This source code is licensed under the MIT license found in the
|
|
1756
|
+
* LICENSE file in the root directory of this source tree.
|
|
1757
|
+
*
|
|
1758
|
+
*/
|
|
1759
|
+
|
|
1760
|
+
/*@__INLINE__*/
|
|
1761
|
+
function warnOnlyOnce(message) {
|
|
1762
|
+
{
|
|
1763
|
+
let run = false;
|
|
1764
|
+
return () => {
|
|
1765
|
+
if (!run) {
|
|
1766
|
+
console.warn(message);
|
|
1767
|
+
}
|
|
1768
|
+
run = true;
|
|
1769
|
+
};
|
|
1770
|
+
}
|
|
1771
|
+
}
|
|
1772
|
+
|
|
1752
1773
|
/**
|
|
1753
1774
|
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
1754
1775
|
*
|
|
@@ -2353,6 +2374,9 @@ function onInput(event, editor) {
|
|
|
2353
2374
|
// We don't want the onInput to bubble, in the case of nested editors.
|
|
2354
2375
|
event.stopPropagation();
|
|
2355
2376
|
updateEditorSync(editor, () => {
|
|
2377
|
+
if (isHTMLElement(event.target) && $isSelectionCapturedInDecorator(event.target)) {
|
|
2378
|
+
return;
|
|
2379
|
+
}
|
|
2356
2380
|
const selection = $getSelection();
|
|
2357
2381
|
const data = event.data;
|
|
2358
2382
|
const targetRange = getTargetRange(event);
|
|
@@ -2738,12 +2762,17 @@ function addRootElementEvents(rootElement, editor) {
|
|
|
2738
2762
|
});
|
|
2739
2763
|
}
|
|
2740
2764
|
}
|
|
2765
|
+
const rootElementNotRegisteredWarning = warnOnlyOnce('Root element not registered');
|
|
2741
2766
|
function removeRootElementEvents(rootElement) {
|
|
2742
2767
|
const doc = rootElement.ownerDocument;
|
|
2743
2768
|
const documentRootElementsCount = rootElementsRegistered.get(doc);
|
|
2744
|
-
if (
|
|
2745
|
-
|
|
2746
|
-
|
|
2769
|
+
if (documentRootElementsCount === undefined) {
|
|
2770
|
+
// This can happen if setRootElement() failed
|
|
2771
|
+
rootElementNotRegisteredWarning();
|
|
2772
|
+
return;
|
|
2773
|
+
}
|
|
2774
|
+
|
|
2775
|
+
// We only want to have a single global selectionchange event handler, shared
|
|
2747
2776
|
// between all editor instances.
|
|
2748
2777
|
const newCount = documentRootElementsCount - 1;
|
|
2749
2778
|
if (!(newCount >= 0)) {
|
|
@@ -9582,7 +9611,7 @@ function createEditor(editorConfig) {
|
|
|
9582
9611
|
disableEvents,
|
|
9583
9612
|
namespace,
|
|
9584
9613
|
theme
|
|
9585
|
-
}, onError ? onError : console.error, initializeConversionCache(registeredNodes, html ? html.import : undefined), isEditable);
|
|
9614
|
+
}, onError ? onError : console.error, initializeConversionCache(registeredNodes, html ? html.import : undefined), isEditable, editorConfig);
|
|
9586
9615
|
if (initialEditorState !== undefined) {
|
|
9587
9616
|
editor._pendingEditorState = initialEditorState;
|
|
9588
9617
|
editor._dirtyType = FULL_RECONCILE;
|
|
@@ -9651,7 +9680,10 @@ class LexicalEditor {
|
|
|
9651
9680
|
/** @internal */
|
|
9652
9681
|
|
|
9653
9682
|
/** @internal */
|
|
9654
|
-
|
|
9683
|
+
|
|
9684
|
+
/** @internal */
|
|
9685
|
+
constructor(editorState, parentEditor, nodes, config, onError, htmlConversions, editable, createEditorArgs) {
|
|
9686
|
+
this._createEditorArgs = createEditorArgs;
|
|
9655
9687
|
this._parentEditor = parentEditor;
|
|
9656
9688
|
// The root element associated with this editor
|
|
9657
9689
|
this._rootElement = null;
|
|
@@ -10259,7 +10291,7 @@ class LexicalEditor {
|
|
|
10259
10291
|
};
|
|
10260
10292
|
}
|
|
10261
10293
|
}
|
|
10262
|
-
LexicalEditor.version = "0.28.1-nightly.
|
|
10294
|
+
LexicalEditor.version = "0.28.1-nightly.20250324.0+dev.cjs";
|
|
10263
10295
|
|
|
10264
10296
|
let keyCounter = 1;
|
|
10265
10297
|
function resetRandomKey() {
|
package/Lexical.dev.mjs
CHANGED
|
@@ -1747,6 +1747,27 @@ function getPrevElementByKeyOrThrow(key) {
|
|
|
1747
1747
|
return element;
|
|
1748
1748
|
}
|
|
1749
1749
|
|
|
1750
|
+
/**
|
|
1751
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
1752
|
+
*
|
|
1753
|
+
* This source code is licensed under the MIT license found in the
|
|
1754
|
+
* LICENSE file in the root directory of this source tree.
|
|
1755
|
+
*
|
|
1756
|
+
*/
|
|
1757
|
+
|
|
1758
|
+
/*@__INLINE__*/
|
|
1759
|
+
function warnOnlyOnce(message) {
|
|
1760
|
+
{
|
|
1761
|
+
let run = false;
|
|
1762
|
+
return () => {
|
|
1763
|
+
if (!run) {
|
|
1764
|
+
console.warn(message);
|
|
1765
|
+
}
|
|
1766
|
+
run = true;
|
|
1767
|
+
};
|
|
1768
|
+
}
|
|
1769
|
+
}
|
|
1770
|
+
|
|
1750
1771
|
/**
|
|
1751
1772
|
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
1752
1773
|
*
|
|
@@ -2351,6 +2372,9 @@ function onInput(event, editor) {
|
|
|
2351
2372
|
// We don't want the onInput to bubble, in the case of nested editors.
|
|
2352
2373
|
event.stopPropagation();
|
|
2353
2374
|
updateEditorSync(editor, () => {
|
|
2375
|
+
if (isHTMLElement(event.target) && $isSelectionCapturedInDecorator(event.target)) {
|
|
2376
|
+
return;
|
|
2377
|
+
}
|
|
2354
2378
|
const selection = $getSelection();
|
|
2355
2379
|
const data = event.data;
|
|
2356
2380
|
const targetRange = getTargetRange(event);
|
|
@@ -2736,12 +2760,17 @@ function addRootElementEvents(rootElement, editor) {
|
|
|
2736
2760
|
});
|
|
2737
2761
|
}
|
|
2738
2762
|
}
|
|
2763
|
+
const rootElementNotRegisteredWarning = warnOnlyOnce('Root element not registered');
|
|
2739
2764
|
function removeRootElementEvents(rootElement) {
|
|
2740
2765
|
const doc = rootElement.ownerDocument;
|
|
2741
2766
|
const documentRootElementsCount = rootElementsRegistered.get(doc);
|
|
2742
|
-
if (
|
|
2743
|
-
|
|
2744
|
-
|
|
2767
|
+
if (documentRootElementsCount === undefined) {
|
|
2768
|
+
// This can happen if setRootElement() failed
|
|
2769
|
+
rootElementNotRegisteredWarning();
|
|
2770
|
+
return;
|
|
2771
|
+
}
|
|
2772
|
+
|
|
2773
|
+
// We only want to have a single global selectionchange event handler, shared
|
|
2745
2774
|
// between all editor instances.
|
|
2746
2775
|
const newCount = documentRootElementsCount - 1;
|
|
2747
2776
|
if (!(newCount >= 0)) {
|
|
@@ -9580,7 +9609,7 @@ function createEditor(editorConfig) {
|
|
|
9580
9609
|
disableEvents,
|
|
9581
9610
|
namespace,
|
|
9582
9611
|
theme
|
|
9583
|
-
}, onError ? onError : console.error, initializeConversionCache(registeredNodes, html ? html.import : undefined), isEditable);
|
|
9612
|
+
}, onError ? onError : console.error, initializeConversionCache(registeredNodes, html ? html.import : undefined), isEditable, editorConfig);
|
|
9584
9613
|
if (initialEditorState !== undefined) {
|
|
9585
9614
|
editor._pendingEditorState = initialEditorState;
|
|
9586
9615
|
editor._dirtyType = FULL_RECONCILE;
|
|
@@ -9649,7 +9678,10 @@ class LexicalEditor {
|
|
|
9649
9678
|
/** @internal */
|
|
9650
9679
|
|
|
9651
9680
|
/** @internal */
|
|
9652
|
-
|
|
9681
|
+
|
|
9682
|
+
/** @internal */
|
|
9683
|
+
constructor(editorState, parentEditor, nodes, config, onError, htmlConversions, editable, createEditorArgs) {
|
|
9684
|
+
this._createEditorArgs = createEditorArgs;
|
|
9653
9685
|
this._parentEditor = parentEditor;
|
|
9654
9686
|
// The root element associated with this editor
|
|
9655
9687
|
this._rootElement = null;
|
|
@@ -10257,7 +10289,7 @@ class LexicalEditor {
|
|
|
10257
10289
|
};
|
|
10258
10290
|
}
|
|
10259
10291
|
}
|
|
10260
|
-
LexicalEditor.version = "0.28.1-nightly.
|
|
10292
|
+
LexicalEditor.version = "0.28.1-nightly.20250324.0+dev.esm";
|
|
10261
10293
|
|
|
10262
10294
|
let keyCounter = 1;
|
|
10263
10295
|
function resetRandomKey() {
|
package/Lexical.js.flow
CHANGED
|
@@ -145,6 +145,18 @@ type DOMConversionCache = Map<
|
|
|
145
145
|
Array<(node: Node) => DOMConversion | null>,
|
|
146
146
|
>;
|
|
147
147
|
|
|
148
|
+
export type CreateEditorArgs = {
|
|
149
|
+
disableEvents?: boolean;
|
|
150
|
+
editorState?: EditorState;
|
|
151
|
+
namespace?: string;
|
|
152
|
+
nodes?: $ReadOnlyArray<Class<LexicalNode> | LexicalNodeReplacement>;
|
|
153
|
+
onError?: ErrorHandler;
|
|
154
|
+
parentEditor?: LexicalEditor;
|
|
155
|
+
editable?: boolean;
|
|
156
|
+
theme?: EditorThemeClasses;
|
|
157
|
+
html?: HTMLConfig;
|
|
158
|
+
};
|
|
159
|
+
|
|
148
160
|
declare export class LexicalEditor {
|
|
149
161
|
_parentEditor: null | LexicalEditor;
|
|
150
162
|
_rootElement: null | HTMLElement;
|
|
@@ -166,6 +178,7 @@ declare export class LexicalEditor {
|
|
|
166
178
|
_pendingDecorators: null | {
|
|
167
179
|
[NodeKey]: mixed,
|
|
168
180
|
};
|
|
181
|
+
_createEditorArgs?: CreateEditorArgs;
|
|
169
182
|
_config: EditorConfig;
|
|
170
183
|
_dirtyType: 0 | 1 | 2;
|
|
171
184
|
_cloneNotNeeded: Set<NodeKey>;
|