@mx-space/cli 0.13.0 → 0.13.2
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/README.md +23 -1
- package/dist/{Lexical.dev-By5dOKBN.mjs → Lexical.dev-BsbWMhb3.mjs} +2265 -429
- package/dist/{Lexical.node-fXM8Jp7p.mjs → Lexical.node-DnR_u_Ke.mjs} +47 -10
- package/dist/Lexical.prod-B7L8eVsO.mjs +6816 -0
- package/dist/{LexicalClipboard.dev--HxGoSkO.mjs → LexicalClipboard.dev-BGSFbuTA.mjs} +131 -39
- package/dist/{LexicalClipboard.node-C3mRbrmW.mjs → LexicalClipboard.node-CUD_tpWb.mjs} +2 -2
- package/dist/LexicalClipboard.prod-DQXfRt3h.mjs +429 -0
- package/dist/{LexicalCodeCore.dev-DjSrd4A4.mjs → LexicalCodeCore.dev-B9lK_GSN.mjs} +81 -67
- package/dist/LexicalCodeCore.prod-CNWMPXhg.mjs +651 -0
- package/dist/LexicalDragon.dev-DRm2bGZ1.mjs +186 -0
- package/dist/{LexicalDragon.node-BVhw4C7s.mjs → LexicalDragon.node-d8gPruly.mjs} +3 -2
- package/dist/LexicalDragon.prod-ey3uKDJF.mjs +121 -0
- package/dist/{LexicalExtension.dev-BPNyvGqe.mjs → LexicalExtension.dev-CXtOJb83.mjs} +349 -35
- package/dist/{LexicalExtension.node-BVlcrgOx.mjs → LexicalExtension.node-CMsupJZs.mjs} +9 -4
- package/dist/{LexicalExtension.prod-DFKbiNt-.mjs → LexicalExtension.prod-BCLGhzcg.mjs} +477 -328
- package/dist/{LexicalHeadless.dev-B-cj7Pr5.mjs → LexicalHeadless.dev-yVDOBd64.mjs} +2 -2
- package/dist/{LexicalHeadless.prod-Byp1vNzT.mjs → LexicalHeadless.prod-B8qauuEA.mjs} +2 -2
- package/dist/{LexicalHtml.dev-prBAwszN.mjs → LexicalHtml.dev-3rdckXIU.mjs} +323 -265
- package/dist/{LexicalHtml.node-BvNF96jZ.mjs → LexicalHtml.node-DagZUjQ_.mjs} +6 -4
- package/dist/{LexicalHtml.prod-Sz3CW1ht.mjs → LexicalHtml.prod-B5AQaJDb.mjs} +354 -352
- package/dist/{LexicalLink.dev-NySTYhVR.mjs → LexicalLink.dev-CspSwLNB.mjs} +69 -58
- package/dist/{LexicalLink.prod-BuCM8gts.mjs → LexicalLink.prod-Da-ZW6H5.mjs} +210 -211
- package/dist/{LexicalList.dev-DIMOvSFD.mjs → LexicalList.dev-CNXmV6v8.mjs} +246 -198
- package/dist/LexicalList.prod-DgQzj4v9.mjs +944 -0
- package/dist/{LexicalMarkdown.dev-C7aylvCG.mjs → LexicalMarkdown.dev-0XURdo96.mjs} +129 -37
- package/dist/LexicalMarkdown.prod-qUsIQfJx.mjs +932 -0
- package/dist/{LexicalRichText.dev-DfICq6lU.mjs → LexicalRichText.dev-BqsEA7I9.mjs} +151 -122
- package/dist/{LexicalRichText.node-Bg9jND3Q.mjs → LexicalRichText.node-D73RR0Ck.mjs} +8 -11
- package/dist/LexicalRichText.prod-4Atyd7OR.mjs +538 -0
- package/dist/{LexicalSelection.dev-DGjj12wW.mjs → LexicalSelection.dev-DK5xfxKP.mjs} +10 -9
- package/dist/{LexicalSelection.node-BU5L4193.mjs → LexicalSelection.node-pyZyrANz.mjs} +4 -4
- package/dist/{LexicalSelection.prod-D-PwRbyK.mjs → LexicalSelection.prod-C5GrCbDC.mjs} +144 -146
- package/dist/{LexicalTable.dev-ChP7cugd.mjs → LexicalTable.dev-DiR_4rdI.mjs} +184 -119
- package/dist/LexicalTable.prod-Cbc5EasT.mjs +2336 -0
- package/dist/{LexicalUtils.dev-BiFU3789.mjs → LexicalUtils.dev-jhPjn1vQ.mjs} +375 -35
- package/dist/{LexicalUtils.node-j3Llm7Y3.mjs → LexicalUtils.node-Ck74ludK.mjs} +24 -12
- package/dist/LexicalUtils.prod-nuTBxnk_.mjs +504 -0
- package/dist/bin/mxs.mjs +1 -1
- package/dist/esm-BumPuCXw.mjs +2 -0
- package/dist/{esm-lpolVSUJ.mjs → esm-DupC6TTP.mjs} +172 -172
- package/dist/index.d.mts +16 -16
- package/dist/index.mjs +1 -1
- package/dist/{mxs-PFV8OJ-M.mjs → mxs-BgAyMQdq.mjs} +1595 -314
- package/package.json +17 -17
- package/dist/Lexical.prod-BlCvXPGa.mjs +0 -6088
- package/dist/LexicalClipboard.prod-DNJzFMcT.mjs +0 -371
- package/dist/LexicalCodeCore.prod-DTDShkR3.mjs +0 -642
- package/dist/LexicalDragon.dev-DwprRH0z.mjs +0 -88
- package/dist/LexicalDragon.prod-nh4J-8vn.mjs +0 -59
- package/dist/LexicalList.prod-MVqfA6Vo.mjs +0 -925
- package/dist/LexicalMarkdown.prod-CfQSM406.mjs +0 -868
- package/dist/LexicalRichText.prod-GsFzCK-o.mjs +0 -550
- package/dist/LexicalTable.prod-Bpr9YRXp.mjs +0 -2311
- package/dist/LexicalUtils.prod-DCvrA78p.mjs +0 -373
- package/dist/esm-DGvoYR6n.mjs +0 -2
|
@@ -1,8 +1,7 @@
|
|
|
1
|
-
import { _ as LinkNode, a as HeadingNode, c as $createListNode, d as ListItemNode, f as ListNode, h as $isLinkNode, i as $isQuoteNode, l as $isListItemNode, m as $isAutoLinkNode, n as $createQuoteNode, o as QuoteNode, p as $createLinkNode, r as $isHeadingNode, s as $createListItemNode, t as $createHeadingNode, u as $isListNode, v as $createCodeNode, x as CodeNode, y as $isCodeNode } from "./LexicalRichText.node-
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
|
|
5
|
-
//#region ../../node_modules/.pnpm/@lexical+markdown@0.45.0/node_modules/@lexical/markdown/dist/LexicalMarkdown.dev.mjs
|
|
1
|
+
import { _ as LinkNode, a as HeadingNode, c as $createListNode, d as ListItemNode, f as ListNode, h as $isLinkNode, i as $isQuoteNode, l as $isListItemNode, m as $isAutoLinkNode, n as $createQuoteNode, o as QuoteNode, p as $createLinkNode, r as $isHeadingNode, s as $createListItemNode, t as $createHeadingNode, u as $isListNode, v as $createCodeNode, x as CodeNode, y as $isCodeNode } from "./LexicalRichText.node-D73RR0Ck.mjs";
|
|
2
|
+
import { Gn as KEY_ENTER_COMMAND, Mt as $setSelection, Pt as $setState, U as $getRoot, Ut as COLLABORATION_TAG, W as $getSelection, X as $getState, Xt as COMPOSITION_END_TAG, Yt as COMMAND_PRIORITY_LOW, _ as $createTabNode, _n as HISTORY_PUSH_TAG, at as $isElementNode, b as $findMatchingParent, bt as $isTextNode, d as $createLineBreakNode, ft as $isParagraphNode, h as $createRangeSelection, hn as HISTORIC_TAG, ht as $isRootOrShadowRoot, ni as mergeRegister, p as $createParagraphNode, pt as $isRangeSelection, rt as $isDecoratorNode, t as $addUpdateTag, ur as TEXT_TYPE_TO_FORMAT, ut as $isLineBreakNode, v as $createTextNode, vr as createState } from "./Lexical.node-DnR_u_Ke.mjs";
|
|
3
|
+
import { a as $sliceSelectedTextNodeContent } from "./LexicalSelection.node-pyZyrANz.mjs";
|
|
4
|
+
//#region ../../node_modules/.pnpm/@lexical+markdown@0.46.0_typescript@6.0.3/node_modules/@lexical/markdown/dist/LexicalMarkdown.dev.mjs
|
|
6
5
|
/**
|
|
7
6
|
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
8
7
|
*
|
|
@@ -64,22 +63,47 @@ const CODE_START_REGEX = /^([ \t]*`{3,})([\w-]+)?[ \t]?/;
|
|
|
64
63
|
const CODE_END_REGEX = /^[ \t]*`{3,}$/;
|
|
65
64
|
const CODE_SINGLE_LINE_REGEX = /^[ \t]*```[^`]+(?:(?:`{1,2}|`{4,})[^`]+)*```(?:[^`]|$)/;
|
|
66
65
|
const TABLE_ROW_REG_EXP = /^(?:\|)(.+)(?:\|)\s?$/;
|
|
67
|
-
|
|
66
|
+
/**
|
|
67
|
+
* Whether `line` is a Markdown table delimiter row such as `| --- | :--: |`.
|
|
68
|
+
*
|
|
69
|
+
* This is the linear-time equivalent of `/^(\| ?:?-*:? ?)+\|\s?$/`. That
|
|
70
|
+
* pattern nests `-*` inside a `(...)+` group, a shape that backtracking regexp
|
|
71
|
+
* engines (e.g. Safari/JavaScriptCore) may run in super-linear time. A manual
|
|
72
|
+
* scan is guaranteed O(n).
|
|
73
|
+
*/
|
|
74
|
+
function isTableRowDivider(line) {
|
|
75
|
+
if (line[0] !== "|") return false;
|
|
76
|
+
const { length } = line;
|
|
77
|
+
let i = 1;
|
|
78
|
+
let cells = 0;
|
|
79
|
+
while (i < length) {
|
|
80
|
+
let j = i;
|
|
81
|
+
if (line[j] === " ") j++;
|
|
82
|
+
if (line[j] === ":") j++;
|
|
83
|
+
while (line[j] === "-") j++;
|
|
84
|
+
if (line[j] === ":") j++;
|
|
85
|
+
if (line[j] === " ") j++;
|
|
86
|
+
if (line[j] !== "|") break;
|
|
87
|
+
cells++;
|
|
88
|
+
i = j + 1;
|
|
89
|
+
}
|
|
90
|
+
return cells > 0 && (i === length || i === length - 1 && /\s/.test(line[i]));
|
|
91
|
+
}
|
|
68
92
|
const TAG_START_REGEX = /^<[a-z_][\w-]*(?:\s[^<>]*)?\/?>/i;
|
|
69
93
|
const TAG_END_REGEX = /^<\/[a-z_][\w-]*\s*>/i;
|
|
70
94
|
const ENDS_WITH = (regex) => new RegExp(`(?:${regex.source})$`, regex.flags);
|
|
71
|
-
const listMarkerState = createState("mdListMarker", {
|
|
95
|
+
const listMarkerState = /* @__PURE__ */ createState("mdListMarker", {
|
|
72
96
|
parse: (v) => typeof v === "string" && /^[-*+]$/.test(v) ? v : "-",
|
|
73
97
|
resetOnCopyNode: true
|
|
74
98
|
});
|
|
75
|
-
const codeFenceState = createState("mdCodeFence", {
|
|
99
|
+
const codeFenceState = /* @__PURE__ */ createState("mdCodeFence", {
|
|
76
100
|
parse: (val) => {
|
|
77
101
|
if (typeof val === "string" && /^`{3,}$/.test(val)) return val;
|
|
78
102
|
return "```";
|
|
79
103
|
},
|
|
80
104
|
resetOnCopyNode: true
|
|
81
105
|
});
|
|
82
|
-
const hardLineBreakState = createState("mdHardLineBreak", {
|
|
106
|
+
const hardLineBreakState = /* @__PURE__ */ createState("mdHardLineBreak", {
|
|
83
107
|
parse: (val) => {
|
|
84
108
|
if (typeof val === "string" && /^(\\| {2,})$/.test(val)) return val;
|
|
85
109
|
return "";
|
|
@@ -151,6 +175,7 @@ const listReplace = (listType) => {
|
|
|
151
175
|
const firstChild = nextNode.getFirstChild();
|
|
152
176
|
if (firstChild !== null) firstChild.insertBefore(listItem);
|
|
153
177
|
else nextNode.append(listItem);
|
|
178
|
+
if (listType === "number") nextNode.setStart(Number(match[2]));
|
|
154
179
|
parentNode.remove();
|
|
155
180
|
} else if ($isListNode(previousNode) && previousNode.getListType() === listType) {
|
|
156
181
|
if (listMarker) $setState(previousNode, listMarkerState, listMarker);
|
|
@@ -354,6 +379,14 @@ const INLINE_CODE = {
|
|
|
354
379
|
tag: "`",
|
|
355
380
|
type: "text-format"
|
|
356
381
|
};
|
|
382
|
+
function getCodeSpanDelimiter(content) {
|
|
383
|
+
const backtickRuns = content.match(/`+/g);
|
|
384
|
+
const longestRun = backtickRuns ? Math.max(...backtickRuns.map((run) => run.length)) : 0;
|
|
385
|
+
return {
|
|
386
|
+
fence: "`".repeat(longestRun + 1),
|
|
387
|
+
padded: content.length === 0 || content.includes("`") || /^\s/.test(content) && /\s$/.test(content) ? ` ${content} ` : content
|
|
388
|
+
};
|
|
389
|
+
}
|
|
357
390
|
const HIGHLIGHT = {
|
|
358
391
|
format: ["highlight"],
|
|
359
392
|
tag: "==",
|
|
@@ -480,7 +513,7 @@ function normalizeMarkdown(input, shouldMergeAdjacentLines = false) {
|
|
|
480
513
|
sanitizedLines.push(rawLine);
|
|
481
514
|
continue;
|
|
482
515
|
}
|
|
483
|
-
if (line === "" || lastLine === "" || !lastLine || HEADING_REGEX.test(lastLine) || HEADING_REGEX.test(line) || QUOTE_REGEX.test(line) || ORDERED_LIST_REGEX.test(line) || UNORDERED_LIST_REGEX.test(line) || CHECK_LIST_REGEX.test(line) || TABLE_ROW_REG_EXP.test(line) ||
|
|
516
|
+
if (line === "" || lastLine === "" || !lastLine || HEADING_REGEX.test(lastLine) || HEADING_REGEX.test(line) || QUOTE_REGEX.test(line) || ORDERED_LIST_REGEX.test(line) || UNORDERED_LIST_REGEX.test(line) || CHECK_LIST_REGEX.test(line) || TABLE_ROW_REG_EXP.test(line) || isTableRowDivider(line) || lastLineHasHardLineBreak || !shouldMergeAdjacentLines || TAG_START_REGEX.test(line) || TAG_END_REGEX.test(line) || ENDS_WITH(TAG_END_REGEX).test(lastLine) || ENDS_WITH(TAG_START_REGEX).test(lastLine) || CODE_END_REGEX.test(lastLine)) sanitizedLines.push(!shouldMergeAdjacentLines && line !== "" || hardLineBreak !== null ? rawLine : line);
|
|
484
517
|
else sanitizedLines[sanitizedLines.length - 1] = lastLine + " " + (hardLineBreak === null ? line : rawLine).trimStart();
|
|
485
518
|
}
|
|
486
519
|
return sanitizedLines.join("\n");
|
|
@@ -656,18 +689,31 @@ function $exportLineBreak(node) {
|
|
|
656
689
|
return $getState(node, hardLineBreakState) + "\n";
|
|
657
690
|
}
|
|
658
691
|
function exportTextFormat(node, textContent, textTransformers, unclosedTags, unclosableTags, shouldPreserveNewLines = false) {
|
|
692
|
+
const isCode = node.hasFormat("code");
|
|
659
693
|
let output = textContent;
|
|
660
|
-
if (!
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
|
|
694
|
+
if (!isCode) output = shouldPreserveNewLines ? output.replace(/([*_`~])/g, "\\$1") : output.replace(/([*_`~\\])/g, "\\$1");
|
|
695
|
+
let leadingSpace;
|
|
696
|
+
let trimmedOutput;
|
|
697
|
+
let trailingSpace;
|
|
698
|
+
let isWhitespaceOnly;
|
|
699
|
+
if (isCode) {
|
|
700
|
+
const { fence, padded } = getCodeSpanDelimiter(textContent);
|
|
701
|
+
leadingSpace = "";
|
|
702
|
+
trailingSpace = "";
|
|
703
|
+
trimmedOutput = fence + padded + fence;
|
|
704
|
+
isWhitespaceOnly = false;
|
|
705
|
+
} else {
|
|
706
|
+
const match = output.match(/^(\s*)(.*?)(\s*)$/s) || [
|
|
707
|
+
"",
|
|
708
|
+
"",
|
|
709
|
+
output,
|
|
710
|
+
""
|
|
711
|
+
];
|
|
712
|
+
leadingSpace = match[1];
|
|
713
|
+
trimmedOutput = match[2];
|
|
714
|
+
trailingSpace = match[3];
|
|
715
|
+
isWhitespaceOnly = trimmedOutput === "";
|
|
716
|
+
}
|
|
671
717
|
let openingTags = "";
|
|
672
718
|
let closingTagsBefore = "";
|
|
673
719
|
let closingTagsAfter = "";
|
|
@@ -677,6 +723,7 @@ function exportTextFormat(node, textContent, textTransformers, unclosedTags, unc
|
|
|
677
723
|
for (const transformer of textTransformers) {
|
|
678
724
|
const format = transformer.format[0];
|
|
679
725
|
const tag = transformer.tag;
|
|
726
|
+
if (format === "code") continue;
|
|
680
727
|
if (checkHasFormat(node, format) && !applied.has(format)) {
|
|
681
728
|
applied.add(format);
|
|
682
729
|
if (!checkHasFormat(prevNode, format) || !unclosedTags.find((element) => element.tag === tag)) {
|
|
@@ -730,25 +777,21 @@ function checkHasFormat(n, f) {
|
|
|
730
777
|
*/
|
|
731
778
|
function findOutermostTextFormatTransformer(textNode, textFormatTransformersIndex) {
|
|
732
779
|
const textContent = textNode.getTextContent();
|
|
733
|
-
const codeRegex = textFormatTransformersIndex.fullMatchRegExpByTag["`"];
|
|
734
780
|
const codeTransformer = textFormatTransformersIndex.transformersByTag["`"];
|
|
735
781
|
const excludeRanges = [];
|
|
736
782
|
let codeMatch = null;
|
|
737
|
-
if (
|
|
738
|
-
const
|
|
739
|
-
const
|
|
740
|
-
for (const match of matches) {
|
|
741
|
-
const startIndex = match.index + match[1].length;
|
|
742
|
-
const endIndex = match.index + match[0].length;
|
|
783
|
+
if (codeTransformer) {
|
|
784
|
+
const codeSpans = scanCodeSpans(textContent);
|
|
785
|
+
for (const span of codeSpans) {
|
|
743
786
|
if (!codeMatch) codeMatch = {
|
|
744
|
-
content:
|
|
745
|
-
endIndex,
|
|
746
|
-
startIndex,
|
|
787
|
+
content: span.content,
|
|
788
|
+
endIndex: span.endIndex,
|
|
789
|
+
startIndex: span.startIndex,
|
|
747
790
|
tag: "`"
|
|
748
791
|
};
|
|
749
792
|
excludeRanges.push({
|
|
750
|
-
end: endIndex,
|
|
751
|
-
start: startIndex
|
|
793
|
+
end: span.endIndex,
|
|
794
|
+
start: span.startIndex
|
|
752
795
|
});
|
|
753
796
|
}
|
|
754
797
|
}
|
|
@@ -780,11 +823,58 @@ function findOutermostTextFormatTransformer(textNode, textFormatTransformersInde
|
|
|
780
823
|
regexMatch.input = textContent;
|
|
781
824
|
return {
|
|
782
825
|
endIndex: resultMatch.endIndex,
|
|
826
|
+
isCodeSpan: resultTransformer === codeTransformer,
|
|
783
827
|
match: regexMatch,
|
|
784
828
|
startIndex: resultMatch.startIndex,
|
|
785
829
|
transformer: resultTransformer
|
|
786
830
|
};
|
|
787
831
|
}
|
|
832
|
+
function scanCodeSpans(text) {
|
|
833
|
+
const isEscaped = (index) => {
|
|
834
|
+
let count = 0;
|
|
835
|
+
for (let i = index - 1; i >= 0 && text[i] === "\\"; i--) count++;
|
|
836
|
+
return count % 2 === 1;
|
|
837
|
+
};
|
|
838
|
+
const runs = [];
|
|
839
|
+
let i = 0;
|
|
840
|
+
while (i < text.length) if (text[i] === "`") {
|
|
841
|
+
let length = 1;
|
|
842
|
+
while (i + length < text.length && text[i + length] === "`") length++;
|
|
843
|
+
runs.push({
|
|
844
|
+
index: i,
|
|
845
|
+
length
|
|
846
|
+
});
|
|
847
|
+
i += length;
|
|
848
|
+
} else i++;
|
|
849
|
+
const spans = [];
|
|
850
|
+
let openIdx = 0;
|
|
851
|
+
while (openIdx < runs.length) {
|
|
852
|
+
const opener = runs[openIdx];
|
|
853
|
+
if (isEscaped(opener.index)) {
|
|
854
|
+
openIdx++;
|
|
855
|
+
continue;
|
|
856
|
+
}
|
|
857
|
+
let closeIdx = -1;
|
|
858
|
+
for (let c = openIdx + 1; c < runs.length; c++) if (runs[c].length === opener.length) {
|
|
859
|
+
closeIdx = c;
|
|
860
|
+
break;
|
|
861
|
+
}
|
|
862
|
+
if (closeIdx === -1) {
|
|
863
|
+
openIdx++;
|
|
864
|
+
continue;
|
|
865
|
+
}
|
|
866
|
+
const closer = runs[closeIdx];
|
|
867
|
+
let content = text.slice(opener.index + opener.length, closer.index);
|
|
868
|
+
if (content.length >= 2 && content.startsWith(" ") && content.endsWith(" ") && /[^ ]/.test(content)) content = content.slice(1, -1);
|
|
869
|
+
spans.push({
|
|
870
|
+
content,
|
|
871
|
+
endIndex: closer.index + closer.length,
|
|
872
|
+
startIndex: opener.index
|
|
873
|
+
});
|
|
874
|
+
openIdx = closeIdx + 1;
|
|
875
|
+
}
|
|
876
|
+
return spans;
|
|
877
|
+
}
|
|
788
878
|
function scanDelimiters(text, transformersIndex, excludeRanges = []) {
|
|
789
879
|
const delimiters = [];
|
|
790
880
|
const delimiterChars = new Set(Object.keys(transformersIndex.transformersByTag).filter((tag) => tag[0] !== "`").map((tag) => tag[0]));
|
|
@@ -976,7 +1066,9 @@ function canContainTransformableMarkdown(node) {
|
|
|
976
1066
|
function importTextTransformers(textNode, textFormatTransformersIndex, textMatchTransformers) {
|
|
977
1067
|
let foundTextFormat = findOutermostTextFormatTransformer(textNode, textFormatTransformersIndex);
|
|
978
1068
|
let foundTextMatch = findOutermostTextMatchTransformer(textNode, textMatchTransformers);
|
|
979
|
-
if (foundTextFormat && foundTextMatch) if (foundTextFormat.
|
|
1069
|
+
if (foundTextFormat && foundTextMatch) if (foundTextFormat.isCodeSpan) if (foundTextMatch.startIndex <= foundTextFormat.startIndex && foundTextMatch.endIndex >= foundTextFormat.endIndex) foundTextFormat = null;
|
|
1070
|
+
else foundTextMatch = null;
|
|
1071
|
+
else if (foundTextFormat.startIndex <= foundTextMatch.startIndex && foundTextFormat.endIndex >= foundTextMatch.endIndex || foundTextMatch.startIndex > foundTextFormat.endIndex) foundTextMatch = null;
|
|
980
1072
|
else foundTextFormat = null;
|
|
981
1073
|
if (foundTextFormat) {
|
|
982
1074
|
const result = importTextFormatTransformer(textNode, foundTextFormat.startIndex, foundTextFormat.endIndex, foundTextFormat.transformer, foundTextFormat.match);
|
|
@@ -1102,7 +1194,7 @@ function $importBlocks(lineText, rootNode, elementTransformers, textFormatTransf
|
|
|
1102
1194
|
if ($isListNode(previousNode)) {
|
|
1103
1195
|
const lastDescendant = previousNode.getLastDescendant();
|
|
1104
1196
|
if (lastDescendant == null) targetNode = null;
|
|
1105
|
-
else targetNode = $findMatchingParent
|
|
1197
|
+
else targetNode = $findMatchingParent(lastDescendant, $isListItemNode);
|
|
1106
1198
|
}
|
|
1107
1199
|
if (targetNode != null && targetNode.getTextContentSize() > 0) {
|
|
1108
1200
|
targetNode.splice(targetNode.getChildrenSize(), 0, [$createMarkdownLineBreakNode(targetNode), ...elementNode.getChildren()]);
|
|
@@ -1262,7 +1354,7 @@ function $runTextFormatTransformers(anchorNode, anchorOffset, textFormatTransfor
|
|
|
1262
1354
|
const newOffset = closeTagEndIndex - tagLength * (openNode === closeNode ? 2 : 1) + 1;
|
|
1263
1355
|
nextSelection.anchor.set(openNode.__key, openTagStartIndex, "text");
|
|
1264
1356
|
nextSelection.focus.set(closeNode.__key, newOffset, "text");
|
|
1265
|
-
for (const format of matcher.format)
|
|
1357
|
+
for (const format of matcher.format) nextSelection.formatText(format, TEXT_TYPE_TO_FORMAT[format]);
|
|
1266
1358
|
nextSelection.anchor.set(nextSelection.focus.key, nextSelection.focus.offset, nextSelection.focus.type);
|
|
1267
1359
|
for (const format of matcher.format) if (nextSelection.hasFormat(format)) nextSelection.toggleFormat(format);
|
|
1268
1360
|
if ($isRangeSelection(selection)) nextSelection.format = selection.format;
|
|
@@ -1379,4 +1471,4 @@ function $convertSelectionToMarkdownString(transformers = TRANSFORMERS, selectio
|
|
|
1379
1471
|
return createSelectionMarkdownExport(transformers, shouldPreserveNewLines)(selection);
|
|
1380
1472
|
}
|
|
1381
1473
|
//#endregion
|
|
1382
|
-
export { $convertFromMarkdownString, $convertSelectionToMarkdownString, $convertToMarkdownString, BOLD_ITALIC_STAR, BOLD_ITALIC_UNDERSCORE, BOLD_STAR, BOLD_UNDERSCORE, CHECK_LIST, CODE, ELEMENT_TRANSFORMERS, HEADING, HIGHLIGHT, INLINE_CODE, ITALIC_STAR, ITALIC_UNDERSCORE, LINK, MULTILINE_ELEMENT_TRANSFORMERS, ORDERED_LIST, QUOTE, STRIKETHROUGH, TEXT_FORMAT_TRANSFORMERS, TEXT_MATCH_TRANSFORMERS, TRANSFORMERS, UNORDERED_LIST, registerMarkdownShortcuts };
|
|
1474
|
+
export { $convertFromMarkdownString, $convertSelectionToMarkdownString, $convertToMarkdownString, BOLD_ITALIC_STAR, BOLD_ITALIC_UNDERSCORE, BOLD_STAR, BOLD_UNDERSCORE, CHECK_LIST, CODE, ELEMENT_TRANSFORMERS, HEADING, HIGHLIGHT, INLINE_CODE, ITALIC_STAR, ITALIC_UNDERSCORE, LINK, MULTILINE_ELEMENT_TRANSFORMERS, ORDERED_LIST, QUOTE, STRIKETHROUGH, TEXT_FORMAT_TRANSFORMERS, TEXT_MATCH_TRANSFORMERS, TRANSFORMERS, UNORDERED_LIST, isTableRowDivider, registerMarkdownShortcuts };
|