@nectary/components 5.59.0 → 5.60.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/bundle.js +22 -1
- package/package.json +1 -1
- package/rich-textarea/utils.js +22 -1
package/bundle.js
CHANGED
|
@@ -14829,6 +14829,17 @@ const createParseVisitor = (doc) => {
|
|
|
14829
14829
|
let $currentBlock = null;
|
|
14830
14830
|
const listsStack = [];
|
|
14831
14831
|
let isFirstListItem = false;
|
|
14832
|
+
const dropTrailingEmptyParagraphs = () => {
|
|
14833
|
+
let $last = $root.lastChild;
|
|
14834
|
+
while (isParagraph($last) && $last.childNodes.length === 0) {
|
|
14835
|
+
const $removed = $last;
|
|
14836
|
+
$removed.remove();
|
|
14837
|
+
$last = $root.lastChild;
|
|
14838
|
+
if ($currentBlock === $removed) {
|
|
14839
|
+
$currentBlock = null;
|
|
14840
|
+
}
|
|
14841
|
+
}
|
|
14842
|
+
};
|
|
14832
14843
|
return {
|
|
14833
14844
|
escaped(char) {
|
|
14834
14845
|
const $inline = createInlineWithText(char, doc);
|
|
@@ -14882,6 +14893,9 @@ const createParseVisitor = (doc) => {
|
|
|
14882
14893
|
$currentBlock.appendChild($link);
|
|
14883
14894
|
},
|
|
14884
14895
|
list(isOrdered) {
|
|
14896
|
+
if (listsStack.length === 0) {
|
|
14897
|
+
dropTrailingEmptyParagraphs();
|
|
14898
|
+
}
|
|
14885
14899
|
listsStack.push({
|
|
14886
14900
|
isOrdered,
|
|
14887
14901
|
$parentBlock: $currentBlock
|
|
@@ -14909,8 +14923,15 @@ const createParseVisitor = (doc) => {
|
|
|
14909
14923
|
if (listsStack.length > 0 && $currentBlock !== null) {
|
|
14910
14924
|
return;
|
|
14911
14925
|
}
|
|
14926
|
+
dropTrailingEmptyParagraphs();
|
|
14927
|
+
const followsParagraph = isParagraph($root.lastChild);
|
|
14928
|
+
if (followsParagraph) {
|
|
14929
|
+
$root.appendChild(createActuallyEmptyParagraph(doc));
|
|
14930
|
+
}
|
|
14912
14931
|
const $p = createActuallyEmptyParagraph(doc);
|
|
14913
|
-
|
|
14932
|
+
if (!followsParagraph) {
|
|
14933
|
+
markParagraphAsBlock($p);
|
|
14934
|
+
}
|
|
14914
14935
|
$currentBlock = $p;
|
|
14915
14936
|
$root.appendChild($p);
|
|
14916
14937
|
},
|
package/package.json
CHANGED
package/rich-textarea/utils.js
CHANGED
|
@@ -1794,6 +1794,17 @@ const createParseVisitor = (doc) => {
|
|
|
1794
1794
|
let $currentBlock = null;
|
|
1795
1795
|
const listsStack = [];
|
|
1796
1796
|
let isFirstListItem = false;
|
|
1797
|
+
const dropTrailingEmptyParagraphs = () => {
|
|
1798
|
+
let $last = $root.lastChild;
|
|
1799
|
+
while (isParagraph($last) && $last.childNodes.length === 0) {
|
|
1800
|
+
const $removed = $last;
|
|
1801
|
+
$removed.remove();
|
|
1802
|
+
$last = $root.lastChild;
|
|
1803
|
+
if ($currentBlock === $removed) {
|
|
1804
|
+
$currentBlock = null;
|
|
1805
|
+
}
|
|
1806
|
+
}
|
|
1807
|
+
};
|
|
1797
1808
|
return {
|
|
1798
1809
|
escaped(char) {
|
|
1799
1810
|
const $inline = createInlineWithText(char, doc);
|
|
@@ -1847,6 +1858,9 @@ const createParseVisitor = (doc) => {
|
|
|
1847
1858
|
$currentBlock.appendChild($link);
|
|
1848
1859
|
},
|
|
1849
1860
|
list(isOrdered) {
|
|
1861
|
+
if (listsStack.length === 0) {
|
|
1862
|
+
dropTrailingEmptyParagraphs();
|
|
1863
|
+
}
|
|
1850
1864
|
listsStack.push({
|
|
1851
1865
|
isOrdered,
|
|
1852
1866
|
$parentBlock: $currentBlock
|
|
@@ -1874,8 +1888,15 @@ const createParseVisitor = (doc) => {
|
|
|
1874
1888
|
if (listsStack.length > 0 && $currentBlock !== null) {
|
|
1875
1889
|
return;
|
|
1876
1890
|
}
|
|
1891
|
+
dropTrailingEmptyParagraphs();
|
|
1892
|
+
const followsParagraph = isParagraph($root.lastChild);
|
|
1893
|
+
if (followsParagraph) {
|
|
1894
|
+
$root.appendChild(createActuallyEmptyParagraph(doc));
|
|
1895
|
+
}
|
|
1877
1896
|
const $p = createActuallyEmptyParagraph(doc);
|
|
1878
|
-
|
|
1897
|
+
if (!followsParagraph) {
|
|
1898
|
+
markParagraphAsBlock($p);
|
|
1899
|
+
}
|
|
1879
1900
|
$currentBlock = $p;
|
|
1880
1901
|
$root.appendChild($p);
|
|
1881
1902
|
},
|