@mx-space/cli 0.7.8 → 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 +1 -1
- package/dist/index.mjs +1 -1
- package/dist/{mxs-BZt1cLW9.mjs → mxs-DT0oYk6U.mjs} +11935 -11866
- package/package.json +15 -14
- 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,9 +1,11 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
|
|
1
|
+
import { f as namedSignals, l as effect, o as NormalizeInlineElementsExtension, p as signal, s as NormalizeTripleClickSelectionExtension } from "./LexicalExtension.node-BVlcrgOx.mjs";
|
|
2
|
+
import { $ as $isElementNode, $t as ElementNode, An as KEY_ARROW_UP_COMMAND, Bn as OUTDENT_CONTENT_COMMAND, C as $getAdjacentNode, Dn as KEY_ARROW_DOWN_COMMAND, Fn as KEY_SPACE_COMMAND, Fr as shallowMergeConfig, H as $getRoot, Hn as PASTE_TAG, Ht as CONTROLLED_TEXT_INSERTION_COMMAND, In as KEY_TAB_COMMAND, J as $insertNodes, Jn as SELECT_ALL_COMMAND, Jt as DELETE_WORD_COMMAND, Kt as DELETE_CHARACTER_COMMAND, L as $getNearestNodeFromDOMNode, Mn as KEY_DELETE_COMMAND, Nn as KEY_ENTER_COMMAND, On as KEY_ARROW_LEFT_COMMAND, Pn as KEY_ESCAPE_COMMAND, Pr as setNodeIndentFromDOM, Pt as CLICK_COMMAND, Rn as MOVE_TO_END, Rt as COMMAND_PRIORITY_EDITOR, Sn as IS_SAFARI, Sr as isHTMLElement, St as $setFormatFromDOM, Tr as isSelectionCapturedInDecoratorInput, U as $getSelection, Ut as COPY_COMMAND, Vn as PASTE_COMMAND, Wn as REMOVE_TEXT_COMMAND, Wt as CUT_COMMAND, Xt as DRAGSTART_COMMAND, Yt as DRAGOVER_COMMAND, Z as $isDecoratorNode, Zt as DROP_COMMAND, at as $isNodeSelection, bn as IS_IOS, bt as $selectAll, cn as INSERT_PARAGRAPH_COMMAND, cr as defineExtension, ct as $isRootNode, f as $createParagraphNode, ft as $isTextNode, g as $createTabNode, gt as $normalizeSelection__EXPERIMENTAL, ir as createCommand, jn as KEY_BACKSPACE_COMMAND, jr as safeCast, jt as CAN_USE_BEFORE_INPUT, kn as KEY_ARROW_RIGHT_COMMAND, ln as INSERT_TAB_COMMAND, m as $createRangeSelection, mn as IS_APPLE_WEBKIT, n as $applyNodeReplacement, nn as FORMAT_TEXT_COMMAND, on as INDENT_CONTENT_COMMAND, qt as DELETE_LINE_COMMAND, rr as configExtension, sn as INSERT_LINE_BREAK_COMMAND, st as $isRangeSelection, tn as FORMAT_ELEMENT_COMMAND, vr as isDOMNode, wt as $setSelection, xt as $setDirectionFromDOM, zn as MOVE_TO_START } from "./Lexical.node-fXM8Jp7p.mjs";
|
|
3
|
+
import { a as CoreImportExtension, g as sel, o as DOMImportExtension, p as defineImportRule } from "./LexicalHtml.node-BvNF96jZ.mjs";
|
|
4
|
+
import { n as $moveCharacter, r as $shouldOverrideDefaultCharacterSelection, t as $isParentRTL } from "./LexicalSelection.node-BU5L4193.mjs";
|
|
5
|
+
import { d as addClassNamesToElement, g as objectKlassEquals, h as mergeRegister, i as $getNearestBlockElementAncestorOrThrow, m as isHTMLElement$1, o as $handleIndentAndOutdent, r as $findMatchingParent } from "./LexicalUtils.node-j3Llm7Y3.mjs";
|
|
6
|
+
import { a as caretFromPoint, i as $writeDragSourceToDataTransfer, n as $handleRichTextDrop, o as copyToClipboard, r as $insertDataTransferForRichText, s as setLexicalClipboardDataTransfer, t as $getClipboardDataFromSelection } from "./LexicalClipboard.node-C3mRbrmW.mjs";
|
|
7
|
+
import { t as DragonExtension } from "./LexicalDragon.node-BVhw4C7s.mjs";
|
|
8
|
+
//#region ../../node_modules/.pnpm/@lexical+rich-text@0.45.0/node_modules/@lexical/rich-text/dist/LexicalRichText.dev.mjs
|
|
7
9
|
/**
|
|
8
10
|
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
9
11
|
*
|
|
@@ -18,23 +20,76 @@ import { t as DragonExtension } from "./LexicalDragon.node-OG6G55nl.mjs";
|
|
|
18
20
|
* LICENSE file in the root directory of this source tree.
|
|
19
21
|
*
|
|
20
22
|
*/
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
23
|
+
/**
|
|
24
|
+
* Configuration for {@link RichTextExtension}.
|
|
25
|
+
*
|
|
26
|
+
* @property escapeFormatTriggers - Per-format trigger configuration that
|
|
27
|
+
* controls which text formats are automatically cleared from the selection
|
|
28
|
+
* on specific user interactions.
|
|
29
|
+
*
|
|
30
|
+
* Defaults to:
|
|
31
|
+
* ```ts
|
|
32
|
+
* {
|
|
33
|
+
* capitalize: {enter: true, space: true, tab: true},
|
|
34
|
+
* lowercase: {enter: true, space: true, tab: true},
|
|
35
|
+
* uppercase: {enter: true, space: true, tab: true},
|
|
36
|
+
* }
|
|
37
|
+
* ```
|
|
38
|
+
*
|
|
39
|
+
* To opt in to escaping `code` formatting at text node boundaries:
|
|
40
|
+
* ```ts
|
|
41
|
+
* configExtension(RichTextExtension, {
|
|
42
|
+
* escapeFormatTriggers: {
|
|
43
|
+
* code: {onlyAtBoundary: true, enter: true, click: true, arrow: true},
|
|
44
|
+
* },
|
|
45
|
+
* })
|
|
46
|
+
* ```
|
|
47
|
+
*/
|
|
48
|
+
const DEFAULT_RICH_TEXT_CONFIG = { escapeFormatTriggers: {
|
|
49
|
+
capitalize: {
|
|
50
|
+
enter: true,
|
|
51
|
+
space: true,
|
|
52
|
+
tab: true
|
|
53
|
+
},
|
|
54
|
+
lowercase: {
|
|
55
|
+
enter: true,
|
|
56
|
+
space: true,
|
|
57
|
+
tab: true
|
|
58
|
+
},
|
|
59
|
+
uppercase: {
|
|
60
|
+
enter: true,
|
|
61
|
+
space: true,
|
|
62
|
+
tab: true
|
|
63
|
+
}
|
|
64
|
+
} };
|
|
65
|
+
function mergeTriggerConfig(config, override) {
|
|
66
|
+
if (!config || override === null) return override;
|
|
67
|
+
return shallowMergeConfig(config, override);
|
|
68
|
+
}
|
|
69
|
+
function mergeEscapeFormatTriggers(config, overrides) {
|
|
70
|
+
const merged = shallowMergeConfig(config, overrides);
|
|
71
|
+
for (const k of Object.keys(overrides)) merged[k] = mergeTriggerConfig(config[k], overrides[k]);
|
|
72
|
+
return merged;
|
|
73
|
+
}
|
|
74
|
+
function mergeRichTextConfig(config, overrides) {
|
|
75
|
+
const merged = shallowMergeConfig(config, overrides);
|
|
76
|
+
if (overrides.escapeFormatTriggers) merged.escapeFormatTriggers = mergeEscapeFormatTriggers(config.escapeFormatTriggers, overrides.escapeFormatTriggers);
|
|
77
|
+
return merged;
|
|
37
78
|
}
|
|
79
|
+
const RichTextExtension = defineExtension({
|
|
80
|
+
build: (_editor, config) => namedSignals(config),
|
|
81
|
+
config: safeCast(DEFAULT_RICH_TEXT_CONFIG),
|
|
82
|
+
conflictsWith: ["@lexical/plain-text"],
|
|
83
|
+
dependencies: [
|
|
84
|
+
DragonExtension,
|
|
85
|
+
NormalizeInlineElementsExtension,
|
|
86
|
+
NormalizeTripleClickSelectionExtension
|
|
87
|
+
],
|
|
88
|
+
mergeConfig: mergeRichTextConfig,
|
|
89
|
+
name: "@lexical/rich-text",
|
|
90
|
+
nodes: () => [HeadingNode, QuoteNode],
|
|
91
|
+
register: (editor, _config, state) => effect(() => registerRichText(editor, state.getOutput().escapeFormatTriggers))
|
|
92
|
+
});
|
|
38
93
|
/**
|
|
39
94
|
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
40
95
|
*
|
|
@@ -42,22 +97,78 @@ function caretFromPoint(x, y) {
|
|
|
42
97
|
* LICENSE file in the root directory of this source tree.
|
|
43
98
|
*
|
|
44
99
|
*/
|
|
45
|
-
const CAN_USE_DOM = typeof window !== "undefined" && typeof window.document !== "undefined" && typeof window.document.createElement !== "undefined";
|
|
46
100
|
/**
|
|
47
|
-
*
|
|
101
|
+
* Heuristic copied (in spirit) from the legacy `isGoogleDocsTitle`:
|
|
102
|
+
* Google Docs serializes the document title as a `<span style="font-size:
|
|
103
|
+
* 26pt">` (sometimes wrapped in a `<p>`). The presence of a 26pt span at
|
|
104
|
+
* the start of a `<p>` is treated as a heading-1 marker.
|
|
105
|
+
*/
|
|
106
|
+
function isGoogleDocsTitleSpan(node) {
|
|
107
|
+
return isHTMLElement(node) && node.nodeName === "SPAN" && node.style.fontSize === "26pt";
|
|
108
|
+
}
|
|
109
|
+
/**
|
|
110
|
+
* Import rules for {@link HeadingNode} and {@link QuoteNode}, including
|
|
111
|
+
* the Google Docs title heuristic that the legacy `HeadingNode.importDOM`
|
|
112
|
+
* declared. The Google-Docs rules are registered last (highest priority)
|
|
113
|
+
* so they precede the generic `<p>` and `<span>` rules from
|
|
114
|
+
* {@link CoreImportRules}.
|
|
48
115
|
*
|
|
49
|
-
*
|
|
50
|
-
|
|
116
|
+
* @experimental
|
|
117
|
+
*/
|
|
118
|
+
const RichTextImportRules = [
|
|
119
|
+
defineImportRule({
|
|
120
|
+
$import: (ctx, el) => {
|
|
121
|
+
const node = $createHeadingNode(el.nodeName.toLowerCase());
|
|
122
|
+
setNodeIndentFromDOM(el, node);
|
|
123
|
+
$setFormatFromDOM(node, el);
|
|
124
|
+
$setDirectionFromDOM(node, el);
|
|
125
|
+
return [node.splice(0, 0, ctx.$importChildren(el))];
|
|
126
|
+
},
|
|
127
|
+
match: sel.tag("h1", "h2", "h3", "h4", "h5", "h6"),
|
|
128
|
+
name: "@lexical/rich-text/heading"
|
|
129
|
+
}),
|
|
130
|
+
defineImportRule({
|
|
131
|
+
$import: (ctx, el) => {
|
|
132
|
+
const node = $createQuoteNode();
|
|
133
|
+
$setFormatFromDOM(node, el);
|
|
134
|
+
setNodeIndentFromDOM(el, node);
|
|
135
|
+
$setDirectionFromDOM(node, el);
|
|
136
|
+
return [node.splice(0, 0, ctx.$importChildren(el))];
|
|
137
|
+
},
|
|
138
|
+
match: sel.tag("blockquote"),
|
|
139
|
+
name: "@lexical/rich-text/blockquote"
|
|
140
|
+
}),
|
|
141
|
+
defineImportRule({
|
|
142
|
+
$import: (ctx, el, $next) => {
|
|
143
|
+
const first = el.firstChild;
|
|
144
|
+
if (first && isGoogleDocsTitleSpan(first)) return ctx.$importChildren(el);
|
|
145
|
+
return $next();
|
|
146
|
+
},
|
|
147
|
+
match: sel.tag("p"),
|
|
148
|
+
name: "@lexical/rich-text/google-docs-title-p"
|
|
149
|
+
}),
|
|
150
|
+
defineImportRule({
|
|
151
|
+
$import: (ctx, el, $next) => el.style.fontSize !== "26pt" ? $next() : [$createHeadingNode("h1").splice(0, 0, ctx.$importChildren(el))],
|
|
152
|
+
match: sel.tag("span"),
|
|
153
|
+
name: "@lexical/rich-text/google-docs-title-span"
|
|
154
|
+
})
|
|
155
|
+
];
|
|
156
|
+
/**
|
|
157
|
+
* Bundles {@link RichTextImportRules} (plus {@link CoreImportExtension})
|
|
158
|
+
* into a single dependency. Use this in editors that want the legacy
|
|
159
|
+
* `@lexical/rich-text` DOM import behavior under the new
|
|
160
|
+
* {@link DOMImportExtension} pipeline.
|
|
51
161
|
*
|
|
162
|
+
* @experimental
|
|
52
163
|
*/
|
|
53
|
-
const
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
164
|
+
const RichTextImportExtension = defineExtension({
|
|
165
|
+
dependencies: [
|
|
166
|
+
CoreImportExtension,
|
|
167
|
+
RichTextExtension,
|
|
168
|
+
configExtension(DOMImportExtension, { rules: RichTextImportRules })
|
|
169
|
+
],
|
|
170
|
+
name: "@lexical/rich-text/Import"
|
|
171
|
+
});
|
|
61
172
|
/**
|
|
62
173
|
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
63
174
|
*
|
|
@@ -90,7 +201,7 @@ var QuoteNode = class QuoteNode extends ElementNode {
|
|
|
90
201
|
}
|
|
91
202
|
exportDOM(editor) {
|
|
92
203
|
const { element } = super.exportDOM(editor);
|
|
93
|
-
if (isHTMLElement(element)) {
|
|
204
|
+
if (isHTMLElement$1(element)) {
|
|
94
205
|
if (this.isEmpty()) element.append(document.createElement("br"));
|
|
95
206
|
const formatType = this.getFormatType();
|
|
96
207
|
if (formatType) element.style.textAlign = formatType;
|
|
@@ -211,7 +322,7 @@ var HeadingNode = class HeadingNode extends ElementNode {
|
|
|
211
322
|
}
|
|
212
323
|
exportDOM(editor) {
|
|
213
324
|
const { element } = super.exportDOM(editor);
|
|
214
|
-
if (isHTMLElement(element)) {
|
|
325
|
+
if (isHTMLElement$1(element)) {
|
|
215
326
|
if (this.isEmpty()) element.append(document.createElement("br"));
|
|
216
327
|
const formatType = this.getFormatType();
|
|
217
328
|
if (formatType) element.style.textAlign = formatType;
|
|
@@ -247,9 +358,11 @@ var HeadingNode = class HeadingNode extends ElementNode {
|
|
|
247
358
|
return newElement;
|
|
248
359
|
}
|
|
249
360
|
collapseAtStart() {
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
361
|
+
if (this.isEmpty()) {
|
|
362
|
+
const paragraph = $createParagraphNode();
|
|
363
|
+
this.getChildren().forEach((child) => paragraph.append(child));
|
|
364
|
+
this.replace(paragraph);
|
|
365
|
+
}
|
|
253
366
|
return true;
|
|
254
367
|
}
|
|
255
368
|
extractWithChild() {
|
|
@@ -265,19 +378,17 @@ function $convertHeadingElement(element) {
|
|
|
265
378
|
let node = null;
|
|
266
379
|
if (nodeName === "h1" || nodeName === "h2" || nodeName === "h3" || nodeName === "h4" || nodeName === "h5" || nodeName === "h6") {
|
|
267
380
|
node = $createHeadingNode(nodeName);
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
}
|
|
381
|
+
setNodeIndentFromDOM(element, node);
|
|
382
|
+
$setFormatFromDOM(node, element);
|
|
383
|
+
$setDirectionFromDOM(node, element);
|
|
272
384
|
}
|
|
273
385
|
return { node };
|
|
274
386
|
}
|
|
275
387
|
function $convertBlockquoteElement(element) {
|
|
276
388
|
const node = $createQuoteNode();
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
}
|
|
389
|
+
$setFormatFromDOM(node, element);
|
|
390
|
+
setNodeIndentFromDOM(element, node);
|
|
391
|
+
$setDirectionFromDOM(node, element);
|
|
281
392
|
return { node };
|
|
282
393
|
}
|
|
283
394
|
function $createHeadingNode(headingTag = "h1") {
|
|
@@ -337,24 +448,78 @@ function $isSelectionCollapsedAtFrontOfIndentedBlock(selection) {
|
|
|
337
448
|
return element.getIndent() > 0 && (element.is(anchorNode) || anchorNode.is(element.getFirstDescendant()));
|
|
338
449
|
}
|
|
339
450
|
/**
|
|
340
|
-
*
|
|
341
|
-
*
|
|
342
|
-
*
|
|
451
|
+
* Trigger types that cause format escape at text node boundaries.
|
|
452
|
+
* - `enter`: Escape on Enter key press
|
|
453
|
+
* - `click`: Escape on mouse click
|
|
454
|
+
* - `arrow`: Escape on arrow key navigation (left/right)
|
|
455
|
+
* - `space`: Escape on Space key press
|
|
456
|
+
* - `tab`: Escape on Tab key press
|
|
343
457
|
*/
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
458
|
+
/**
|
|
459
|
+
* Trigger flags for a single format type. Set a trigger key to `true` to
|
|
460
|
+
* escape that format when the corresponding user interaction occurs.
|
|
461
|
+
*
|
|
462
|
+
* When `onlyAtBoundary` is `true`, the format is only escaped when the cursor
|
|
463
|
+
* is at the start or end of a formatted text node with no adjacent sibling in
|
|
464
|
+
* that direction. When `onlyAtBoundary` is `false` or omitted the format is
|
|
465
|
+
* always escaped regardless of cursor position (matching the legacy
|
|
466
|
+
* `$resetCapitalization` behavior).
|
|
467
|
+
*/
|
|
468
|
+
/**
|
|
469
|
+
* Per-format trigger configuration. Each {@link TextFormatType} maps to its
|
|
470
|
+
* own set of triggers, or `null` to explicitly disable escape for that format
|
|
471
|
+
* (useful when overriding defaults via `configExtension`).
|
|
472
|
+
*/
|
|
473
|
+
function $escapeFormatsForTrigger(selection, trigger, direction, config) {
|
|
474
|
+
let isBoundary = false;
|
|
475
|
+
let anchorNode = null;
|
|
476
|
+
if (selection.isCollapsed() && selection.anchor.type === "text") {
|
|
477
|
+
const node = selection.anchor.getNode();
|
|
478
|
+
if ($isTextNode(node)) {
|
|
479
|
+
anchorNode = node;
|
|
480
|
+
const offset = selection.anchor.offset;
|
|
481
|
+
const atEnd = offset === node.getTextContentSize() && node.getNextSibling() === null;
|
|
482
|
+
const atStart = offset === 0 && node.getPreviousSibling() === null;
|
|
483
|
+
isBoundary = direction === "end" && atEnd || direction === "start" && atStart || direction === "both" && (atEnd || atStart);
|
|
484
|
+
}
|
|
485
|
+
}
|
|
486
|
+
let didEscapeBoundary = false;
|
|
487
|
+
for (const [formatKey, triggers] of Object.entries(config)) {
|
|
488
|
+
if (triggers == null || !triggers[trigger]) continue;
|
|
489
|
+
const format = formatKey;
|
|
490
|
+
if (triggers.onlyAtBoundary) {
|
|
491
|
+
if (!isBoundary || !anchorNode || !$isTextNode(anchorNode) || !anchorNode.hasFormat(format)) continue;
|
|
492
|
+
didEscapeBoundary = true;
|
|
493
|
+
}
|
|
494
|
+
if (selection.hasFormat(format)) selection.toggleFormat(format);
|
|
495
|
+
}
|
|
496
|
+
if (didEscapeBoundary) selection.setStyle("");
|
|
350
497
|
}
|
|
351
|
-
|
|
352
|
-
|
|
498
|
+
const DEFAULT_ESCAPE_FORMAT_TRIGGERS = {
|
|
499
|
+
capitalize: {
|
|
500
|
+
enter: true,
|
|
501
|
+
space: true,
|
|
502
|
+
tab: true
|
|
503
|
+
},
|
|
504
|
+
lowercase: {
|
|
505
|
+
enter: true,
|
|
506
|
+
space: true,
|
|
507
|
+
tab: true
|
|
508
|
+
},
|
|
509
|
+
uppercase: {
|
|
510
|
+
enter: true,
|
|
511
|
+
space: true,
|
|
512
|
+
tab: true
|
|
513
|
+
}
|
|
514
|
+
};
|
|
515
|
+
function registerRichText(editor, escapeFormatTriggers = signal(DEFAULT_ESCAPE_FORMAT_TRIGGERS)) {
|
|
516
|
+
return mergeRegister(editor.registerCommand(CLICK_COMMAND, () => {
|
|
353
517
|
const selection = $getSelection();
|
|
354
518
|
if ($isNodeSelection(selection)) {
|
|
355
519
|
selection.clear();
|
|
356
520
|
return true;
|
|
357
521
|
}
|
|
522
|
+
if ($isRangeSelection(selection)) $escapeFormatsForTrigger(selection, "click", "both", escapeFormatTriggers.peek());
|
|
358
523
|
return false;
|
|
359
524
|
}, COMMAND_PRIORITY_EDITOR), editor.registerCommand(DELETE_CHARACTER_COMMAND, (isBackward) => {
|
|
360
525
|
const selection = $getSelection();
|
|
@@ -491,6 +656,7 @@ function registerRichText(editor) {
|
|
|
491
656
|
}
|
|
492
657
|
}
|
|
493
658
|
if (!$isRangeSelection(selection)) return false;
|
|
659
|
+
if (!event.shiftKey) $escapeFormatsForTrigger(selection, "arrow", "start", escapeFormatTriggers.peek());
|
|
494
660
|
if ($shouldOverrideDefaultCharacterSelection(selection, true)) {
|
|
495
661
|
const isHoldingShift = event.shiftKey;
|
|
496
662
|
event.preventDefault();
|
|
@@ -510,8 +676,9 @@ function registerRichText(editor) {
|
|
|
510
676
|
}
|
|
511
677
|
}
|
|
512
678
|
if (!$isRangeSelection(selection)) return false;
|
|
513
|
-
|
|
679
|
+
if (!event.shiftKey) $escapeFormatsForTrigger(selection, "arrow", "end", escapeFormatTriggers.peek());
|
|
514
680
|
if ($shouldOverrideDefaultCharacterSelection(selection, false)) {
|
|
681
|
+
const isHoldingShift = event.shiftKey;
|
|
515
682
|
event.preventDefault();
|
|
516
683
|
$moveCharacter(selection, isHoldingShift, false);
|
|
517
684
|
return true;
|
|
@@ -536,9 +703,13 @@ function registerRichText(editor) {
|
|
|
536
703
|
event.preventDefault();
|
|
537
704
|
return editor.dispatchCommand(DELETE_CHARACTER_COMMAND, false);
|
|
538
705
|
}, COMMAND_PRIORITY_EDITOR), editor.registerCommand(KEY_ENTER_COMMAND, (event) => {
|
|
539
|
-
|
|
706
|
+
let selection = $getSelection();
|
|
707
|
+
if ($isNodeSelection(selection)) {
|
|
708
|
+
const nodes = selection.getNodes();
|
|
709
|
+
if (nodes.length === 1 && $isDecoratorNode(nodes[0]) && !nodes[0].isInline()) selection = nodes[0].selectNext();
|
|
710
|
+
}
|
|
540
711
|
if (!$isRangeSelection(selection)) return false;
|
|
541
|
-
$
|
|
712
|
+
$escapeFormatsForTrigger(selection, "enter", "both", escapeFormatTriggers.peek());
|
|
542
713
|
if (event !== null) {
|
|
543
714
|
if ((IS_IOS || IS_SAFARI || IS_APPLE_WEBKIT) && CAN_USE_BEFORE_INPUT) return false;
|
|
544
715
|
event.preventDefault();
|
|
@@ -618,26 +789,50 @@ function registerRichText(editor) {
|
|
|
618
789
|
return true;
|
|
619
790
|
}
|
|
620
791
|
return false;
|
|
621
|
-
}, COMMAND_PRIORITY_EDITOR), editor.registerCommand(KEY_SPACE_COMMAND, (
|
|
792
|
+
}, COMMAND_PRIORITY_EDITOR), editor.registerCommand(KEY_SPACE_COMMAND, () => {
|
|
622
793
|
const selection = $getSelection();
|
|
623
|
-
if ($isRangeSelection(selection)) $
|
|
794
|
+
if ($isRangeSelection(selection)) $escapeFormatsForTrigger(selection, "space", "both", escapeFormatTriggers.peek());
|
|
624
795
|
return false;
|
|
625
|
-
}, COMMAND_PRIORITY_EDITOR), editor.registerCommand(KEY_TAB_COMMAND, (
|
|
796
|
+
}, COMMAND_PRIORITY_EDITOR), editor.registerCommand(KEY_TAB_COMMAND, () => {
|
|
626
797
|
const selection = $getSelection();
|
|
627
|
-
if ($isRangeSelection(selection)) $
|
|
798
|
+
if ($isRangeSelection(selection)) $escapeFormatsForTrigger(selection, "tab", "both", escapeFormatTriggers.peek());
|
|
628
799
|
return false;
|
|
800
|
+
}, COMMAND_PRIORITY_EDITOR), editor.registerCommand(MOVE_TO_END, (event) => {
|
|
801
|
+
const selection = $getSelection();
|
|
802
|
+
if (!$isRangeSelection(selection)) return false;
|
|
803
|
+
const { anchor } = selection;
|
|
804
|
+
if (anchor.type !== "element" || anchor.offset !== 0) return false;
|
|
805
|
+
const element = anchor.getNode();
|
|
806
|
+
if (!$isElementNode(element)) return false;
|
|
807
|
+
const firstChild = element.getFirstChild();
|
|
808
|
+
if (!$isDecoratorNode(firstChild) || !firstChild.isInline()) return false;
|
|
809
|
+
const lastDescendant = element.getLastDescendant();
|
|
810
|
+
if (lastDescendant == null || $isDecoratorNode(lastDescendant)) return false;
|
|
811
|
+
const elementKey = element.getKey();
|
|
812
|
+
const ending = element.selectEnd();
|
|
813
|
+
if (event.shiftKey) ending.anchor.set(elementKey, 0, "element");
|
|
814
|
+
event.preventDefault();
|
|
815
|
+
event.stopPropagation();
|
|
816
|
+
return true;
|
|
817
|
+
}, COMMAND_PRIORITY_EDITOR), editor.registerCommand(MOVE_TO_START, (event) => {
|
|
818
|
+
const selection = $getSelection();
|
|
819
|
+
if (!$isRangeSelection(selection)) return false;
|
|
820
|
+
const { anchor, focus } = selection;
|
|
821
|
+
const focusBlock = $findMatchingParent(focus.getNode(), (node) => $isElementNode(node) && !node.isInline());
|
|
822
|
+
if (focusBlock === null) return false;
|
|
823
|
+
const firstChild = focusBlock.getFirstChild();
|
|
824
|
+
if (!$isDecoratorNode(firstChild) || !firstChild.isInline()) return false;
|
|
825
|
+
const lastDescendant = focusBlock.getLastDescendant();
|
|
826
|
+
if (lastDescendant == null || $isDecoratorNode(lastDescendant)) return false;
|
|
827
|
+
if ($findMatchingParent(anchor.getNode(), (node) => $isElementNode(node) && !node.isInline()) !== focusBlock) return false;
|
|
828
|
+
const blockKey = focusBlock.getKey();
|
|
829
|
+
if (focus.type === "element" && focus.key === blockKey && focus.offset === 0) return false;
|
|
830
|
+
selection.focus.set(blockKey, 0, "element");
|
|
831
|
+
if (!event.shiftKey) selection.anchor.set(blockKey, 0, "element");
|
|
832
|
+
event.preventDefault();
|
|
833
|
+
event.stopPropagation();
|
|
834
|
+
return true;
|
|
629
835
|
}, COMMAND_PRIORITY_EDITOR));
|
|
630
836
|
}
|
|
631
|
-
/**
|
|
632
|
-
* An extension to register \@lexical/rich-text behavior and nodes
|
|
633
|
-
* ({@link HeadingNode}, {@link QuoteNode})
|
|
634
|
-
*/
|
|
635
|
-
const RichTextExtension = defineExtension({
|
|
636
|
-
conflictsWith: ["@lexical/plain-text"],
|
|
637
|
-
dependencies: [DragonExtension],
|
|
638
|
-
name: "@lexical/rich-text",
|
|
639
|
-
nodes: () => [HeadingNode, QuoteNode],
|
|
640
|
-
register: registerRichText
|
|
641
|
-
});
|
|
642
837
|
//#endregion
|
|
643
|
-
export { $createHeadingNode, $createQuoteNode, $isHeadingNode, $isQuoteNode, DRAG_DROP_PASTE, HeadingNode, QuoteNode, RichTextExtension, eventFiles, registerRichText };
|
|
838
|
+
export { $createHeadingNode, $createQuoteNode, $isHeadingNode, $isQuoteNode, DRAG_DROP_PASTE, HeadingNode, QuoteNode, RichTextExtension, RichTextImportExtension, RichTextImportRules, eventFiles, registerRichText };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
//#region ../../node_modules/.pnpm/@lexical+code-core@0.
|
|
1
|
+
//#region ../../node_modules/.pnpm/@lexical+code-core@0.45.0/node_modules/@lexical/code-core/dist/LexicalCodeCore.node.mjs
|
|
2
2
|
/**
|
|
3
3
|
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
4
4
|
*
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
* LICENSE file in the root directory of this source tree.
|
|
7
7
|
*
|
|
8
8
|
*/
|
|
9
|
-
const mod$3 = await (process.env.NODE_ENV !== "production" ? import("./LexicalCodeCore.dev-
|
|
9
|
+
const mod$3 = await (process.env.NODE_ENV !== "production" ? import("./LexicalCodeCore.dev-DjSrd4A4.mjs") : import("./LexicalCodeCore.prod-DTDShkR3.mjs"));
|
|
10
10
|
mod$3.$createCodeHighlightNode;
|
|
11
11
|
const $createCodeNode = mod$3.$createCodeNode;
|
|
12
12
|
mod$3.$getCodeLineDirection;
|
|
@@ -16,13 +16,19 @@ mod$3.$getLastCodeNodeOfLine;
|
|
|
16
16
|
mod$3.$getStartOfCodeInLine;
|
|
17
17
|
mod$3.$isCodeHighlightNode;
|
|
18
18
|
const $isCodeNode = mod$3.$isCodeNode;
|
|
19
|
+
mod$3.$outdentLeadingSpaces;
|
|
20
|
+
mod$3.$plainifyCodeContent;
|
|
19
21
|
mod$3.CodeExtension;
|
|
20
22
|
const CodeHighlightNode = mod$3.CodeHighlightNode;
|
|
23
|
+
mod$3.CodeImportExtension;
|
|
24
|
+
mod$3.CodeImportRules;
|
|
25
|
+
mod$3.CodeIndentExtension;
|
|
21
26
|
const CodeNode = mod$3.CodeNode;
|
|
22
27
|
mod$3.DEFAULT_CODE_LANGUAGE;
|
|
23
28
|
mod$3.getDefaultCodeLanguage;
|
|
29
|
+
mod$3.registerCodeIndentation;
|
|
24
30
|
//#endregion
|
|
25
|
-
//#region ../../node_modules/.pnpm/@lexical+link@0.
|
|
31
|
+
//#region ../../node_modules/.pnpm/@lexical+link@0.45.0/node_modules/@lexical/link/dist/LexicalLink.node.mjs
|
|
26
32
|
/**
|
|
27
33
|
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
28
34
|
*
|
|
@@ -30,7 +36,7 @@ mod$3.getDefaultCodeLanguage;
|
|
|
30
36
|
* LICENSE file in the root directory of this source tree.
|
|
31
37
|
*
|
|
32
38
|
*/
|
|
33
|
-
const mod$2 = await (process.env.NODE_ENV !== "production" ? import("./LexicalLink.dev-
|
|
39
|
+
const mod$2 = await (process.env.NODE_ENV !== "production" ? import("./LexicalLink.dev-NySTYhVR.mjs") : import("./LexicalLink.prod-BuCM8gts.mjs"));
|
|
34
40
|
mod$2.$createAutoLinkNode;
|
|
35
41
|
const $createLinkNode = mod$2.$createLinkNode;
|
|
36
42
|
const $isAutoLinkNode = mod$2.$isAutoLinkNode;
|
|
@@ -40,6 +46,8 @@ mod$2.AutoLinkExtension;
|
|
|
40
46
|
const AutoLinkNode = mod$2.AutoLinkNode;
|
|
41
47
|
mod$2.ClickableLinkExtension;
|
|
42
48
|
mod$2.LinkExtension;
|
|
49
|
+
mod$2.LinkImportExtension;
|
|
50
|
+
mod$2.LinkImportRules;
|
|
43
51
|
const LinkNode = mod$2.LinkNode;
|
|
44
52
|
mod$2.TOGGLE_LINK_COMMAND;
|
|
45
53
|
mod$2.createLinkMatcherWithRegExp;
|
|
@@ -49,7 +57,7 @@ mod$2.registerClickableLink;
|
|
|
49
57
|
mod$2.registerLink;
|
|
50
58
|
mod$2.toggleLink;
|
|
51
59
|
//#endregion
|
|
52
|
-
//#region ../../node_modules/.pnpm/@lexical+list@0.
|
|
60
|
+
//#region ../../node_modules/.pnpm/@lexical+list@0.45.0/node_modules/@lexical/list/dist/LexicalList.node.mjs
|
|
53
61
|
/**
|
|
54
62
|
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
55
63
|
*
|
|
@@ -57,7 +65,7 @@ mod$2.toggleLink;
|
|
|
57
65
|
* LICENSE file in the root directory of this source tree.
|
|
58
66
|
*
|
|
59
67
|
*/
|
|
60
|
-
const mod$1 = await (process.env.NODE_ENV !== "production" ? import("./LexicalList.dev-
|
|
68
|
+
const mod$1 = await (process.env.NODE_ENV !== "production" ? import("./LexicalList.dev-DIMOvSFD.mjs") : import("./LexicalList.prod-MVqfA6Vo.mjs"));
|
|
61
69
|
const $createListItemNode = mod$1.$createListItemNode;
|
|
62
70
|
const $createListNode = mod$1.$createListNode;
|
|
63
71
|
mod$1.$getListDepth;
|
|
@@ -71,8 +79,11 @@ mod$1.INSERT_CHECK_LIST_COMMAND;
|
|
|
71
79
|
mod$1.INSERT_ORDERED_LIST_COMMAND;
|
|
72
80
|
mod$1.INSERT_UNORDERED_LIST_COMMAND;
|
|
73
81
|
mod$1.ListExtension;
|
|
82
|
+
mod$1.ListImportExtension;
|
|
83
|
+
mod$1.ListImportRules;
|
|
74
84
|
const ListItemNode = mod$1.ListItemNode;
|
|
75
85
|
const ListNode = mod$1.ListNode;
|
|
86
|
+
mod$1.ListSchema;
|
|
76
87
|
mod$1.REMOVE_LIST_COMMAND;
|
|
77
88
|
mod$1.UPDATE_LIST_START_COMMAND;
|
|
78
89
|
mod$1.insertList;
|
|
@@ -81,7 +92,7 @@ mod$1.registerList;
|
|
|
81
92
|
mod$1.registerListStrictIndentTransform;
|
|
82
93
|
mod$1.removeList;
|
|
83
94
|
//#endregion
|
|
84
|
-
//#region ../../node_modules/.pnpm/@lexical+rich-text@0.
|
|
95
|
+
//#region ../../node_modules/.pnpm/@lexical+rich-text@0.45.0/node_modules/@lexical/rich-text/dist/LexicalRichText.node.mjs
|
|
85
96
|
/**
|
|
86
97
|
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
87
98
|
*
|
|
@@ -89,7 +100,7 @@ mod$1.removeList;
|
|
|
89
100
|
* LICENSE file in the root directory of this source tree.
|
|
90
101
|
*
|
|
91
102
|
*/
|
|
92
|
-
const mod = await (process.env.NODE_ENV !== "production" ? import("./LexicalRichText.dev-
|
|
103
|
+
const mod = await (process.env.NODE_ENV !== "production" ? import("./LexicalRichText.dev-DfICq6lU.mjs") : import("./LexicalRichText.prod-GsFzCK-o.mjs"));
|
|
93
104
|
const $createHeadingNode = mod.$createHeadingNode;
|
|
94
105
|
const $createQuoteNode = mod.$createQuoteNode;
|
|
95
106
|
const $isHeadingNode = mod.$isHeadingNode;
|
|
@@ -98,6 +109,8 @@ mod.DRAG_DROP_PASTE;
|
|
|
98
109
|
const HeadingNode = mod.HeadingNode;
|
|
99
110
|
const QuoteNode = mod.QuoteNode;
|
|
100
111
|
mod.RichTextExtension;
|
|
112
|
+
mod.RichTextImportExtension;
|
|
113
|
+
mod.RichTextImportRules;
|
|
101
114
|
mod.eventFiles;
|
|
102
115
|
mod.registerRichText;
|
|
103
116
|
//#endregion
|