@lexical/react 0.1.10 → 0.1.11
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/DEPRECATED_useLexicalAutoFormatter.dev.js +69 -28
- package/DEPRECATED_useLexicalAutoFormatter.prod.js +19 -18
- package/DEPRECATED_useLexicalCharacterLimit.dev.js +20 -17
- package/DEPRECATED_useLexicalCharacterLimit.prod.js +8 -8
- package/DEPRECATED_useLexicalList.dev.js +6 -0
- package/DEPRECATED_useLexicalList.prod.js +1 -1
- package/DEPRECATED_useLexicalPlainText.dev.js +61 -58
- package/DEPRECATED_useLexicalPlainText.prod.js +15 -15
- package/DEPRECATED_useLexicalRichText.dev.js +64 -61
- package/DEPRECATED_useLexicalRichText.prod.js +24 -25
- package/LexicalAutoFormatterPlugin.dev.js +69 -28
- package/LexicalAutoFormatterPlugin.js.flow +10 -0
- package/LexicalAutoFormatterPlugin.prod.js +20 -19
- package/LexicalAutoLinkPlugin.js.flow +23 -0
- package/LexicalCharacterLimitPlugin.dev.js +20 -17
- package/LexicalCharacterLimitPlugin.js.flow +12 -0
- package/LexicalCharacterLimitPlugin.prod.js +9 -8
- package/LexicalClearEditorPlugin.dev.js +52 -0
- package/LexicalClearEditorPlugin.js +9 -0
- package/LexicalClearEditorPlugin.js.flow +14 -0
- package/LexicalClearEditorPlugin.prod.js +7 -0
- package/LexicalCollaborationPlugin.dev.js +21 -11
- package/LexicalCollaborationPlugin.js.flow +55 -0
- package/LexicalCollaborationPlugin.prod.js +7 -7
- package/LexicalComposer.dev.js +7 -0
- package/LexicalComposer.js.flow +23 -0
- package/LexicalComposer.prod.js +3 -2
- package/LexicalComposerContext.js.flow +27 -0
- package/LexicalContentEditable.dev.js +14 -8
- package/LexicalContentEditable.js.flow +35 -0
- package/LexicalContentEditable.prod.js +3 -3
- package/LexicalHashtagPlugin.js.flow +20 -0
- package/LexicalHistoryPlugin.js.flow +34 -0
- package/LexicalHorizontalRuleNode.js.flow +25 -0
- package/LexicalLinkPlugin.js.flow +10 -0
- package/LexicalListPlugin.dev.js +6 -0
- package/LexicalListPlugin.js.flow +10 -0
- package/LexicalListPlugin.prod.js +2 -2
- package/LexicalNestedComposer.js.flow +21 -0
- package/LexicalOnChangePlugin.js.flow +14 -0
- package/LexicalPlainTextPlugin.dev.js +64 -60
- package/LexicalPlainTextPlugin.js.flow +18 -0
- package/LexicalPlainTextPlugin.prod.js +12 -12
- package/LexicalRichTextPlugin.dev.js +65 -61
- package/LexicalRichTextPlugin.js.flow +18 -0
- package/LexicalRichTextPlugin.prod.js +19 -20
- package/LexicalTablePlugin.dev.js +22 -0
- package/LexicalTablePlugin.js.flow +10 -0
- package/LexicalTablePlugin.prod.js +4 -3
- package/LexicalTreeView.js.flow +19 -0
- package/README.md +0 -1
- package/package.json +5 -5
- package/useLexicalDecoratorMap.js.flow +16 -0
- package/useLexicalIsTextContentEmpty.js.flow +15 -0
- package/useLexicalNodeSelection.js.flow +14 -0
- package/withSubscriptions.js.flow +13 -0
- package/LexicalBootstrapPlugin.dev.js +0 -122
- package/LexicalBootstrapPlugin.js +0 -9
- package/LexicalBootstrapPlugin.prod.js +0 -8
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
3
|
+
*
|
|
4
|
+
* This source code is licensed under the MIT license found in the
|
|
5
|
+
* LICENSE file in the root directory of this source tree.
|
|
6
|
+
*
|
|
7
|
+
* @flow strict
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
declare export default function LexicalLinkPlugin(): null;
|
package/LexicalListPlugin.dev.js
CHANGED
|
@@ -43,6 +43,12 @@ function useList(editor) {
|
|
|
43
43
|
} else if (type === 'removeList') {
|
|
44
44
|
list.removeList(editor);
|
|
45
45
|
return true;
|
|
46
|
+
} else if (type === 'insertParagraph') {
|
|
47
|
+
const hasHandledInsertParagraph = list.$handleListInsertParagraph();
|
|
48
|
+
|
|
49
|
+
if (hasHandledInsertParagraph) {
|
|
50
|
+
return true;
|
|
51
|
+
}
|
|
46
52
|
}
|
|
47
53
|
|
|
48
54
|
return false;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
3
|
+
*
|
|
4
|
+
* This source code is licensed under the MIT license found in the
|
|
5
|
+
* LICENSE file in the root directory of this source tree.
|
|
6
|
+
*
|
|
7
|
+
* @flow strict
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
declare export default function ListPlugin(): null;
|
|
@@ -4,5 +4,5 @@
|
|
|
4
4
|
* This source code is licensed under the MIT license found in the
|
|
5
5
|
* LICENSE file in the root directory of this source tree.
|
|
6
6
|
*/
|
|
7
|
-
var b=require("@lexical/react/LexicalComposerContext"),d=require("@lexical/list"),e=require("react");
|
|
8
|
-
module.exports=function(){const [a]=b.useLexicalComposerContext();f(a);return null};
|
|
7
|
+
var b=require("@lexical/react/LexicalComposerContext"),d=require("@lexical/list"),e=require("react");
|
|
8
|
+
function f(a){e.useEffect(()=>a.addListener("command",c=>{if("indentContent"===c){if(d.indentList())return!0}else if("outdentContent"===c){if(d.outdentList())return!0}else{if("insertOrderedList"===c)return d.insertList(a,"ol"),!0;if("insertUnorderedList"===c)return d.insertList(a,"ul"),!0;if("removeList"===c)return d.removeList(a),!0;if("insertParagraph"===c&&d.$handleListInsertParagraph())return!0}return!1},1),[a])}module.exports=function(){const [a]=b.useLexicalComposerContext();f(a);return null};
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
3
|
+
*
|
|
4
|
+
* This source code is licensed under the MIT license found in the
|
|
5
|
+
* LICENSE file in the root directory of this source tree.
|
|
6
|
+
*
|
|
7
|
+
* @flow strict
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
import type {DecoratorEditor, EditorThemeClasses, LexicalNode} from 'lexical';
|
|
11
|
+
|
|
12
|
+
declare export default function LexicalNestedComposer({
|
|
13
|
+
initialConfig?: {
|
|
14
|
+
namespace?: string,
|
|
15
|
+
decoratorEditor: DecoratorEditor,
|
|
16
|
+
nodes?: Array<Class<LexicalNode>>,
|
|
17
|
+
theme?: EditorThemeClasses,
|
|
18
|
+
onError?: (Error) => void,
|
|
19
|
+
},
|
|
20
|
+
children?: React$Node,
|
|
21
|
+
}): React$Node;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
3
|
+
*
|
|
4
|
+
* This source code is licensed under the MIT license found in the
|
|
5
|
+
* LICENSE file in the root directory of this source tree.
|
|
6
|
+
*
|
|
7
|
+
* @flow strict
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
import type {EditorState, LexicalEditor} from 'lexical';
|
|
11
|
+
|
|
12
|
+
declare export default function OnChangePlugin({
|
|
13
|
+
onChange: (editorState: EditorState, editor: LexicalEditor) => void,
|
|
14
|
+
}): null;
|
|
@@ -182,55 +182,6 @@ function $moveCharacter(selection, isHoldingShift, isBackward) {
|
|
|
182
182
|
$moveCaretSelection(selection, isHoldingShift, isBackward ? !isRTL : isRTL, 'character');
|
|
183
183
|
}
|
|
184
184
|
|
|
185
|
-
/**
|
|
186
|
-
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
187
|
-
*
|
|
188
|
-
* This source code is licensed under the MIT license found in the
|
|
189
|
-
* LICENSE file in the root directory of this source tree.
|
|
190
|
-
*
|
|
191
|
-
*
|
|
192
|
-
*/
|
|
193
|
-
function resolveElement(element, isBackward, focusOffset) {
|
|
194
|
-
const parent = element.getParent();
|
|
195
|
-
let offset = focusOffset;
|
|
196
|
-
let block = element;
|
|
197
|
-
|
|
198
|
-
if (parent !== null) {
|
|
199
|
-
if (isBackward && focusOffset === 0) {
|
|
200
|
-
offset = block.getIndexWithinParent();
|
|
201
|
-
block = parent;
|
|
202
|
-
} else if (!isBackward && focusOffset === block.getChildrenSize()) {
|
|
203
|
-
offset = block.getIndexWithinParent() + 1;
|
|
204
|
-
block = parent;
|
|
205
|
-
}
|
|
206
|
-
}
|
|
207
|
-
|
|
208
|
-
return block.getChildAtIndex(isBackward ? offset - 1 : offset);
|
|
209
|
-
}
|
|
210
|
-
|
|
211
|
-
function getPossibleDecoratorNode(focus, isBackward) {
|
|
212
|
-
const focusOffset = focus.offset;
|
|
213
|
-
|
|
214
|
-
if (focus.type === 'element') {
|
|
215
|
-
const block = focus.getNode();
|
|
216
|
-
return resolveElement(block, isBackward, focusOffset);
|
|
217
|
-
} else {
|
|
218
|
-
const focusNode = focus.getNode();
|
|
219
|
-
|
|
220
|
-
if (isBackward && focusOffset === 0 || !isBackward && focusOffset === focusNode.getTextContentSize()) {
|
|
221
|
-
const possibleNode = isBackward ? focusNode.getPreviousSibling() : focusNode.getNextSibling();
|
|
222
|
-
|
|
223
|
-
if (possibleNode === null) {
|
|
224
|
-
return resolveElement(focusNode.getParentOrThrow(), isBackward, focusNode.getIndexWithinParent() + (isBackward ? 0 : 1));
|
|
225
|
-
}
|
|
226
|
-
|
|
227
|
-
return possibleNode;
|
|
228
|
-
}
|
|
229
|
-
}
|
|
230
|
-
|
|
231
|
-
return null;
|
|
232
|
-
}
|
|
233
|
-
|
|
234
185
|
/**
|
|
235
186
|
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
236
187
|
*
|
|
@@ -247,7 +198,7 @@ function $insertDataTransferForPlainText(dataTransfer, selection) {
|
|
|
247
198
|
}
|
|
248
199
|
}
|
|
249
200
|
function $shouldOverrideDefaultCharacterSelection(selection, isBackward) {
|
|
250
|
-
const possibleNode =
|
|
201
|
+
const possibleNode = lexical.$getDecoratorNode(selection.focus, isBackward);
|
|
251
202
|
return lexical.$isDecoratorNode(possibleNode) && !possibleNode.isIsolated();
|
|
252
203
|
}
|
|
253
204
|
function onPasteForPlainText(event, editor) {
|
|
@@ -300,6 +251,62 @@ function onCopyForPlainText(event, editor) {
|
|
|
300
251
|
});
|
|
301
252
|
}
|
|
302
253
|
|
|
254
|
+
/**
|
|
255
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
256
|
+
*
|
|
257
|
+
* This source code is licensed under the MIT license found in the
|
|
258
|
+
* LICENSE file in the root directory of this source tree.
|
|
259
|
+
*
|
|
260
|
+
*
|
|
261
|
+
*/
|
|
262
|
+
// Convoluted logic to make this work with Flow. Order matters.
|
|
263
|
+
const options = {
|
|
264
|
+
tag: 'history-merge'
|
|
265
|
+
};
|
|
266
|
+
const setEditorOptions = options;
|
|
267
|
+
const updateOptions = options;
|
|
268
|
+
function initializeEditor(editor, initialEditorState) {
|
|
269
|
+
if (initialEditorState === null) {
|
|
270
|
+
return;
|
|
271
|
+
} else if (initialEditorState === undefined) {
|
|
272
|
+
editor.update(() => {
|
|
273
|
+
const root = lexical.$getRoot();
|
|
274
|
+
const firstChild = root.getFirstChild();
|
|
275
|
+
|
|
276
|
+
if (firstChild === null) {
|
|
277
|
+
const paragraph = lexical.$createParagraphNode();
|
|
278
|
+
root.append(paragraph);
|
|
279
|
+
const activeElement = document.activeElement;
|
|
280
|
+
|
|
281
|
+
if (lexical.$getSelection() !== null || activeElement !== null && activeElement === editor.getRootElement()) {
|
|
282
|
+
paragraph.select();
|
|
283
|
+
}
|
|
284
|
+
}
|
|
285
|
+
}, updateOptions);
|
|
286
|
+
} else if (initialEditorState !== null) {
|
|
287
|
+
switch (typeof initialEditorState) {
|
|
288
|
+
case 'string':
|
|
289
|
+
{
|
|
290
|
+
const parsedEditorState = editor.parseEditorState(initialEditorState);
|
|
291
|
+
editor.setEditorState(parsedEditorState, setEditorOptions);
|
|
292
|
+
break;
|
|
293
|
+
}
|
|
294
|
+
|
|
295
|
+
case 'object':
|
|
296
|
+
{
|
|
297
|
+
editor.setEditorState(initialEditorState, setEditorOptions);
|
|
298
|
+
break;
|
|
299
|
+
}
|
|
300
|
+
|
|
301
|
+
case 'function':
|
|
302
|
+
{
|
|
303
|
+
editor.update(initialEditorState, updateOptions);
|
|
304
|
+
break;
|
|
305
|
+
}
|
|
306
|
+
}
|
|
307
|
+
}
|
|
308
|
+
}
|
|
309
|
+
|
|
303
310
|
/**
|
|
304
311
|
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
305
312
|
*
|
|
@@ -396,7 +403,7 @@ function useLexicalDragonSupport(editor) {
|
|
|
396
403
|
*
|
|
397
404
|
*
|
|
398
405
|
*/
|
|
399
|
-
function usePlainTextSetup(editor) {
|
|
406
|
+
function usePlainTextSetup(editor, initialEditorState) {
|
|
400
407
|
React.useEffect(() => {
|
|
401
408
|
const removeListener = editor.addListener('command', (type, payload) => {
|
|
402
409
|
const selection = lexical.$getSelection();
|
|
@@ -556,13 +563,9 @@ function usePlainTextSetup(editor) {
|
|
|
556
563
|
|
|
557
564
|
return false;
|
|
558
565
|
}, 0);
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
console.warn('bootstrapEditor command was not handled. Did you forget to add <BootstrapPlugin />?');
|
|
563
|
-
}
|
|
564
|
-
|
|
565
|
-
return removeListener;
|
|
566
|
+
initializeEditor(editor, initialEditorState);
|
|
567
|
+
return removeListener; // We only do this for init
|
|
568
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
566
569
|
}, [editor]);
|
|
567
570
|
useLexicalDragonSupport(editor);
|
|
568
571
|
}
|
|
@@ -577,11 +580,12 @@ function usePlainTextSetup(editor) {
|
|
|
577
580
|
*/
|
|
578
581
|
function PlainTextPlugin({
|
|
579
582
|
contentEditable,
|
|
580
|
-
placeholder
|
|
583
|
+
placeholder,
|
|
584
|
+
initialEditorState
|
|
581
585
|
}) {
|
|
582
586
|
const [editor] = LexicalComposerContext.useLexicalComposerContext();
|
|
583
587
|
const showPlaceholder = useLexicalCanShowPlaceholder(editor);
|
|
584
|
-
usePlainTextSetup(editor);
|
|
588
|
+
usePlainTextSetup(editor, initialEditorState);
|
|
585
589
|
const decorators = useDecorators(editor);
|
|
586
590
|
return /*#__PURE__*/React.createElement(React.Fragment, null, contentEditable, showPlaceholder && placeholder, decorators);
|
|
587
591
|
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
3
|
+
*
|
|
4
|
+
* This source code is licensed under the MIT license found in the
|
|
5
|
+
* LICENSE file in the root directory of this source tree.
|
|
6
|
+
*
|
|
7
|
+
* @flow strict
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
import type {EditorState} from 'lexical';
|
|
11
|
+
|
|
12
|
+
type InitialEditorStateType = null | string | EditorState | (() => void);
|
|
13
|
+
|
|
14
|
+
declare export default function PlainTextPlugin({
|
|
15
|
+
contentEditable: React$Node,
|
|
16
|
+
initialEditorState?: InitialEditorStateType,
|
|
17
|
+
placeholder: React$Node,
|
|
18
|
+
}): React$Node;
|
|
@@ -4,15 +4,15 @@
|
|
|
4
4
|
* This source code is licensed under the MIT license found in the
|
|
5
5
|
* LICENSE file in the root directory of this source tree.
|
|
6
6
|
*/
|
|
7
|
-
var g=require("@lexical/react/LexicalComposerContext"),h=require("react"),t=require("lexical"),u=require("react-dom");function v(a,
|
|
8
|
-
function w(a){if(!v(a,!1))return!1;a=t.$getRoot().getChildren();const
|
|
9
|
-
function z(a){const [e
|
|
10
|
-
function C(a){a=a.anchor.getNode();return"rtl"===(t.$isRootNode(a)?a:a.getParentOrThrow()).getDirection()}function D(a,
|
|
11
|
-
function
|
|
12
|
-
function
|
|
13
|
-
function
|
|
14
|
-
r)q.insertRawText(r),k=n.getNode();t.$isTextNode(k)&&(l=B,m=B+
|
|
15
|
-
function
|
|
16
|
-
!0;case "insertParagraph":return
|
|
17
|
-
a.execCommand("deleteCharacter",!0);case "keyDelete":return
|
|
18
|
-
module.exports=function({contentEditable:a,placeholder:e}){
|
|
7
|
+
var g=require("@lexical/react/LexicalComposerContext"),h=require("react"),t=require("lexical"),u=require("react-dom");function v(a,d=!0){if(a)return!1;a=t.$getRoot().getTextContent();d&&(a=a.trim());return""===a}
|
|
8
|
+
function w(a){if(!v(a,!1))return!1;a=t.$getRoot().getChildren();const d=a.length;if(1<d)return!1;for(let c=0;c<d;c++){var e=a[c];if(t.$isElementNode(e)){if("paragraph"!==e.__type||0!==e.__indent)return!1;e=e.getChildren();const b=e.length;for(let f=0;f<b;f++)if(!t.$isTextNode(e[c]))return!1}}return!0}function x(a){return()=>w(a)}var y="undefined"!==typeof window&&"undefined"!==typeof window.document&&"undefined"!==typeof window.document.createElement?h.useLayoutEffect:h.useEffect;
|
|
9
|
+
function z(a){const [d,e]=h.useState(a.getEditorState().read(x(a.isComposing())));y(()=>a.addListener("update",({editorState:c})=>{const b=a.isComposing();c=c.read(x(b));e(c)}),[a]);return d}function A(a){const [d,e]=h.useState(()=>a.getDecorators());y(()=>a.addListener("decorator",c=>{u.flushSync(()=>{e(c)})}),[a]);return h.useMemo(()=>{const c=[],b=Object.keys(d);for(let p=0;p<b.length;p++){var f=b[p];const r=d[f];f=a.getElementByKey(f);null!==f&&c.push(u.createPortal(r,f))}return c},[d,a])}
|
|
10
|
+
function C(a){a=a.anchor.getNode();return"rtl"===(t.$isRootNode(a)?a:a.getParentOrThrow()).getDirection()}function D(a,d){a=a.getData("text/plain");null!=a&&d.insertRawText(a)}function E(a,d){a=t.$getDecoratorNode(a.focus,d);return t.$isDecoratorNode(a)&&!a.isIsolated()}function F(a,d){a.preventDefault();d.update(()=>{const e=t.$getSelection(),c=a.clipboardData;null!=c&&t.$isRangeSelection(e)&&D(c,e)})}
|
|
11
|
+
function G(a,d){H(a,d);d.update(()=>{const e=t.$getSelection();t.$isRangeSelection(e)&&e.removeText()})}function H(a,d){a.preventDefault();d.update(()=>{const e=a.clipboardData,c=t.$getSelection();if(null!==c&&null!=e){var b=window.getSelection();if(!b.isCollapsed){var f=b.getRangeAt(0);f&&(b=document.createElement("div"),f=f.cloneContents(),b.appendChild(f),e.setData("text/html",b.innerHTML));e.setData("text/plain",c.getTextContent())}}})}const I={tag:"history-merge"};
|
|
12
|
+
function J(a,d){if(null!==d)if(void 0===d)a.update(()=>{var e=t.$getRoot();if(null===e.getFirstChild()){const c=t.$createParagraphNode();e.append(c);e=document.activeElement;(null!==t.$getSelection()||null!==e&&e===a.getRootElement())&&c.select()}},I);else if(null!==d)switch(typeof d){case "string":d=a.parseEditorState(d);a.setEditorState(d,I);break;case "object":a.setEditorState(d,I);break;case "function":a.update(d,I)}}
|
|
13
|
+
function K(a){h.useEffect(()=>{const d=e=>{var c=a.getRootElement();if(document.activeElement===c&&(c=e.data,"string"===typeof c)){try{var b=JSON.parse(c)}catch(f){return}if(b&&"nuanria_messaging"===b.protocol&&"request"===b.type&&(b=b.payload)&&"makeChanges"===b.functionId&&(b=b.args)){const [f,p,r,B,L]=b;a.update(()=>{const q=t.$getSelection();if(t.$isRangeSelection(q)){var n=q.anchor;let k=n.getNode(),l=0,m=0;t.$isTextNode(k)&&0<=f&&0<=p&&(l=f,m=f+p,q.setTextNodeRange(k,l,k,m));if(l!==m||""!==
|
|
14
|
+
r)q.insertRawText(r),k=n.getNode();t.$isTextNode(k)&&(l=B,m=B+L,n=k.getTextContentSize(),l=l>n?n:l,m=m>n?n:m,q.setTextNodeRange(k,l,k,m));e.stopImmediatePropagation()}})}}};window.addEventListener("message",d,!0);return()=>{window.removeEventListener("message",d,!0)}},[a])}
|
|
15
|
+
function M(a,d){h.useEffect(()=>{const e=a.addListener("command",(c,b)=>{const f=t.$getSelection();if(!t.$isRangeSelection(f))return!1;switch(c){case "deleteCharacter":return f.deleteCharacter(b),!0;case "deleteWord":return f.deleteWord(b),!0;case "deleteLine":return f.deleteLine(b),!0;case "insertText":return"string"===typeof b?f.insertText(b):(c=b.dataTransfer,null!=c?D(c,f):(b=b.data)&&f.insertText(b)),!0;case "removeText":return f.removeText(),!0;case "insertLineBreak":return f.insertLineBreak(b),
|
|
16
|
+
!0;case "insertParagraph":return f.insertLineBreak(),!0;case "indentContent":case "outdentContent":case "insertHorizontalRule":case "insertImage":case "insertTable":case "formatElement":case "formatText":return!0;case "keyArrowLeft":c=b.shiftKey;if(E(f,!0))return b.preventDefault(),b=c,c=C(f),f.modify(b?"extend":"move",!c,"character"),!0;break;case "keyArrowRight":c=b.shiftKey;if(E(f,!1))return b.preventDefault(),b=c,c=C(f),f.modify(b?"extend":"move",c,"character"),!0;break;case "keyBackspace":return b.preventDefault(),
|
|
17
|
+
a.execCommand("deleteCharacter",!0);case "keyDelete":return b.preventDefault(),a.execCommand("deleteCharacter",!1);case "keyEnter":return b.preventDefault(),a.execCommand("insertLineBreak");case "copy":return H(b,a),!0;case "cut":return G(b,a),!0;case "paste":return F(b,a),!0;case "drop":case "dragstart":return b.preventDefault(),!0}return!1},0);J(a,d);return e},[a]);K(a)}
|
|
18
|
+
module.exports=function({contentEditable:a,placeholder:d,initialEditorState:e}){const [c]=g.useLexicalComposerContext(),b=z(c);M(c,e);e=A(c);return h.createElement(h.Fragment,null,a,b&&d,e)};
|
|
@@ -364,55 +364,6 @@ function $moveCharacter(selection, isHoldingShift, isBackward) {
|
|
|
364
364
|
$moveCaretSelection(selection, isHoldingShift, isBackward ? !isRTL : isRTL, 'character');
|
|
365
365
|
}
|
|
366
366
|
|
|
367
|
-
/**
|
|
368
|
-
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
369
|
-
*
|
|
370
|
-
* This source code is licensed under the MIT license found in the
|
|
371
|
-
* LICENSE file in the root directory of this source tree.
|
|
372
|
-
*
|
|
373
|
-
*
|
|
374
|
-
*/
|
|
375
|
-
function resolveElement(element, isBackward, focusOffset) {
|
|
376
|
-
const parent = element.getParent();
|
|
377
|
-
let offset = focusOffset;
|
|
378
|
-
let block = element;
|
|
379
|
-
|
|
380
|
-
if (parent !== null) {
|
|
381
|
-
if (isBackward && focusOffset === 0) {
|
|
382
|
-
offset = block.getIndexWithinParent();
|
|
383
|
-
block = parent;
|
|
384
|
-
} else if (!isBackward && focusOffset === block.getChildrenSize()) {
|
|
385
|
-
offset = block.getIndexWithinParent() + 1;
|
|
386
|
-
block = parent;
|
|
387
|
-
}
|
|
388
|
-
}
|
|
389
|
-
|
|
390
|
-
return block.getChildAtIndex(isBackward ? offset - 1 : offset);
|
|
391
|
-
}
|
|
392
|
-
|
|
393
|
-
function getPossibleDecoratorNode(focus, isBackward) {
|
|
394
|
-
const focusOffset = focus.offset;
|
|
395
|
-
|
|
396
|
-
if (focus.type === 'element') {
|
|
397
|
-
const block = focus.getNode();
|
|
398
|
-
return resolveElement(block, isBackward, focusOffset);
|
|
399
|
-
} else {
|
|
400
|
-
const focusNode = focus.getNode();
|
|
401
|
-
|
|
402
|
-
if (isBackward && focusOffset === 0 || !isBackward && focusOffset === focusNode.getTextContentSize()) {
|
|
403
|
-
const possibleNode = isBackward ? focusNode.getPreviousSibling() : focusNode.getNextSibling();
|
|
404
|
-
|
|
405
|
-
if (possibleNode === null) {
|
|
406
|
-
return resolveElement(focusNode.getParentOrThrow(), isBackward, focusNode.getIndexWithinParent() + (isBackward ? 0 : 1));
|
|
407
|
-
}
|
|
408
|
-
|
|
409
|
-
return possibleNode;
|
|
410
|
-
}
|
|
411
|
-
}
|
|
412
|
-
|
|
413
|
-
return null;
|
|
414
|
-
}
|
|
415
|
-
|
|
416
367
|
/**
|
|
417
368
|
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
418
369
|
*
|
|
@@ -598,7 +549,7 @@ function $insertDataTransferForPlainText(dataTransfer, selection) {
|
|
|
598
549
|
}
|
|
599
550
|
}
|
|
600
551
|
function $shouldOverrideDefaultCharacterSelection(selection, isBackward) {
|
|
601
|
-
const possibleNode =
|
|
552
|
+
const possibleNode = lexical.$getDecoratorNode(selection.focus, isBackward);
|
|
602
553
|
return lexical.$isDecoratorNode(possibleNode) && !possibleNode.isIsolated();
|
|
603
554
|
}
|
|
604
555
|
function onPasteForRichText(event, editor) {
|
|
@@ -656,6 +607,62 @@ function onCopyForRichText(event, editor) {
|
|
|
656
607
|
});
|
|
657
608
|
}
|
|
658
609
|
|
|
610
|
+
/**
|
|
611
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
612
|
+
*
|
|
613
|
+
* This source code is licensed under the MIT license found in the
|
|
614
|
+
* LICENSE file in the root directory of this source tree.
|
|
615
|
+
*
|
|
616
|
+
*
|
|
617
|
+
*/
|
|
618
|
+
// Convoluted logic to make this work with Flow. Order matters.
|
|
619
|
+
const options = {
|
|
620
|
+
tag: 'history-merge'
|
|
621
|
+
};
|
|
622
|
+
const setEditorOptions = options;
|
|
623
|
+
const updateOptions = options;
|
|
624
|
+
function initializeEditor(editor, initialEditorState) {
|
|
625
|
+
if (initialEditorState === null) {
|
|
626
|
+
return;
|
|
627
|
+
} else if (initialEditorState === undefined) {
|
|
628
|
+
editor.update(() => {
|
|
629
|
+
const root = lexical.$getRoot();
|
|
630
|
+
const firstChild = root.getFirstChild();
|
|
631
|
+
|
|
632
|
+
if (firstChild === null) {
|
|
633
|
+
const paragraph = lexical.$createParagraphNode();
|
|
634
|
+
root.append(paragraph);
|
|
635
|
+
const activeElement = document.activeElement;
|
|
636
|
+
|
|
637
|
+
if (lexical.$getSelection() !== null || activeElement !== null && activeElement === editor.getRootElement()) {
|
|
638
|
+
paragraph.select();
|
|
639
|
+
}
|
|
640
|
+
}
|
|
641
|
+
}, updateOptions);
|
|
642
|
+
} else if (initialEditorState !== null) {
|
|
643
|
+
switch (typeof initialEditorState) {
|
|
644
|
+
case 'string':
|
|
645
|
+
{
|
|
646
|
+
const parsedEditorState = editor.parseEditorState(initialEditorState);
|
|
647
|
+
editor.setEditorState(parsedEditorState, setEditorOptions);
|
|
648
|
+
break;
|
|
649
|
+
}
|
|
650
|
+
|
|
651
|
+
case 'object':
|
|
652
|
+
{
|
|
653
|
+
editor.setEditorState(initialEditorState, setEditorOptions);
|
|
654
|
+
break;
|
|
655
|
+
}
|
|
656
|
+
|
|
657
|
+
case 'function':
|
|
658
|
+
{
|
|
659
|
+
editor.update(initialEditorState, updateOptions);
|
|
660
|
+
break;
|
|
661
|
+
}
|
|
662
|
+
}
|
|
663
|
+
}
|
|
664
|
+
}
|
|
665
|
+
|
|
659
666
|
/**
|
|
660
667
|
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
661
668
|
*
|
|
@@ -752,8 +759,8 @@ function useLexicalDragonSupport(editor) {
|
|
|
752
759
|
*
|
|
753
760
|
*
|
|
754
761
|
*/
|
|
755
|
-
function useRichTextSetup(editor) {
|
|
756
|
-
React.
|
|
762
|
+
function useRichTextSetup(editor, initialEditorState) {
|
|
763
|
+
React.useLayoutEffect(() => {
|
|
757
764
|
const removeListener = editor.addListener('command', (type, payload) => {
|
|
758
765
|
const selection = lexical.$getSelection();
|
|
759
766
|
|
|
@@ -992,13 +999,9 @@ function useRichTextSetup(editor) {
|
|
|
992
999
|
|
|
993
1000
|
return false;
|
|
994
1001
|
}, 0);
|
|
995
|
-
|
|
996
|
-
|
|
997
|
-
|
|
998
|
-
console.warn('bootstrapEditor command was not handled. Did you forget to add <BootstrapPlugin />?');
|
|
999
|
-
}
|
|
1000
|
-
|
|
1001
|
-
return removeListener;
|
|
1002
|
+
initializeEditor(editor, initialEditorState);
|
|
1003
|
+
return removeListener; // We only do this for init
|
|
1004
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
1002
1005
|
}, [editor]);
|
|
1003
1006
|
useLexicalDragonSupport(editor);
|
|
1004
1007
|
}
|
|
@@ -1013,11 +1016,12 @@ function useRichTextSetup(editor) {
|
|
|
1013
1016
|
*/
|
|
1014
1017
|
function RichTextPlugin({
|
|
1015
1018
|
contentEditable,
|
|
1016
|
-
placeholder
|
|
1019
|
+
placeholder,
|
|
1020
|
+
initialEditorState
|
|
1017
1021
|
}) {
|
|
1018
1022
|
const [editor] = LexicalComposerContext.useLexicalComposerContext();
|
|
1019
1023
|
const showPlaceholder = useLexicalCanShowPlaceholder(editor);
|
|
1020
|
-
useRichTextSetup(editor);
|
|
1024
|
+
useRichTextSetup(editor, initialEditorState);
|
|
1021
1025
|
const decorators = useDecorators(editor);
|
|
1022
1026
|
return /*#__PURE__*/React.createElement(React.Fragment, null, contentEditable, showPlaceholder && placeholder, decorators);
|
|
1023
1027
|
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
3
|
+
*
|
|
4
|
+
* This source code is licensed under the MIT license found in the
|
|
5
|
+
* LICENSE file in the root directory of this source tree.
|
|
6
|
+
*
|
|
7
|
+
* @flow strict
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
import type {EditorState} from 'lexical';
|
|
11
|
+
|
|
12
|
+
type InitialEditorStateType = null | string | EditorState | (() => void);
|
|
13
|
+
|
|
14
|
+
declare export default function RichTextPlugin({
|
|
15
|
+
contentEditable: React$Node,
|
|
16
|
+
initialEditorState?: InitialEditorStateType,
|
|
17
|
+
placeholder: React$Node,
|
|
18
|
+
}): React$Node;
|
|
@@ -5,24 +5,23 @@
|
|
|
5
5
|
* LICENSE file in the root directory of this source tree.
|
|
6
6
|
*/
|
|
7
7
|
var g=require("@lexical/react/LexicalComposerContext"),u=require("react"),y=require("lexical"),z=require("react-dom");function A(a,e=!0){if(a)return!1;a=y.$getRoot().getTextContent();e&&(a=a.trim());return""===a}
|
|
8
|
-
function B(a){if(!A(a,!1))return!1;a=y.$getRoot().getChildren();const e=a.length;if(1<e)return!1;for(let
|
|
9
|
-
function E(a){const [e,
|
|
8
|
+
function B(a){if(!A(a,!1))return!1;a=y.$getRoot().getChildren();const e=a.length;if(1<e)return!1;for(let c=0;c<e;c++){var f=a[c];if(y.$isElementNode(f)){if("paragraph"!==f.__type||0!==f.__indent)return!1;f=f.getChildren();const d=f.length;for(let b=0;b<d;b++)if(!y.$isTextNode(f[c]))return!1}}return!0}function C(a){return()=>B(a)}var D="undefined"!==typeof window&&"undefined"!==typeof window.document&&"undefined"!==typeof window.document.createElement?u.useLayoutEffect:u.useEffect;
|
|
9
|
+
function E(a){const [e,f]=u.useState(a.getEditorState().read(C(a.isComposing())));D(()=>a.addListener("update",({editorState:c})=>{const d=a.isComposing();c=c.read(C(d));f(c)}),[a]);return e}function F(a){const [e,f]=u.useState(()=>a.getDecorators());D(()=>a.addListener("decorator",c=>{z.flushSync(()=>{f(c)})}),[a]);return u.useMemo(()=>{const c=[],d=Object.keys(e);for(let k=0;k<d.length;k++){var b=d[k];const h=e[b];b=a.getElementByKey(b);null!==b&&c.push(z.createPortal(h,b))}return c},[e,a])}
|
|
10
10
|
function G(a){a=a.getLatest();const e=a.constructor.clone(a);e.__parent=a.__parent;y.$isElementNode(a)&&y.$isElementNode(e)?(e.__children=Array.from(a.__children),e.__format=a.__format,e.__indent=a.__indent,e.__dir=a.__dir):y.$isTextNode(a)&&y.$isTextNode(e)?(e.__format=a.__format,e.__style=a.__style,e.__mode=a.__mode,e.__detail=a.__detail):y.$isDecoratorNode(a)&&y.$isDecoratorNode(e)&&(e.__state=a.__state);return e}
|
|
11
|
-
function H(a,e,
|
|
12
|
-
|
|
13
|
-
function K(a,e){
|
|
14
|
-
function L(a,e,
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
function
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
b
|
|
27
|
-
|
|
28
|
-
!0;case "copy":return Q(b,a),!0;case "cut":return P(b,a),!0;case "paste":return O(b,a),!0;case "drop":case "dragstart":return b.preventDefault(),!0}return!1},0);a.execCommand("bootstrapEditor");return e},[a]);S(a)}module.exports=function({contentEditable:a,placeholder:e}){var [d]=g.useLexicalComposerContext();const b=E(d);T(d);d=F(d);return u.createElement(u.Fragment,null,a,b&&e,d)};
|
|
11
|
+
function H(a,e,f,c,d){for(var b=e;null!==a;){for(e=a.getParent();null!==e&&e.excludeFromCopy();)e=e.getParent();if(null===e)break;if(!y.$isElementNode(a)||!a.excludeFromCopy()){const k=a.getKey();let h=d.get(k);const l=void 0===h;l&&(h=G(a),d.set(k,h));!y.$isTextNode(h)||h.isSegmented()||h.isToken()?y.$isElementNode(h)&&(h.__children=h.__children.slice(f?b:0,f?void 0:b+1)):h.__text=h.__text.slice(f?b:0,f?void 0:b);if(y.$isRootNode(e)){l&&c.push(k);break}}b=d.get(e.getKey());b=y.$isElementNode(b)?
|
|
12
|
+
b.__children.indexOf(a.getKey()):a.getIndexWithinParent();a=e}}function I(a){a=a.anchor.getNode();return"rtl"===(y.$isRootNode(a)?a:a.getParentOrThrow()).getDirection()}function J(a,e){const {nodeName:f}=a;e=e._htmlConversions.get(f.toLowerCase());let c=null;void 0!==e&&e.forEach(d=>{d=d(a);null!==d&&(null===c||c.priority<d.priority)&&(c=d)});return null!==c?c.conversion:null}
|
|
13
|
+
function K(a,e,f=new Map){let c=[],d=null;var b=J(a,e),k=b?b(a):null;b=null;if(null!==k){b=k.after;d=k.node;if(null!==d){c.push(d);var h=Array.from(f.values());for(let l=0;l<h.length;l++)h[l](d)}null!=k.forChild&&f.set(a.nodeName,k.forChild)}a=a.childNodes;k=[];for(h=0;h<a.length;h++)k.push(...K(a[h],e,f));null!=b&&(k=b(k));null==d?c=c.concat(k):y.$isElementNode(d)&&d.append(...k);return c}
|
|
14
|
+
function L(a,e,f){var c=a.getData("application/x-lexical-editor");if(c){var d=f._config.namespace;try{const l=JSON.parse(c);if(l.namespace===d){const {range:t,nodeMap:m}=l.state;var b=new Map(m);c=[];for(d=0;d<t.length;d++){var k=b.get(t[d]);if(void 0!==k){var h=y.$createNodeFromParse(k,b);c.push(h)}}e.insertNodes(c);return}}catch(l){}}if(b=a.getData("text/html")){b=(new DOMParser).parseFromString(b,"text/html");a=[];b=b.body?Array.from(b.body.childNodes):[];k=b.length;for(h=0;h<k;h++)c=K(b[h],f),
|
|
15
|
+
null!==c&&(a=a.concat(c));f=a;a=[];b=null;for(k=0;k<f.length;k++)h=f[k],!y.$isElementNode(h)||h.isInline()?(null===b&&(b=y.$createParagraphNode(),a.push(b)),null!==b&&b.append(h)):(a.push(h),b=null);e.insertNodes(a)}else f=a.getData("text/plain"),null!=f&&e.insertRawText(f)}function M(a,e){a=y.$getDecoratorNode(a.focus,e);return y.$isDecoratorNode(a)&&!a.isIsolated()}
|
|
16
|
+
function N(a,e){a.preventDefault();e.update(()=>{const f=y.$getSelection(),c=a.clipboardData;null!=c&&y.$isRangeSelection(f)&&L(c,f,e)})}function O(a,e){P(a,e);e.update(()=>{const f=y.$getSelection();y.$isRangeSelection(f)&&f.removeText()})}
|
|
17
|
+
function P(a,e){a.preventDefault();e.update(()=>{const f=a.clipboardData;var c=y.$getSelection();if(null!==c&&null!=f){var d=window.getSelection();if(!d.isCollapsed){var b=d.getRangeAt(0);b&&(d=document.createElement("div"),b=b.cloneContents(),d.appendChild(b),f.setData("text/html",d.innerHTML));f.setData("text/plain",c.getTextContent());d=e._config.namespace;b=f.setData;var k=JSON,h=k.stringify;{if(!y.$isRangeSelection(c))throw Error("Minified Lexical error #68; see codes.json for the full message or use the non-minified dev environment for full errors and additional helpful warnings.");
|
|
18
|
+
var l=c.anchor,t=c.focus;var m=l.getCharacterOffset();const x=t.getCharacterOffset();var n=l.getNode(),q=t.getNode(),p=n.getParentOrThrow();if(n===q&&y.$isTextNode(n)&&(p.canBeEmpty()||1<p.getChildrenSize()))c=G(n),n=x>m,c.__text=c.__text.slice(n?m:x,n?x:m),m=c.getKey(),m={nodeMap:[[m,c]],range:[m]};else if(c=c.getNodes(),0===c.length)m={nodeMap:[],range:[]};else{n=c.length;q=c[0];p=q.getParent();if(null!==p&&(!p.canBeEmpty()||y.$isRootNode(p))){var r=p.__children;if(r.length===n){var v=!0;for(var w=
|
|
19
|
+
0;w<r.length;w++)if(r[w]!==c[w].__key){v=!1;break}v&&(n++,c.push(p))}}p=c[n-1];l=l.isBefore(t);t=new Map;r=[];H(q,l?m:x,!0,r,t);for(q=0;q<n;q++)if(v=c[q],w=v.getKey(),!(t.has(w)||y.$isElementNode(v)&&v.excludeFromCopy())){const R=G(v);y.$isRootNode(v.getParent())&&r.push(v.getKey());t.set(w,R)}H(p,l?x:m,!1,r,t);m={nodeMap:Array.from(t.entries()),range:r}}}b.call(f,"application/x-lexical-editor",h.call(k,{namespace:d,state:m}))}}})}const Q={tag:"history-merge"};
|
|
20
|
+
function S(a,e){if(null!==e)if(void 0===e)a.update(()=>{var f=y.$getRoot();if(null===f.getFirstChild()){const c=y.$createParagraphNode();f.append(c);f=document.activeElement;(null!==y.$getSelection()||null!==f&&f===a.getRootElement())&&c.select()}},Q);else if(null!==e)switch(typeof e){case "string":e=a.parseEditorState(e);a.setEditorState(e,Q);break;case "object":a.setEditorState(e,Q);break;case "function":a.update(e,Q)}}
|
|
21
|
+
function T(a){u.useEffect(()=>{const e=f=>{var c=a.getRootElement();if(document.activeElement===c&&(c=f.data,"string"===typeof c)){try{var d=JSON.parse(c)}catch(b){return}if(d&&"nuanria_messaging"===d.protocol&&"request"===d.type&&(d=d.payload)&&"makeChanges"===d.functionId&&(d=d.args)){const [b,k,h,l,t]=d;a.update(()=>{const m=y.$getSelection();if(y.$isRangeSelection(m)){var n=m.anchor;let q=n.getNode(),p=0,r=0;y.$isTextNode(q)&&0<=b&&0<=k&&(p=b,r=b+k,m.setTextNodeRange(q,p,q,r));if(p!==r||""!==
|
|
22
|
+
h)m.insertRawText(h),q=n.getNode();y.$isTextNode(q)&&(p=l,r=l+t,n=q.getTextContentSize(),p=p>n?n:p,r=r>n?n:r,m.setTextNodeRange(q,p,q,r));f.stopImmediatePropagation()}})}}};window.addEventListener("message",e,!0);return()=>{window.removeEventListener("message",e,!0)}},[a])}
|
|
23
|
+
function U(a,e){u.useLayoutEffect(()=>{const f=a.addListener("command",(c,d)=>{var b=y.$getSelection();if("click"===c&&y.$isNodeSelection(b))return b.clear(),!0;if(!y.$isRangeSelection(b))return!1;switch(c){case "deleteCharacter":return b.deleteCharacter(d),!0;case "deleteWord":return b.deleteWord(d),!0;case "deleteLine":return b.deleteLine(d),!0;case "insertText":return"string"===typeof d?b.insertText(d):(c=d.dataTransfer,null!=c?L(c,b,a):(d=d.data)&&b.insertText(d)),!0;case "removeText":return b.removeText(),
|
|
24
|
+
!0;case "formatText":return b.formatText(d),!0;case "formatElement":return b=b.anchor.getNode(),(y.$isElementNode(b)?b:b.getParentOrThrow()).setFormat(d),!0;case "insertLineBreak":return b.insertLineBreak(d),!0;case "insertParagraph":return b.insertParagraph(),!0;case "indentContent":return b=b.anchor,b="element"===b.type?b.getNode():b.getNode().getParentOrThrow(),b.canInsertTab()?a.execCommand("insertText","\t"):10!==b.getIndent()&&b.setIndent(b.getIndent()+1),!0;case "outdentContent":return b=b.anchor,
|
|
25
|
+
d=b.getNode(),c="element"===b.type?b.getNode():b.getNode().getParentOrThrow(),c.canInsertTab()?"\t"===d.getTextContent()[b.offset-1]&&a.execCommand("deleteCharacter",!0):0!==c.getIndent()&&c.setIndent(c.getIndent()-1),!0;case "keyArrowLeft":c=d.shiftKey;if(M(b,!0))return d.preventDefault(),d=c,c=I(b),b.modify(d?"extend":"move",!c,"character"),!0;break;case "keyArrowRight":c=d.shiftKey;if(M(b,!1))return d.preventDefault(),d=c,c=I(b),b.modify(d?"extend":"move",c,"character"),!0;break;case "keyBackspace":return d.preventDefault(),
|
|
26
|
+
{anchor:d}=b,b.isCollapsed()&&0===d.offset&&0<("element"===d.type?d.getNode():d.getNode().getParentOrThrow()).getIndent()?a.execCommand("outdentContent"):a.execCommand("deleteCharacter",!0);case "keyDelete":return d.preventDefault(),a.execCommand("deleteCharacter",!1);case "keyEnter":return d.preventDefault(),d.shiftKey?a.execCommand("insertLineBreak"):a.execCommand("insertParagraph");case "keyTab":return d.preventDefault(),a.execCommand(d.shiftKey?"outdentContent":"indentContent");case "keyEscape":return a.blur(),
|
|
27
|
+
!0;case "copy":return P(d,a),!0;case "cut":return O(d,a),!0;case "paste":return N(d,a),!0;case "drop":case "dragstart":return d.preventDefault(),!0}return!1},0);S(a,e);return f},[a]);T(a)}module.exports=function({contentEditable:a,placeholder:e,initialEditorState:f}){const [c]=g.useLexicalComposerContext(),d=E(c);U(c,f);f=F(c);return u.createElement(u.Fragment,null,a,d&&e,f)};
|