@nectary/components 5.57.2 → 5.57.3
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/bundle.js +25 -14
- package/package.json +1 -1
- package/rich-textarea/utils.js +14 -11
- package/utils/markdown.js +11 -3
package/bundle.js
CHANGED
|
@@ -1667,7 +1667,7 @@ const regLink = new RegExp("(?<!\\\\)!?\\[(?<linktext>[^\\]]*?)\\]\\((?<linkhref
|
|
|
1667
1667
|
const regChip = new RegExp("(?<!\\\\)\\{\\{(?<chip>[a-zA-Z0-9_-]+)\\}\\}");
|
|
1668
1668
|
const regEmojiSeq = "(?![0-9#*])\\p{Emoji}(?:\\uFE0F|\\p{Emoji_Modifier})?\\u20E3?";
|
|
1669
1669
|
const regEmoji = new RegExp(`(?<emoji>\\p{RI}\\p{RI}|${regEmojiSeq}(?:\\u200D${regEmojiSeq})*)`, "u");
|
|
1670
|
-
const regUList = /^(?<indent>[\t ]*?)[
|
|
1670
|
+
const regUList = /^(?<indent>[\t ]*?)\*[\t ]+(?<ultext>.*?)[\t ]*?$/;
|
|
1671
1671
|
const regOList = /^(?<indent>[\t ]*?)\d+\.[\t ]+(?<oltext>.*?)[\t ]*?$/;
|
|
1672
1672
|
const regEscapedChars = /\\(?<escaped>[\\\*_\[\]`~\{\}])/;
|
|
1673
1673
|
const buildEscapedCharsReg = (extraChars) => {
|
|
@@ -1791,6 +1791,10 @@ const createBlockParser = (visitor, chipReg, escapeReg = regEscapedChars) => {
|
|
|
1791
1791
|
const getListItemText = (match) => {
|
|
1792
1792
|
return match.groups.ultext ?? match.groups.oltext;
|
|
1793
1793
|
};
|
|
1794
|
+
const leadingIndentLength = (line) => {
|
|
1795
|
+
const match = /^[\t ]*/.exec(line);
|
|
1796
|
+
return match === null ? 0 : match[0].length;
|
|
1797
|
+
};
|
|
1794
1798
|
const BLOCK_MODE_PARAGRAPH = 1;
|
|
1795
1799
|
const BLOCK_MODE_ULIST = 2;
|
|
1796
1800
|
const BLOCK_MODE_OLIST = 2;
|
|
@@ -1808,13 +1812,17 @@ const createBlockParser = (visitor, chipReg, escapeReg = regEscapedChars) => {
|
|
|
1808
1812
|
let listItemLines = [getListItemText(listMatch.match)];
|
|
1809
1813
|
visitor.listItem();
|
|
1810
1814
|
for (++i; i < lines.length; ++i) {
|
|
1811
|
-
const
|
|
1815
|
+
const line = lines[i];
|
|
1816
|
+
const listItemMatch = isOrderedList ? regOList.exec(line) : regUList.exec(line);
|
|
1812
1817
|
if (listItemMatch !== null && listItemMatch.groups.indent === listItemInitialIndent) {
|
|
1813
1818
|
parseBlock(listItemLines);
|
|
1814
1819
|
listItemLines = [getListItemText(listItemMatch)];
|
|
1815
1820
|
visitor.listItem();
|
|
1821
|
+
} else if (leadingIndentLength(line) > listItemInitialIndent.length) {
|
|
1822
|
+
listItemLines.push(line);
|
|
1816
1823
|
} else {
|
|
1817
|
-
|
|
1824
|
+
i -= 1;
|
|
1825
|
+
break;
|
|
1818
1826
|
}
|
|
1819
1827
|
}
|
|
1820
1828
|
parseBlock(listItemLines);
|
|
@@ -14843,10 +14851,11 @@ const createParseVisitor = (doc) => {
|
|
|
14843
14851
|
$currentBlock.appendChild($inline);
|
|
14844
14852
|
},
|
|
14845
14853
|
linebreak() {
|
|
14846
|
-
if (listsStack.length
|
|
14847
|
-
|
|
14848
|
-
$root.appendChild($currentBlock);
|
|
14854
|
+
if (listsStack.length > 0 && isListItem($currentBlock)) {
|
|
14855
|
+
return;
|
|
14849
14856
|
}
|
|
14857
|
+
$currentBlock = createActuallyEmptyParagraph(doc);
|
|
14858
|
+
$root.appendChild($currentBlock);
|
|
14850
14859
|
},
|
|
14851
14860
|
link(text, href, _attributes, isCode) {
|
|
14852
14861
|
const $link = createLink(text, href, doc);
|
|
@@ -14857,15 +14866,16 @@ const createParseVisitor = (doc) => {
|
|
|
14857
14866
|
},
|
|
14858
14867
|
list(isOrdered) {
|
|
14859
14868
|
listsStack.push({
|
|
14860
|
-
isOrdered
|
|
14869
|
+
isOrdered,
|
|
14870
|
+
$parentBlock: $currentBlock
|
|
14861
14871
|
});
|
|
14862
14872
|
isFirstListItem = true;
|
|
14863
14873
|
$currentBlock = null;
|
|
14864
14874
|
},
|
|
14865
14875
|
endList() {
|
|
14866
|
-
|
|
14876
|
+
const ended = listsStack.pop();
|
|
14867
14877
|
isFirstListItem = false;
|
|
14868
|
-
$currentBlock = null;
|
|
14878
|
+
$currentBlock = ended !== void 0 && isListItem(ended.$parentBlock) ? ended.$parentBlock : null;
|
|
14869
14879
|
},
|
|
14870
14880
|
listItem() {
|
|
14871
14881
|
const listLevel = listsStack.length - 1;
|
|
@@ -14879,12 +14889,13 @@ const createParseVisitor = (doc) => {
|
|
|
14879
14889
|
$currentBlock = $li;
|
|
14880
14890
|
},
|
|
14881
14891
|
paragraph() {
|
|
14882
|
-
if (listsStack.length
|
|
14883
|
-
|
|
14884
|
-
markParagraphAsBlock($p);
|
|
14885
|
-
$currentBlock = $p;
|
|
14886
|
-
$root.appendChild($p);
|
|
14892
|
+
if (listsStack.length > 0 && $currentBlock !== null) {
|
|
14893
|
+
return;
|
|
14887
14894
|
}
|
|
14895
|
+
const $p = createActuallyEmptyParagraph(doc);
|
|
14896
|
+
markParagraphAsBlock($p);
|
|
14897
|
+
$currentBlock = $p;
|
|
14898
|
+
$root.appendChild($p);
|
|
14888
14899
|
},
|
|
14889
14900
|
end() {
|
|
14890
14901
|
const children = $root.childNodes;
|
package/package.json
CHANGED
package/rich-textarea/utils.js
CHANGED
|
@@ -1833,10 +1833,11 @@ const createParseVisitor = (doc) => {
|
|
|
1833
1833
|
$currentBlock.appendChild($inline);
|
|
1834
1834
|
},
|
|
1835
1835
|
linebreak() {
|
|
1836
|
-
if (listsStack.length
|
|
1837
|
-
|
|
1838
|
-
$root.appendChild($currentBlock);
|
|
1836
|
+
if (listsStack.length > 0 && isListItem($currentBlock)) {
|
|
1837
|
+
return;
|
|
1839
1838
|
}
|
|
1839
|
+
$currentBlock = createActuallyEmptyParagraph(doc);
|
|
1840
|
+
$root.appendChild($currentBlock);
|
|
1840
1841
|
},
|
|
1841
1842
|
link(text, href, _attributes, isCode) {
|
|
1842
1843
|
const $link = createLink(text, href, doc);
|
|
@@ -1847,15 +1848,16 @@ const createParseVisitor = (doc) => {
|
|
|
1847
1848
|
},
|
|
1848
1849
|
list(isOrdered) {
|
|
1849
1850
|
listsStack.push({
|
|
1850
|
-
isOrdered
|
|
1851
|
+
isOrdered,
|
|
1852
|
+
$parentBlock: $currentBlock
|
|
1851
1853
|
});
|
|
1852
1854
|
isFirstListItem = true;
|
|
1853
1855
|
$currentBlock = null;
|
|
1854
1856
|
},
|
|
1855
1857
|
endList() {
|
|
1856
|
-
|
|
1858
|
+
const ended = listsStack.pop();
|
|
1857
1859
|
isFirstListItem = false;
|
|
1858
|
-
$currentBlock = null;
|
|
1860
|
+
$currentBlock = ended !== void 0 && isListItem(ended.$parentBlock) ? ended.$parentBlock : null;
|
|
1859
1861
|
},
|
|
1860
1862
|
listItem() {
|
|
1861
1863
|
const listLevel = listsStack.length - 1;
|
|
@@ -1869,12 +1871,13 @@ const createParseVisitor = (doc) => {
|
|
|
1869
1871
|
$currentBlock = $li;
|
|
1870
1872
|
},
|
|
1871
1873
|
paragraph() {
|
|
1872
|
-
if (listsStack.length
|
|
1873
|
-
|
|
1874
|
-
markParagraphAsBlock($p);
|
|
1875
|
-
$currentBlock = $p;
|
|
1876
|
-
$root.appendChild($p);
|
|
1874
|
+
if (listsStack.length > 0 && $currentBlock !== null) {
|
|
1875
|
+
return;
|
|
1877
1876
|
}
|
|
1877
|
+
const $p = createActuallyEmptyParagraph(doc);
|
|
1878
|
+
markParagraphAsBlock($p);
|
|
1879
|
+
$currentBlock = $p;
|
|
1880
|
+
$root.appendChild($p);
|
|
1878
1881
|
},
|
|
1879
1882
|
end() {
|
|
1880
1883
|
const children = $root.childNodes;
|
package/utils/markdown.js
CHANGED
|
@@ -13,7 +13,7 @@ const regLink = new RegExp("(?<!\\\\)!?\\[(?<linktext>[^\\]]*?)\\]\\((?<linkhref
|
|
|
13
13
|
const regChip = new RegExp("(?<!\\\\)\\{\\{(?<chip>[a-zA-Z0-9_-]+)\\}\\}");
|
|
14
14
|
const regEmojiSeq = "(?![0-9#*])\\p{Emoji}(?:\\uFE0F|\\p{Emoji_Modifier})?\\u20E3?";
|
|
15
15
|
const regEmoji = new RegExp(`(?<emoji>\\p{RI}\\p{RI}|${regEmojiSeq}(?:\\u200D${regEmojiSeq})*)`, "u");
|
|
16
|
-
const regUList = /^(?<indent>[\t ]*?)[
|
|
16
|
+
const regUList = /^(?<indent>[\t ]*?)\*[\t ]+(?<ultext>.*?)[\t ]*?$/;
|
|
17
17
|
const regOList = /^(?<indent>[\t ]*?)\d+\.[\t ]+(?<oltext>.*?)[\t ]*?$/;
|
|
18
18
|
const regEscapedChars = /\\(?<escaped>[\\\*_\[\]`~\{\}])/;
|
|
19
19
|
const buildEscapedCharsReg = (extraChars) => {
|
|
@@ -137,6 +137,10 @@ const createBlockParser = (visitor, chipReg, escapeReg = regEscapedChars) => {
|
|
|
137
137
|
const getListItemText = (match) => {
|
|
138
138
|
return match.groups.ultext ?? match.groups.oltext;
|
|
139
139
|
};
|
|
140
|
+
const leadingIndentLength = (line) => {
|
|
141
|
+
const match = /^[\t ]*/.exec(line);
|
|
142
|
+
return match === null ? 0 : match[0].length;
|
|
143
|
+
};
|
|
140
144
|
const BLOCK_MODE_PARAGRAPH = 1;
|
|
141
145
|
const BLOCK_MODE_ULIST = 2;
|
|
142
146
|
const BLOCK_MODE_OLIST = 2;
|
|
@@ -154,13 +158,17 @@ const createBlockParser = (visitor, chipReg, escapeReg = regEscapedChars) => {
|
|
|
154
158
|
let listItemLines = [getListItemText(listMatch.match)];
|
|
155
159
|
visitor.listItem();
|
|
156
160
|
for (++i; i < lines.length; ++i) {
|
|
157
|
-
const
|
|
161
|
+
const line = lines[i];
|
|
162
|
+
const listItemMatch = isOrderedList ? regOList.exec(line) : regUList.exec(line);
|
|
158
163
|
if (listItemMatch !== null && listItemMatch.groups.indent === listItemInitialIndent) {
|
|
159
164
|
parseBlock(listItemLines);
|
|
160
165
|
listItemLines = [getListItemText(listItemMatch)];
|
|
161
166
|
visitor.listItem();
|
|
167
|
+
} else if (leadingIndentLength(line) > listItemInitialIndent.length) {
|
|
168
|
+
listItemLines.push(line);
|
|
162
169
|
} else {
|
|
163
|
-
|
|
170
|
+
i -= 1;
|
|
171
|
+
break;
|
|
164
172
|
}
|
|
165
173
|
}
|
|
166
174
|
parseBlock(listItemLines);
|