@mx-space/cli 0.7.7 → 0.8.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/dist/{Lexical.dev-rcxzwpir.mjs → Lexical.dev-By5dOKBN.mjs} +1486 -356
- package/dist/{Lexical.node-BUsI9gWr.mjs → Lexical.node-fXM8Jp7p.mjs} +39 -17
- package/dist/{Lexical.prod-C8HtkSD6.mjs → Lexical.prod-BlCvXPGa.mjs} +2279 -1768
- package/dist/LexicalClipboard.dev--HxGoSkO.mjs +915 -0
- package/dist/{LexicalClipboard.node-CO-MCKx5.mjs → LexicalClipboard.node-C3mRbrmW.mjs} +10 -3
- package/dist/LexicalClipboard.prod-DNJzFMcT.mjs +371 -0
- package/dist/LexicalCodeCore.dev-DjSrd4A4.mjs +1109 -0
- package/dist/LexicalCodeCore.prod-DTDShkR3.mjs +642 -0
- package/dist/{LexicalDragon.dev-gBP8WSRS.mjs → LexicalDragon.dev-DwprRH0z.mjs} +3 -3
- package/dist/{LexicalDragon.node-OG6G55nl.mjs → LexicalDragon.node-BVhw4C7s.mjs} +2 -2
- package/dist/{LexicalDragon.prod-DP-_Q8cv.mjs → LexicalDragon.prod-nh4J-8vn.mjs} +3 -3
- package/dist/{LexicalExtension.dev-DVbjljrm.mjs → LexicalExtension.dev-BPNyvGqe.mjs} +335 -6
- package/dist/{LexicalExtension.node-CF3EAPN7.mjs → LexicalExtension.node-BVlcrgOx.mjs} +15 -8
- package/dist/{LexicalExtension.prod-DklHHErZ.mjs → LexicalExtension.prod-DFKbiNt-.mjs} +375 -265
- package/dist/{LexicalHeadless.dev-DdWLM7Nl.mjs → LexicalHeadless.dev-B-cj7Pr5.mjs} +2 -2
- package/dist/{LexicalHeadless.prod-CoiiTDzR.mjs → LexicalHeadless.prod-Byp1vNzT.mjs} +2 -2
- package/dist/LexicalHtml.dev-prBAwszN.mjs +2424 -0
- package/dist/LexicalHtml.node-BvNF96jZ.mjs +56 -0
- package/dist/LexicalHtml.prod-Sz3CW1ht.mjs +1207 -0
- package/dist/{LexicalLink.dev-BS1Bf-yD.mjs → LexicalLink.dev-NySTYhVR.mjs} +42 -8
- package/dist/{LexicalLink.prod-B_crkoHP.mjs → LexicalLink.prod-BuCM8gts.mjs} +209 -191
- package/dist/{LexicalList.dev-OMqmcnQ-.mjs → LexicalList.dev-DIMOvSFD.mjs} +252 -80
- package/dist/{LexicalList.prod-CpL1s8vS.mjs → LexicalList.prod-MVqfA6Vo.mjs} +364 -278
- package/dist/{LexicalMarkdown.dev-BHSdx_Gr.mjs → LexicalMarkdown.dev-C7aylvCG.mjs} +729 -552
- package/dist/LexicalMarkdown.prod-CfQSM406.mjs +868 -0
- package/dist/{LexicalRichText.dev-Bz9A_WbM.mjs → LexicalRichText.dev-DfICq6lU.mjs} +272 -77
- package/dist/{LexicalRichText.node-DDpwfE-P.mjs → LexicalRichText.node-Bg9jND3Q.mjs} +21 -8
- package/dist/LexicalRichText.prod-GsFzCK-o.mjs +550 -0
- package/dist/{LexicalSelection.dev-CQ380fnD.mjs → LexicalSelection.dev-DGjj12wW.mjs} +50 -38
- package/dist/{LexicalSelection.node-DesBMjIE.mjs → LexicalSelection.node-BU5L4193.mjs} +4 -4
- package/dist/{LexicalSelection.prod-D2jivCDB.mjs → LexicalSelection.prod-D-PwRbyK.mjs} +158 -140
- package/dist/{LexicalTable.dev-Ca7mQ7Jk.mjs → LexicalTable.dev-ChP7cugd.mjs} +215 -53
- package/dist/{LexicalTable.prod-DyPAcC7y.mjs → LexicalTable.prod-Bpr9YRXp.mjs} +668 -573
- package/dist/{LexicalUtils.dev-HxM8F0g6.mjs → LexicalUtils.dev-BiFU3789.mjs} +10 -47
- package/dist/{LexicalUtils.node-lCWjRjoG.mjs → LexicalUtils.node-j3Llm7Y3.mjs} +2 -2
- package/dist/{LexicalUtils.prod-Bti5w4ki.mjs → LexicalUtils.prod-DCvrA78p.mjs} +103 -105
- package/dist/bin/mxs.d.mts +1 -1
- package/dist/bin/mxs.mjs +1 -1
- package/dist/esm-By7trG9K.mjs +2 -0
- package/dist/{esm-CK9m5JKX.mjs → esm-Dg-WhPCe.mjs} +989 -989
- package/dist/index.d.mts +22 -2
- package/dist/index.mjs +1 -1
- package/dist/{mxs-vbxEu09D.mjs → mxs-DT0oYk6U.mjs} +10387 -8278
- package/package.json +18 -17
- package/dist/LexicalClipboard.dev-BpqRwTLP.mjs +0 -494
- package/dist/LexicalClipboard.prod-B_xdeiAC.mjs +0 -291
- package/dist/LexicalCodeCore.dev-7_cexm39.mjs +0 -537
- package/dist/LexicalCodeCore.prod-Bd6WFHcO.mjs +0 -381
- package/dist/LexicalHtml.dev-C3ZSWBFZ.mjs +0 -684
- package/dist/LexicalHtml.node-D0TD152E.mjs +0 -24
- package/dist/LexicalHtml.prod-CX47X0zl.mjs +0 -430
- package/dist/LexicalMarkdown.prod-C-S7Ii6-.mjs +0 -754
- package/dist/LexicalRichText.prod-C8qXACDL.mjs +0 -427
- package/dist/esm-DRbkkY3r.mjs +0 -2
- /package/dist/{mxs-CM8-6uAr.d.mts → mxs-iqJBopvE.d.mts} +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { $n as
|
|
2
|
-
import { c as $insertNodeToNearestRoot, i as $getNearestBlockElementAncestorOrThrow, o as $handleIndentAndOutdent, v as selectionAlwaysOnDisplay } from "./LexicalUtils.node-
|
|
3
|
-
//#region ../../node_modules/.pnpm/@lexical+extension@0.
|
|
1
|
+
import { $ as $isElementNode, $n as TabNode, $t as ElementNode, Ar as removeClassNamesFromElement, B as $getNodeFromDOMNode, Bn as OUTDENT_CONTENT_COMMAND, Bt as COMMAND_PRIORITY_LOW, D as $getCaretRangeInDirection, E as $getCaretRange, Et as $setState, F as $getEditor, Fr as shallowMergeConfig, G as $getState, Gn as RootNode, H as $getRoot, In as KEY_TAB_COMMAND, Ir as stopLexicalPropagation, It as COMMAND_PRIORITY_BEFORE_CRITICAL, Kn as SELECTION_CHANGE_COMMAND, Ln as LineBreakNode, Lr as toggleTextFormatType, Lt as COMMAND_PRIORITY_CRITICAL, Nt as CLEAR_EDITOR_COMMAND, Or as mergeRegister, Pt as CLICK_COMMAND, Q as $isEditorState, Qn as TEXT_TYPE_TO_FORMAT, Qt as DecoratorNode, R as $getNodeByKey, Rt as COMMAND_PRIORITY_EDITOR, Tt as $setSelectionFromCaretRange, U as $getSelection, Un as ParagraphNode, V as $getPreviousSelection, W as $getSiblingCaret, X as $isChildCaret, Xn as SKIP_SCROLL_INTO_VIEW_TAG, Y as $isBlockElementNode, Z as $isDecoratorNode, Zn as SKIP_SELECTION_FOCUS_TAG, ar as createEditor, at as $isNodeSelection, cr as defineExtension, d as $createNodeSelection, er as TextNode, f as $createParagraphNode, fr as getStaticNodeConfig, gt as $normalizeSelection__EXPERIMENTAL, ht as $normalizeCaret, i as $caretRangeFromSelection, in as HISTORY_MERGE_TAG, ir as createCommand, it as $isLineBreakNode, jr as safeCast, k as $getChildCaret, kt as $updateDOMSelection, l as $create, ln as INSERT_TAB_COMMAND, lr as getDOMSelection, m as $createRangeSelection, nn as FORMAT_TEXT_COMMAND, on as INDENT_CONTENT_COMMAND, or as createState, pt as $isTextPointCaret, rr as configExtension, sr as declarePeerDependency, st as $isRangeSelection, tr as addClassNamesToElement, ut as $isSiblingCaret, vr as isDOMNode, wt as $setSelection, yt as $rewindSiblingCaret } from "./Lexical.node-fXM8Jp7p.mjs";
|
|
2
|
+
import { c as $insertNodeToNearestRoot, i as $getNearestBlockElementAncestorOrThrow, o as $handleIndentAndOutdent, v as selectionAlwaysOnDisplay } from "./LexicalUtils.node-j3Llm7Y3.mjs";
|
|
3
|
+
//#region ../../node_modules/.pnpm/@lexical+extension@0.45.0/node_modules/@lexical/extension/dist/LexicalExtension.dev.mjs
|
|
4
4
|
/**
|
|
5
5
|
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
6
6
|
*
|
|
@@ -509,6 +509,110 @@ const ClearEditorExtension = defineExtension({
|
|
|
509
509
|
*
|
|
510
510
|
*/
|
|
511
511
|
/**
|
|
512
|
+
* @experimental
|
|
513
|
+
*
|
|
514
|
+
* Default predicate matches {@link DecoratorNode} and shadow-root
|
|
515
|
+
* `ElementNode`s (e.g. `TableNode`). Apps that want to also trigger on
|
|
516
|
+
* other node types — `CodeNode`, custom non-editable blocks — should
|
|
517
|
+
* compose this default in their own predicate rather than re-deriving
|
|
518
|
+
* the check:
|
|
519
|
+
*
|
|
520
|
+
* ```ts
|
|
521
|
+
* configExtension(ClickAfterLastBlockExtension, {
|
|
522
|
+
* $shouldInsertAfter: (node) =>
|
|
523
|
+
* $defaultShouldInsertAfter(node) || $isCodeNode(node),
|
|
524
|
+
* });
|
|
525
|
+
* ```
|
|
526
|
+
*/
|
|
527
|
+
function $defaultShouldInsertAfter(node) {
|
|
528
|
+
if ($isDecoratorNode(node)) return true;
|
|
529
|
+
if ($isElementNode(node) && node.isShadowRoot()) return true;
|
|
530
|
+
return false;
|
|
531
|
+
}
|
|
532
|
+
/**
|
|
533
|
+
* Decide whether a click at `event` should be claimed by this extension.
|
|
534
|
+
* Used by both the mousedown listener (to call preventDefault on the
|
|
535
|
+
* browser's native caret pick) and the click listener (to actually
|
|
536
|
+
* insert the paragraph). Factored out so the two handlers stay in sync
|
|
537
|
+
* — they would otherwise share ~22 lines of byte-for-byte identical
|
|
538
|
+
* logic and have to be maintained together.
|
|
539
|
+
*
|
|
540
|
+
* Read-only because it is called outside an editor.update; mutation
|
|
541
|
+
* happens in the click handler's editor.update below.
|
|
542
|
+
*/
|
|
543
|
+
function shouldClaimClick(editor, rootElement, event, $shouldInsertAfter) {
|
|
544
|
+
if (!editor.isEditable()) return false;
|
|
545
|
+
if (event.target !== rootElement) return false;
|
|
546
|
+
return editor.getEditorState().read(() => {
|
|
547
|
+
const lastChild = $getRoot().getLastChild();
|
|
548
|
+
if (lastChild === null) return false;
|
|
549
|
+
const lastChildDOM = editor.getElementByKey(lastChild.getKey());
|
|
550
|
+
if (lastChildDOM === null) return false;
|
|
551
|
+
if (event.clientY <= lastChildDOM.getBoundingClientRect().bottom) return false;
|
|
552
|
+
return $shouldInsertAfter(lastChild);
|
|
553
|
+
}, { editor });
|
|
554
|
+
}
|
|
555
|
+
/**
|
|
556
|
+
* Click handling for the empty area below the last block of the document.
|
|
557
|
+
*
|
|
558
|
+
* Without this extension, clicking the area below the last block when that
|
|
559
|
+
* block is a {@link DecoratorNode}, a shadow-root ElementNode (e.g.
|
|
560
|
+
* `TableNode`), or any other block that doesn't accept the click naturally
|
|
561
|
+
* leaves the selection in an awkward place — `null` for a bare decorator,
|
|
562
|
+
* or at the end of a table cell. Users typically expect a new paragraph
|
|
563
|
+
* to appear below the block with the caret in it, matching the behavior
|
|
564
|
+
* of editors like Notion.
|
|
565
|
+
*
|
|
566
|
+
* This extension intercepts clicks under those conditions, inserts a new
|
|
567
|
+
* empty paragraph after the last block, and selects it.
|
|
568
|
+
*
|
|
569
|
+
* Closes #8544.
|
|
570
|
+
*/
|
|
571
|
+
const ClickAfterLastBlockExtension = defineExtension({
|
|
572
|
+
build: (_editor, config) => namedSignals(config),
|
|
573
|
+
config: safeCast({
|
|
574
|
+
$shouldInsertAfter: $defaultShouldInsertAfter,
|
|
575
|
+
disabled: false
|
|
576
|
+
}),
|
|
577
|
+
name: "@lexical/ClickAfterLastBlock",
|
|
578
|
+
register: (editor, _config, _state) => j(() => {
|
|
579
|
+
const output = _state.getOutput();
|
|
580
|
+
if (output.disabled.value) return;
|
|
581
|
+
return editor.registerRootListener((rootElement) => {
|
|
582
|
+
if (rootElement === null) return;
|
|
583
|
+
const onMouseDown = (event) => {
|
|
584
|
+
if (shouldClaimClick(editor, rootElement, event, output.$shouldInsertAfter.peek())) event.preventDefault();
|
|
585
|
+
};
|
|
586
|
+
const onClick = (event) => {
|
|
587
|
+
if (!shouldClaimClick(editor, rootElement, event, output.$shouldInsertAfter.peek())) return;
|
|
588
|
+
event.preventDefault();
|
|
589
|
+
stopLexicalPropagation(event);
|
|
590
|
+
editor.update(() => {
|
|
591
|
+
const lastChild = $getRoot().getLastChild();
|
|
592
|
+
if (lastChild === null) return;
|
|
593
|
+
if (!output.$shouldInsertAfter.peek()(lastChild)) return;
|
|
594
|
+
const paragraph = $createParagraphNode();
|
|
595
|
+
lastChild.insertAfter(paragraph);
|
|
596
|
+
paragraph.select();
|
|
597
|
+
});
|
|
598
|
+
};
|
|
599
|
+
rootElement.addEventListener("mousedown", onMouseDown, true);
|
|
600
|
+
rootElement.addEventListener("click", onClick, true);
|
|
601
|
+
return () => {
|
|
602
|
+
rootElement.removeEventListener("mousedown", onMouseDown, true);
|
|
603
|
+
rootElement.removeEventListener("click", onClick, true);
|
|
604
|
+
};
|
|
605
|
+
});
|
|
606
|
+
})
|
|
607
|
+
});
|
|
608
|
+
/**
|
|
609
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
610
|
+
*
|
|
611
|
+
* This source code is licensed under the MIT license found in the
|
|
612
|
+
* LICENSE file in the root directory of this source tree.
|
|
613
|
+
*
|
|
614
|
+
*/
|
|
615
|
+
/**
|
|
512
616
|
* Get the sets of nodes and types registered in the
|
|
513
617
|
* {@link InitialEditorConfig}. This is to be used when an extension
|
|
514
618
|
* needs to register optional behavior if some node or type is present.
|
|
@@ -720,6 +824,18 @@ function formatDevErrorMessage(message) {
|
|
|
720
824
|
* LICENSE file in the root directory of this source tree.
|
|
721
825
|
*
|
|
722
826
|
*/
|
|
827
|
+
let envLexicalVersion;
|
|
828
|
+
try {
|
|
829
|
+
envLexicalVersion = "0.45.0+dev.esm";
|
|
830
|
+
} catch (_unused) {}
|
|
831
|
+
const LEXICAL_VERSION = envLexicalVersion ?? "0.45.0+source";
|
|
832
|
+
/**
|
|
833
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
834
|
+
*
|
|
835
|
+
* This source code is licensed under the MIT license found in the
|
|
836
|
+
* LICENSE file in the root directory of this source tree.
|
|
837
|
+
*
|
|
838
|
+
*/
|
|
723
839
|
/**
|
|
724
840
|
* Recursively merge the given theme configuration in-place.
|
|
725
841
|
*
|
|
@@ -1065,7 +1181,7 @@ function maybeWithBuilder(editor) {
|
|
|
1065
1181
|
function normalizeExtensionArgument(arg) {
|
|
1066
1182
|
return Array.isArray(arg) ? arg : [arg];
|
|
1067
1183
|
}
|
|
1068
|
-
const PACKAGE_VERSION =
|
|
1184
|
+
const PACKAGE_VERSION = LEXICAL_VERSION;
|
|
1069
1185
|
/** @internal */
|
|
1070
1186
|
var LexicalBuilder = class LexicalBuilder {
|
|
1071
1187
|
roots;
|
|
@@ -1271,6 +1387,10 @@ var LexicalBuilder = class LexicalBuilder {
|
|
|
1271
1387
|
*
|
|
1272
1388
|
* It will throw if the Editor was not built using this Extension.
|
|
1273
1389
|
*
|
|
1390
|
+
* Inside an editor read/update, prefer {@link $getExtensionDependency} or
|
|
1391
|
+
* {@link $getExtensionOutput} — they resolve the editor via `$getEditor()`
|
|
1392
|
+
* so you don't have to thread it through.
|
|
1393
|
+
*
|
|
1274
1394
|
* @param editor - The editor that was built using extension
|
|
1275
1395
|
* @param extension - The concrete reference to an Extension used to build this editor
|
|
1276
1396
|
* @returns The config and output for that Extension
|
|
@@ -1292,6 +1412,10 @@ function getExtensionDependencyFromEditor(editor, extension) {
|
|
|
1292
1412
|
*
|
|
1293
1413
|
* Both the explicit Extension type and the name are required.
|
|
1294
1414
|
*
|
|
1415
|
+
* Inside an editor read/update, prefer {@link $getPeerDependency} — it
|
|
1416
|
+
* resolves the editor via `$getEditor()` so you don't have to thread it
|
|
1417
|
+
* through.
|
|
1418
|
+
*
|
|
1295
1419
|
* @example
|
|
1296
1420
|
* ```tsx
|
|
1297
1421
|
* import type { HistoryExtension } from "@lexical/history";
|
|
@@ -1320,6 +1444,10 @@ function getPeerDependencyFromEditor(editor, extensionName) {
|
|
|
1320
1444
|
*
|
|
1321
1445
|
* Both the explicit Extension type and the name are required.
|
|
1322
1446
|
*
|
|
1447
|
+
* Inside an editor read/update, prefer {@link $getPeerDependency} (which
|
|
1448
|
+
* resolves the editor via `$getEditor()`) and add your own invariant if
|
|
1449
|
+
* the peer is required.
|
|
1450
|
+
*
|
|
1323
1451
|
* @example
|
|
1324
1452
|
* ```tsx
|
|
1325
1453
|
* import type { EmojiExtension } from "./EmojiExtension";
|
|
@@ -1358,6 +1486,91 @@ function getPeerDependencyFromEditorOrThrow(editor, extensionName) {
|
|
|
1358
1486
|
* LICENSE file in the root directory of this source tree.
|
|
1359
1487
|
*
|
|
1360
1488
|
*/
|
|
1489
|
+
/**
|
|
1490
|
+
* Get the finalized config and output for `extension` from the editor
|
|
1491
|
+
* currently in scope. A `$`-flavored shorthand for
|
|
1492
|
+
* `getExtensionDependencyFromEditor($getEditor(), extension)`.
|
|
1493
|
+
*
|
|
1494
|
+
* Throws if the editor was not built with `extension` as a dependency.
|
|
1495
|
+
*
|
|
1496
|
+
* @example
|
|
1497
|
+
* ```ts
|
|
1498
|
+
* import {$getExtensionDependency} from '@lexical/extension';
|
|
1499
|
+
* import {KeywordsExtension} from './KeywordsExtension';
|
|
1500
|
+
*
|
|
1501
|
+
* class KeywordNode extends TextNode {
|
|
1502
|
+
* createDOM(config: EditorConfig): HTMLElement {
|
|
1503
|
+
* const dom = super.createDOM(config);
|
|
1504
|
+
* dom.className =
|
|
1505
|
+
* $getExtensionDependency(KeywordsExtension).config.className;
|
|
1506
|
+
* return dom;
|
|
1507
|
+
* }
|
|
1508
|
+
* }
|
|
1509
|
+
* ```
|
|
1510
|
+
*
|
|
1511
|
+
* @see {@link getExtensionDependencyFromEditor} when you have an explicit
|
|
1512
|
+
* editor reference (e.g. outside a read/update).
|
|
1513
|
+
*/
|
|
1514
|
+
function $getExtensionDependency(extension) {
|
|
1515
|
+
return getExtensionDependencyFromEditor($getEditor(), extension);
|
|
1516
|
+
}
|
|
1517
|
+
/**
|
|
1518
|
+
* Shorthand for `$getExtensionDependency(extension).output` — the most
|
|
1519
|
+
* common reason to look up an extension dependency. Throws if the editor
|
|
1520
|
+
* was not built with `extension` as a dependency.
|
|
1521
|
+
*
|
|
1522
|
+
* @example
|
|
1523
|
+
* ```ts
|
|
1524
|
+
* import {$getExtensionOutput} from '@lexical/extension';
|
|
1525
|
+
* import {DOMImportExtension} from '@lexical/html';
|
|
1526
|
+
*
|
|
1527
|
+
* const nodes = $getExtensionOutput(DOMImportExtension).$generateNodesFromDOM(
|
|
1528
|
+
* dom,
|
|
1529
|
+
* );
|
|
1530
|
+
* ```
|
|
1531
|
+
*
|
|
1532
|
+
* @see {@link $getExtensionDependency} when you need both `.config` and
|
|
1533
|
+
* `.output` (or want to mirror the shape of
|
|
1534
|
+
* {@link getExtensionDependencyFromEditor}).
|
|
1535
|
+
*/
|
|
1536
|
+
function $getExtensionOutput(extension) {
|
|
1537
|
+
return $getExtensionDependency(extension).output;
|
|
1538
|
+
}
|
|
1539
|
+
/**
|
|
1540
|
+
* Get the finalized config and output for an optional peer extension by
|
|
1541
|
+
* name, from the editor currently in scope. A `$`-flavored shorthand for
|
|
1542
|
+
* `getPeerDependencyFromEditor($getEditor(), extensionName)`.
|
|
1543
|
+
*
|
|
1544
|
+
* Returns `undefined` if the editor was not built with the named
|
|
1545
|
+
* extension. Both the explicit `Extension` type and the name are
|
|
1546
|
+
* required so the returned `config` / `output` types are correct.
|
|
1547
|
+
*
|
|
1548
|
+
* @example
|
|
1549
|
+
* ```ts
|
|
1550
|
+
* import {$getPeerDependency} from '@lexical/extension';
|
|
1551
|
+
* import type {HistoryExtension} from '@lexical/history';
|
|
1552
|
+
*
|
|
1553
|
+
* const dep = $getPeerDependency<typeof HistoryExtension>(
|
|
1554
|
+
* '@lexical/history/History',
|
|
1555
|
+
* );
|
|
1556
|
+
* if (dep) {
|
|
1557
|
+
* // …read dep.config / dep.output…
|
|
1558
|
+
* }
|
|
1559
|
+
* ```
|
|
1560
|
+
*
|
|
1561
|
+
* @see {@link getPeerDependencyFromEditor} when you have an explicit
|
|
1562
|
+
* editor reference.
|
|
1563
|
+
*/
|
|
1564
|
+
function $getPeerDependency(extensionName) {
|
|
1565
|
+
return getPeerDependencyFromEditor($getEditor(), extensionName);
|
|
1566
|
+
}
|
|
1567
|
+
/**
|
|
1568
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
1569
|
+
*
|
|
1570
|
+
* This source code is licensed under the MIT license found in the
|
|
1571
|
+
* LICENSE file in the root directory of this source tree.
|
|
1572
|
+
*
|
|
1573
|
+
*/
|
|
1361
1574
|
const EMPTY_SET = /* @__PURE__ */ new Set();
|
|
1362
1575
|
/**
|
|
1363
1576
|
* An extension that provides a `watchNodeKey` output that
|
|
@@ -1574,6 +1787,122 @@ const NestedEditorExtension = defineExtension({
|
|
|
1574
1787
|
* LICENSE file in the root directory of this source tree.
|
|
1575
1788
|
*
|
|
1576
1789
|
*/
|
|
1790
|
+
function deleteEmptyInline(node) {
|
|
1791
|
+
if ($isElementNode(node) && node.isInline() && node.isEmpty()) {
|
|
1792
|
+
node.remove();
|
|
1793
|
+
if (node.canBeEmpty()) console.warn(`Empty inline elements are removed from the EditorState, so returning 'true' from ${node.constructor.name}.canBeEmpty() is not allowed`);
|
|
1794
|
+
}
|
|
1795
|
+
}
|
|
1796
|
+
/**
|
|
1797
|
+
* This extension removes empty inline nodes from the EditorState.
|
|
1798
|
+
* This extension is designed to facilitate a smooth migration from
|
|
1799
|
+
* the plugin API with the option to disable it, but it may be removed
|
|
1800
|
+
* in the future and integrated into the core
|
|
1801
|
+
*/
|
|
1802
|
+
const NormalizeInlineElementsExtension = defineExtension({
|
|
1803
|
+
build: (editor, config, state) => namedSignals(config),
|
|
1804
|
+
config: safeCast({ disabled: false }),
|
|
1805
|
+
name: "@lexical/NormalizeInlineElements",
|
|
1806
|
+
register: (editor, config, state) => {
|
|
1807
|
+
const stores = state.getOutput();
|
|
1808
|
+
return j(() => {
|
|
1809
|
+
if (!stores.disabled.value) {
|
|
1810
|
+
const disposeTransformers = [];
|
|
1811
|
+
for (const { klass, transforms } of editor._nodes.values()) if (klass.prototype instanceof ElementNode && klass.prototype.isInline !== ElementNode.prototype.isInline) {
|
|
1812
|
+
transforms.add(deleteEmptyInline);
|
|
1813
|
+
disposeTransformers.push(() => transforms.delete(deleteEmptyInline));
|
|
1814
|
+
}
|
|
1815
|
+
return () => disposeTransformers.forEach((fn) => fn());
|
|
1816
|
+
}
|
|
1817
|
+
});
|
|
1818
|
+
}
|
|
1819
|
+
});
|
|
1820
|
+
/**
|
|
1821
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
1822
|
+
*
|
|
1823
|
+
* This source code is licensed under the MIT license found in the
|
|
1824
|
+
* LICENSE file in the root directory of this source tree.
|
|
1825
|
+
*
|
|
1826
|
+
*/
|
|
1827
|
+
const SKIP_TAGS = new Set([SKIP_SELECTION_FOCUS_TAG, SKIP_SCROLL_INTO_VIEW_TAG]);
|
|
1828
|
+
function $fixFocusOverselection() {
|
|
1829
|
+
const selection = $getSelection();
|
|
1830
|
+
if (!$isRangeSelection(selection)) return;
|
|
1831
|
+
if (!selection.isCollapsed()) {
|
|
1832
|
+
const range = $getCaretRangeInDirection($caretRangeFromSelection(selection), "next");
|
|
1833
|
+
let focusCaret = range.focus;
|
|
1834
|
+
if ($isTextPointCaret(focusCaret) && range.anchor.origin !== focusCaret.origin && focusCaret.offset === 0) focusCaret = $rewindSiblingCaret(focusCaret.getSiblingCaret());
|
|
1835
|
+
if ($isSiblingCaret(focusCaret) && range.anchor.origin !== focusCaret.origin && $isLineBreakNode(focusCaret.origin)) focusCaret = $rewindSiblingCaret(focusCaret);
|
|
1836
|
+
while ($isChildCaret(focusCaret) && range.anchor.origin !== focusCaret.origin) focusCaret = $rewindSiblingCaret($getSiblingCaret(focusCaret.origin, "next"));
|
|
1837
|
+
if ($isSiblingCaret(focusCaret) && $isElementNode(focusCaret.origin)) focusCaret = $normalizeCaret($getChildCaret(focusCaret.origin, "previous")).getFlipped();
|
|
1838
|
+
focusCaret = $normalizeCaret(focusCaret);
|
|
1839
|
+
if (!focusCaret.isSamePointCaret(range.focus)) {
|
|
1840
|
+
const sel = $setSelectionFromCaretRange($getCaretRange(range.anchor, focusCaret));
|
|
1841
|
+
const rootElement = $getEditor().getRootElement();
|
|
1842
|
+
const domSelection = rootElement && getDOMSelection(rootElement.ownerDocument.defaultView);
|
|
1843
|
+
if (domSelection) $updateDOMSelection($getPreviousSelection(), sel, $getEditor(), domSelection, SKIP_TAGS, rootElement);
|
|
1844
|
+
}
|
|
1845
|
+
}
|
|
1846
|
+
}
|
|
1847
|
+
/**
|
|
1848
|
+
* This extension handles triple-click events and will move the focus
|
|
1849
|
+
* towards the anchor in certain conditions to meet expectations.
|
|
1850
|
+
* Simply speaking, the focus should prefer to land at the end of a node
|
|
1851
|
+
* rather than the beginning of its next sibling, and it should not skip
|
|
1852
|
+
* over a LineBreakNode.
|
|
1853
|
+
*
|
|
1854
|
+
* In order to fix the result visually and avoid a flash of over-selection
|
|
1855
|
+
* it will also eagerly manipulate the DOM selection directly.
|
|
1856
|
+
*
|
|
1857
|
+
* It is conservative in that it only fires this
|
|
1858
|
+
* `$fixFocusOverselection` callback when it has detected a triple click,
|
|
1859
|
+
* but it provides the function as an output signal so that it can both
|
|
1860
|
+
* be called from other places and it can be replaced or wrapped with
|
|
1861
|
+
* different functionality.
|
|
1862
|
+
*/
|
|
1863
|
+
const NormalizeTripleClickSelectionExtension = defineExtension({
|
|
1864
|
+
build: (editor, config, state) => namedSignals(config),
|
|
1865
|
+
config: safeCast({
|
|
1866
|
+
$fixFocusOverselection,
|
|
1867
|
+
dateNow: Date.now,
|
|
1868
|
+
disabled: false,
|
|
1869
|
+
thresholdMsec: 100
|
|
1870
|
+
}),
|
|
1871
|
+
name: "@lexical/NormalizeTripleClickSelection",
|
|
1872
|
+
register: (editor, config, state) => j(() => {
|
|
1873
|
+
const stores = state.getOutput();
|
|
1874
|
+
if (stores.disabled.value) return;
|
|
1875
|
+
return editor.registerRootListener((rootElement) => {
|
|
1876
|
+
if (!rootElement) return;
|
|
1877
|
+
let lastTripleClick = 0;
|
|
1878
|
+
const refreshTripleClick = (event) => {
|
|
1879
|
+
if (event ? event.detail === 3 : lastTripleClick > 0) {
|
|
1880
|
+
const now = stores.dateNow.peek()();
|
|
1881
|
+
lastTripleClick = event && event.type === "mousedown" || now - lastTripleClick <= stores.thresholdMsec.peek() ? now : 0;
|
|
1882
|
+
}
|
|
1883
|
+
return lastTripleClick;
|
|
1884
|
+
};
|
|
1885
|
+
return mergeRegister(editor.registerCommand(SELECTION_CHANGE_COMMAND, () => {
|
|
1886
|
+
if (refreshTripleClick(null)) {
|
|
1887
|
+
lastTripleClick = 0;
|
|
1888
|
+
stores.$fixFocusOverselection.peek()();
|
|
1889
|
+
}
|
|
1890
|
+
return false;
|
|
1891
|
+
}, COMMAND_PRIORITY_BEFORE_CRITICAL), (() => {
|
|
1892
|
+
const events = ["mouseup", "mousedown"];
|
|
1893
|
+
events.forEach((v) => rootElement.addEventListener(v, refreshTripleClick, true));
|
|
1894
|
+
return () => events.forEach((v) => rootElement.removeEventListener(v, refreshTripleClick, true));
|
|
1895
|
+
})());
|
|
1896
|
+
});
|
|
1897
|
+
})
|
|
1898
|
+
});
|
|
1899
|
+
/**
|
|
1900
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
1901
|
+
*
|
|
1902
|
+
* This source code is licensed under the MIT license found in the
|
|
1903
|
+
* LICENSE file in the root directory of this source tree.
|
|
1904
|
+
*
|
|
1905
|
+
*/
|
|
1577
1906
|
/**
|
|
1578
1907
|
* An extension that highlights selected content in the Lexical editor
|
|
1579
1908
|
* even when the editor is not currently focused.
|
|
@@ -1616,7 +1945,7 @@ function $indentOverTab(selection) {
|
|
|
1616
1945
|
return false;
|
|
1617
1946
|
}
|
|
1618
1947
|
function $defaultCanIndent(node) {
|
|
1619
|
-
return node.
|
|
1948
|
+
return node.canIndent();
|
|
1620
1949
|
}
|
|
1621
1950
|
function registerTabIndentation(editor, maxIndent, $canIndent = $defaultCanIndent) {
|
|
1622
1951
|
return mergeRegister(editor.registerCommand(KEY_TAB_COMMAND, (event) => {
|
|
@@ -1660,4 +1989,4 @@ const TabIndentationExtension = defineExtension({
|
|
|
1660
1989
|
}
|
|
1661
1990
|
});
|
|
1662
1991
|
//#endregion
|
|
1663
|
-
export { $createHorizontalRuleNode, $isDecoratorTextNode, $isHorizontalRuleNode, AutoFocusExtension, ClearEditorExtension, DecoratorTextExtension, DecoratorTextNode, EditorStateExtension, HorizontalRuleExtension, HorizontalRuleNode, INSERT_HORIZONTAL_RULE_COMMAND, InitialStateExtension, LexicalBuilder, NestedEditorExtension, NodeSelectionExtension, SelectionAlwaysOnDisplayExtension, TabIndentationExtension, applyFormatFromStyle, applyFormatToDom, n as batch, buildEditorFromExtensions, g as computed, configExtension, declarePeerDependency, defineExtension, j as effect, getExtensionDependencyFromEditor, getKnownTypesAndNodes, getPeerDependencyFromEditor, getPeerDependencyFromEditorOrThrow, namedSignals, registerClearEditor, registerTabIndentation, safeCast, shallowMergeConfig, a as signal, h as untracked, watchedSignal };
|
|
1992
|
+
export { $createHorizontalRuleNode, $defaultShouldInsertAfter, $getExtensionDependency, $getExtensionOutput, $getPeerDependency, $isDecoratorTextNode, $isHorizontalRuleNode, AutoFocusExtension, ClearEditorExtension, ClickAfterLastBlockExtension, DecoratorTextExtension, DecoratorTextNode, EditorStateExtension, HorizontalRuleExtension, HorizontalRuleNode, INSERT_HORIZONTAL_RULE_COMMAND, InitialStateExtension, LexicalBuilder, NestedEditorExtension, NodeSelectionExtension, NormalizeInlineElementsExtension, NormalizeTripleClickSelectionExtension, SelectionAlwaysOnDisplayExtension, TabIndentationExtension, applyFormatFromStyle, applyFormatToDom, n as batch, buildEditorFromExtensions, g as computed, configExtension, declarePeerDependency, defineExtension, j as effect, getExtensionDependencyFromEditor, getKnownTypesAndNodes, getPeerDependencyFromEditor, getPeerDependencyFromEditorOrThrow, namedSignals, registerClearEditor, registerTabIndentation, safeCast, shallowMergeConfig, a as signal, h as untracked, watchedSignal };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
//#region ../../node_modules/.pnpm/@lexical+extension@0.
|
|
1
|
+
//#region ../../node_modules/.pnpm/@lexical+extension@0.45.0/node_modules/@lexical/extension/dist/LexicalExtension.node.mjs
|
|
2
2
|
/**
|
|
3
3
|
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
4
4
|
*
|
|
@@ -6,22 +6,29 @@
|
|
|
6
6
|
* LICENSE file in the root directory of this source tree.
|
|
7
7
|
*
|
|
8
8
|
*/
|
|
9
|
-
const mod = await (process.env.NODE_ENV !== "production" ? import("./LexicalExtension.dev-
|
|
10
|
-
mod.$createHorizontalRuleNode;
|
|
9
|
+
const mod = await (process.env.NODE_ENV !== "production" ? import("./LexicalExtension.dev-BPNyvGqe.mjs") : import("./LexicalExtension.prod-DFKbiNt-.mjs"));
|
|
10
|
+
const $createHorizontalRuleNode = mod.$createHorizontalRuleNode;
|
|
11
|
+
mod.$defaultShouldInsertAfter;
|
|
12
|
+
mod.$getExtensionDependency;
|
|
13
|
+
const $getExtensionOutput = mod.$getExtensionOutput;
|
|
14
|
+
const $getPeerDependency = mod.$getPeerDependency;
|
|
11
15
|
mod.$isDecoratorTextNode;
|
|
12
16
|
mod.$isHorizontalRuleNode;
|
|
13
17
|
mod.AutoFocusExtension;
|
|
14
18
|
mod.ClearEditorExtension;
|
|
19
|
+
mod.ClickAfterLastBlockExtension;
|
|
15
20
|
mod.DecoratorTextExtension;
|
|
16
21
|
mod.DecoratorTextNode;
|
|
17
22
|
mod.EditorStateExtension;
|
|
18
|
-
mod.HorizontalRuleExtension;
|
|
23
|
+
const HorizontalRuleExtension = mod.HorizontalRuleExtension;
|
|
19
24
|
const HorizontalRuleNode = mod.HorizontalRuleNode;
|
|
20
25
|
mod.INSERT_HORIZONTAL_RULE_COMMAND;
|
|
21
26
|
mod.InitialStateExtension;
|
|
22
|
-
|
|
27
|
+
mod.LexicalBuilder;
|
|
23
28
|
mod.NestedEditorExtension;
|
|
24
29
|
mod.NodeSelectionExtension;
|
|
30
|
+
const NormalizeInlineElementsExtension = mod.NormalizeInlineElementsExtension;
|
|
31
|
+
const NormalizeTripleClickSelectionExtension = mod.NormalizeTripleClickSelectionExtension;
|
|
25
32
|
mod.SelectionAlwaysOnDisplayExtension;
|
|
26
33
|
mod.TabIndentationExtension;
|
|
27
34
|
mod.applyFormatFromStyle;
|
|
@@ -29,11 +36,11 @@ mod.applyFormatToDom;
|
|
|
29
36
|
mod.batch;
|
|
30
37
|
mod.buildEditorFromExtensions;
|
|
31
38
|
mod.computed;
|
|
32
|
-
mod.configExtension;
|
|
39
|
+
const configExtension = mod.configExtension;
|
|
33
40
|
mod.declarePeerDependency;
|
|
34
41
|
mod.defineExtension;
|
|
35
42
|
const effect = mod.effect;
|
|
36
|
-
|
|
43
|
+
mod.getExtensionDependencyFromEditor;
|
|
37
44
|
const getKnownTypesAndNodes = mod.getKnownTypesAndNodes;
|
|
38
45
|
const getPeerDependencyFromEditor = mod.getPeerDependencyFromEditor;
|
|
39
46
|
mod.getPeerDependencyFromEditorOrThrow;
|
|
@@ -46,4 +53,4 @@ const signal = mod.signal;
|
|
|
46
53
|
mod.untracked;
|
|
47
54
|
mod.watchedSignal;
|
|
48
55
|
//#endregion
|
|
49
|
-
export {
|
|
56
|
+
export { HorizontalRuleNode as a, configExtension as c, getPeerDependencyFromEditor as d, namedSignals as f, HorizontalRuleExtension as i, effect as l, $getExtensionOutput as n, NormalizeInlineElementsExtension as o, signal as p, $getPeerDependency as r, NormalizeTripleClickSelectionExtension as s, $createHorizontalRuleNode as t, getKnownTypesAndNodes as u };
|