@lexical/react 0.1.8 → 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_useLexical.dev.js +3 -38
- package/DEPRECATED_useLexical.prod.js +1 -2
- package/DEPRECATED_useLexicalAutoFormatter.dev.js +202 -74
- package/DEPRECATED_useLexicalAutoFormatter.prod.js +21 -16
- package/DEPRECATED_useLexicalCanShowPlaceholder.prod.js +1 -1
- package/DEPRECATED_useLexicalCharacterLimit.dev.js +23 -21
- package/DEPRECATED_useLexicalCharacterLimit.prod.js +8 -8
- package/DEPRECATED_useLexicalDecorators.prod.js +1 -1
- package/DEPRECATED_useLexicalEditor.dev.js +1 -25
- package/DEPRECATED_useLexicalEditor.prod.js +1 -1
- package/DEPRECATED_useLexicalEditorEvents.prod.js +1 -1
- package/DEPRECATED_useLexicalHistory.dev.js +18 -15
- package/DEPRECATED_useLexicalHistory.prod.js +7 -7
- package/DEPRECATED_useLexicalList.dev.js +6 -0
- package/DEPRECATED_useLexicalList.prod.js +1 -1
- package/DEPRECATED_useLexicalPlainText.dev.js +79 -70
- package/DEPRECATED_useLexicalPlainText.prod.js +15 -16
- package/DEPRECATED_useLexicalRichText.dev.js +124 -250
- package/DEPRECATED_useLexicalRichText.prod.js +25 -29
- package/LexicalAutoFormatterPlugin.dev.js +202 -74
- package/LexicalAutoFormatterPlugin.js.flow +10 -0
- package/LexicalAutoFormatterPlugin.prod.js +21 -17
- package/LexicalAutoLinkPlugin.js.flow +23 -0
- package/LexicalAutoLinkPlugin.prod.js +4 -4
- package/LexicalCharacterLimitPlugin.dev.js +23 -21
- 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 +31 -36
- package/LexicalCollaborationPlugin.js.flow +55 -0
- package/LexicalCollaborationPlugin.prod.js +7 -8
- package/LexicalComposer.dev.js +8 -6
- package/LexicalComposer.js.flow +23 -0
- package/LexicalComposer.prod.js +3 -3
- package/LexicalComposerContext.js.flow +27 -0
- package/LexicalComposerContext.prod.js +1 -1
- 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/LexicalHashtagPlugin.prod.js +1 -1
- package/LexicalHistoryPlugin.dev.js +18 -15
- package/LexicalHistoryPlugin.js.flow +34 -0
- package/LexicalHistoryPlugin.prod.js +7 -7
- package/LexicalHorizontalRuleNode.dev.js +66 -0
- package/LexicalHorizontalRuleNode.js +9 -0
- package/LexicalHorizontalRuleNode.js.flow +25 -0
- package/LexicalHorizontalRuleNode.prod.js +8 -0
- package/LexicalLinkPlugin.dev.js +0 -1
- package/LexicalLinkPlugin.js.flow +10 -0
- package/LexicalLinkPlugin.prod.js +3 -3
- 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/LexicalNestedComposer.prod.js +1 -1
- package/LexicalOnChangePlugin.js.flow +14 -0
- package/LexicalOnChangePlugin.prod.js +1 -1
- package/LexicalPlainTextPlugin.dev.js +72 -44
- package/LexicalPlainTextPlugin.js.flow +18 -0
- package/LexicalPlainTextPlugin.prod.js +12 -11
- package/LexicalRichTextPlugin.dev.js +115 -222
- package/LexicalRichTextPlugin.js.flow +18 -0
- package/LexicalRichTextPlugin.prod.js +21 -25
- package/LexicalTablePlugin.dev.js +43 -39
- package/LexicalTablePlugin.js.flow +10 -0
- package/LexicalTablePlugin.prod.js +4 -3
- package/LexicalTreeView.dev.js +10 -2
- package/LexicalTreeView.js.flow +19 -0
- package/LexicalTreeView.prod.js +9 -8
- package/README.md +0 -1
- package/package.json +5 -4
- package/useLexicalDecoratorMap.js.flow +16 -0
- package/useLexicalDecoratorMap.prod.js +1 -1
- package/useLexicalIsTextContentEmpty.js.flow +15 -0
- package/useLexicalIsTextContentEmpty.prod.js +1 -1
- package/useLexicalNodeSelection.dev.js +70 -0
- package/useLexicalNodeSelection.js +9 -0
- package/useLexicalNodeSelection.js.flow +14 -0
- package/useLexicalNodeSelection.prod.js +8 -0
- package/withSubscriptions.js.flow +13 -0
- package/withSubscriptions.prod.js +1 -1
- package/LexicalBootstrapPlugin.dev.js +0 -124
- package/LexicalBootstrapPlugin.js +0 -9
- package/LexicalBootstrapPlugin.prod.js +0 -8
- package/LexicalHorizontalRulePlugin.dev.js +0 -51
- package/LexicalHorizontalRulePlugin.js +0 -9
- package/LexicalHorizontalRulePlugin.prod.js +0 -7
|
@@ -4,4 +4,4 @@
|
|
|
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
|
-
|
|
7
|
+
var c=require("@lexical/react/LexicalComposerContext"),d=require("react"),e="undefined"!==typeof window&&"undefined"!==typeof window.document&&"undefined"!==typeof window.document.createElement?d.useLayoutEffect:d.useEffect;module.exports=function({onChange:a}){const [b]=c.useLexicalComposerContext();e(()=>{if(a)return b.addListener("update",({editorState:f})=>{a(f,b)})},[b,a]);return null};
|
|
@@ -174,7 +174,7 @@ function $moveCaretSelection(selection, isHoldingShift, isBackward, granularity)
|
|
|
174
174
|
}
|
|
175
175
|
function $isParentElementRTL(selection) {
|
|
176
176
|
const anchorNode = selection.anchor.getNode();
|
|
177
|
-
const parent = anchorNode.getParentOrThrow();
|
|
177
|
+
const parent = lexical.$isRootNode(anchorNode) ? anchorNode : anchorNode.getParentOrThrow();
|
|
178
178
|
return parent.getDirection() === 'rtl';
|
|
179
179
|
}
|
|
180
180
|
function $moveCharacter(selection, isHoldingShift, isBackward) {
|
|
@@ -182,31 +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 getPossibleDecoratorNode(focus, isBackward) {
|
|
194
|
-
const focusOffset = focus.offset;
|
|
195
|
-
|
|
196
|
-
if (focus.type === 'element') {
|
|
197
|
-
const block = focus.getNode();
|
|
198
|
-
return block.getChildAtIndex(isBackward ? focusOffset - 1 : focusOffset);
|
|
199
|
-
} else {
|
|
200
|
-
const focusNode = focus.getNode();
|
|
201
|
-
|
|
202
|
-
if (isBackward && focusOffset === 0 || !isBackward && focusOffset === focusNode.getTextContentSize()) {
|
|
203
|
-
return isBackward ? focusNode.getPreviousSibling() : focusNode.getNextSibling();
|
|
204
|
-
}
|
|
205
|
-
}
|
|
206
|
-
|
|
207
|
-
return null;
|
|
208
|
-
}
|
|
209
|
-
|
|
210
185
|
/**
|
|
211
186
|
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
212
187
|
*
|
|
@@ -223,17 +198,16 @@ function $insertDataTransferForPlainText(dataTransfer, selection) {
|
|
|
223
198
|
}
|
|
224
199
|
}
|
|
225
200
|
function $shouldOverrideDefaultCharacterSelection(selection, isBackward) {
|
|
226
|
-
const
|
|
227
|
-
return lexical.$isDecoratorNode(
|
|
201
|
+
const possibleNode = lexical.$getDecoratorNode(selection.focus, isBackward);
|
|
202
|
+
return lexical.$isDecoratorNode(possibleNode) && !possibleNode.isIsolated();
|
|
228
203
|
}
|
|
229
204
|
function onPasteForPlainText(event, editor) {
|
|
230
205
|
event.preventDefault();
|
|
231
206
|
editor.update(() => {
|
|
232
|
-
lexical.$log('onPasteForPlainText');
|
|
233
207
|
const selection = lexical.$getSelection();
|
|
234
208
|
const clipboardData = event.clipboardData;
|
|
235
209
|
|
|
236
|
-
if (clipboardData != null && selection
|
|
210
|
+
if (clipboardData != null && lexical.$isRangeSelection(selection)) {
|
|
237
211
|
$insertDataTransferForPlainText(clipboardData, selection);
|
|
238
212
|
}
|
|
239
213
|
});
|
|
@@ -241,10 +215,9 @@ function onPasteForPlainText(event, editor) {
|
|
|
241
215
|
function onCutForPlainText(event, editor) {
|
|
242
216
|
onCopyForPlainText(event, editor);
|
|
243
217
|
editor.update(() => {
|
|
244
|
-
lexical.$log('onCutForPlainText');
|
|
245
218
|
const selection = lexical.$getSelection();
|
|
246
219
|
|
|
247
|
-
if (selection
|
|
220
|
+
if (lexical.$isRangeSelection(selection)) {
|
|
248
221
|
selection.removeText();
|
|
249
222
|
}
|
|
250
223
|
});
|
|
@@ -252,7 +225,6 @@ function onCutForPlainText(event, editor) {
|
|
|
252
225
|
function onCopyForPlainText(event, editor) {
|
|
253
226
|
event.preventDefault();
|
|
254
227
|
editor.update(() => {
|
|
255
|
-
lexical.$log('onCopyForPlainText');
|
|
256
228
|
const clipboardData = event.clipboardData;
|
|
257
229
|
const selection = lexical.$getSelection();
|
|
258
230
|
|
|
@@ -279,6 +251,62 @@ function onCopyForPlainText(event, editor) {
|
|
|
279
251
|
});
|
|
280
252
|
}
|
|
281
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
|
+
|
|
282
310
|
/**
|
|
283
311
|
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
284
312
|
*
|
|
@@ -316,10 +344,9 @@ function useLexicalDragonSupport(editor) {
|
|
|
316
344
|
if (args) {
|
|
317
345
|
const [elementStart, elementLength, text, selStart, selLength, formatCommand] = args; // TODO: we should probably handle formatCommand somehow?
|
|
318
346
|
editor.update(() => {
|
|
319
|
-
lexical.$log('useLexicalDragonSupport');
|
|
320
347
|
const selection = lexical.$getSelection();
|
|
321
348
|
|
|
322
|
-
if (selection
|
|
349
|
+
if (lexical.$isRangeSelection(selection)) {
|
|
323
350
|
const anchor = selection.anchor;
|
|
324
351
|
let anchorNode = anchor.getNode();
|
|
325
352
|
let setSelStart = 0;
|
|
@@ -376,13 +403,12 @@ function useLexicalDragonSupport(editor) {
|
|
|
376
403
|
*
|
|
377
404
|
*
|
|
378
405
|
*/
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
useLayoutEffect(() => {
|
|
406
|
+
function usePlainTextSetup(editor, initialEditorState) {
|
|
407
|
+
React.useEffect(() => {
|
|
382
408
|
const removeListener = editor.addListener('command', (type, payload) => {
|
|
383
409
|
const selection = lexical.$getSelection();
|
|
384
410
|
|
|
385
|
-
if (selection
|
|
411
|
+
if (!lexical.$isRangeSelection(selection)) {
|
|
386
412
|
return false;
|
|
387
413
|
}
|
|
388
414
|
|
|
@@ -536,9 +562,10 @@ function usePlainTextSetup(editor) {
|
|
|
536
562
|
}
|
|
537
563
|
|
|
538
564
|
return false;
|
|
539
|
-
},
|
|
540
|
-
editor
|
|
541
|
-
return removeListener;
|
|
565
|
+
}, 0);
|
|
566
|
+
initializeEditor(editor, initialEditorState);
|
|
567
|
+
return removeListener; // We only do this for init
|
|
568
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
542
569
|
}, [editor]);
|
|
543
570
|
useLexicalDragonSupport(editor);
|
|
544
571
|
}
|
|
@@ -553,11 +580,12 @@ function usePlainTextSetup(editor) {
|
|
|
553
580
|
*/
|
|
554
581
|
function PlainTextPlugin({
|
|
555
582
|
contentEditable,
|
|
556
|
-
placeholder
|
|
583
|
+
placeholder,
|
|
584
|
+
initialEditorState
|
|
557
585
|
}) {
|
|
558
586
|
const [editor] = LexicalComposerContext.useLexicalComposerContext();
|
|
559
587
|
const showPlaceholder = useLexicalCanShowPlaceholder(editor);
|
|
560
|
-
usePlainTextSetup(editor);
|
|
588
|
+
usePlainTextSetup(editor, initialEditorState);
|
|
561
589
|
const decorators = useDecorators(editor);
|
|
562
590
|
return /*#__PURE__*/React.createElement(React.Fragment, null, contentEditable, showPlaceholder && placeholder, decorators);
|
|
563
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,14 +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
|
-
|
|
8
|
-
function w(a){if(!v(a,!1))return!1;a=t.$getRoot().getChildren();const
|
|
9
|
-
function
|
|
10
|
-
function C(a,
|
|
11
|
-
function
|
|
12
|
-
function
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
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)};
|