@lexical/markdown 0.13.0 → 0.13.1
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/LexicalMarkdown.dev.js
CHANGED
|
@@ -236,10 +236,10 @@ function createMarkdownImport(transformers) {
|
|
|
236
236
|
}
|
|
237
237
|
|
|
238
238
|
// Removing empty paragraphs as md does not really
|
|
239
|
-
// allow empty lines and uses them as
|
|
239
|
+
// allow empty lines and uses them as delimiter
|
|
240
240
|
const children = root.getChildren();
|
|
241
241
|
for (const child of children) {
|
|
242
|
-
if (isEmptyParagraph(child)) {
|
|
242
|
+
if (isEmptyParagraph(child) && root.getChildrenSize() > 1) {
|
|
243
243
|
child.remove();
|
|
244
244
|
}
|
|
245
245
|
}
|
package/LexicalMarkdown.prod.js
CHANGED
|
@@ -13,7 +13,7 @@ let O="undefined"!==typeof window&&"undefined"!==typeof window.document&&"undefi
|
|
|
13
13
|
O&&/Android/.test(navigator.userAgent);let ea=O&&/^(?=.*Chrome).*/i.test(navigator.userAgent),R=O&&/AppleWebKit\/[\d.]+/.test(navigator.userAgent)&&!ea,fa=/^\s{0,3}$/,S=/^```(\w{1,10})?\s?$/;
|
|
14
14
|
function ha(a){let b=I(a),c=ia(b.textFormat);return(d,e)=>{d=d.split("\n");var f=d.length;e=e||k.$getRoot();e.clear();for(let h=0;h<f;h++){var g=d[h];a:{var l=d,r=h;var q=e;var y=l[r].match(S);if(y)for(var p=r,m=l.length;++p<m;)if(l[p].match(S)){y=t.$createCodeNode(y[1]);l=k.$createTextNode(l.slice(r+1,p).join("\n"));y.append(l);q.append(y);q=[y,p];break a}q=[null,r]}let [n,v]=q;if(null!=n)h=v;else{q=g;m=e;var w=b.element;p=c;l=b.textMatch;r=q.trim();y=k.$createTextNode(r);g=k.$createParagraphNode();
|
|
15
15
|
g.append(y);m.append(g);for(let {regExp:x,replace:u}of w)if(m=q.match(x)){y.setTextContent(q.slice(m[0].length));u(g,[y],m,!0);break}T(y,p,l);g.isAttached()&&0<r.length&&(q=g.getPreviousSibling(),k.$isParagraphNode(q)||B.$isQuoteNode(q)||z.$isListNode(q))&&(p=q,z.$isListNode(q)&&(q=q.getLastDescendant(),p=null==q?null:aa.$findMatchingParent(q,z.$isListItemNode)),null!=p&&0<p.getTextContentSize()&&(p.splice(p.getChildrenSize(),0,[k.$createLineBreakNode(),...g.getChildren()]),g.remove()))}}d=e.getChildren();
|
|
16
|
-
for(let h of d)d=h,k.$isParagraphNode(d)?(f=d.getFirstChild(),d=null==f||1===d.getChildrenSize()&&k.$isTextNode(f)&&fa.test(f.getTextContent())):d=!1,d&&h.remove();null!==k.$getSelection()&&e.selectEnd()}}
|
|
16
|
+
for(let h of d)d=h,k.$isParagraphNode(d)?(f=d.getFirstChild(),d=null==f||1===d.getChildrenSize()&&k.$isTextNode(f)&&fa.test(f.getTextContent())):d=!1,d&&1<e.getChildrenSize()&&h.remove();null!==k.$getSelection()&&e.selectEnd()}}
|
|
17
17
|
function T(a,b,c){var d=a.getTextContent();let e=ja(d,b);if(e){var f,g;if(e[0]===d)var l=a;else{d=e.index||0;let r=d+e[0].length;0===d?[l,f]=a.splitText(r):[g,l,f]=a.splitText(d,r)}l.setTextContent(e[2]);if(a=b.transformersByTag[e[1]])for(let r of a.format)l.hasFormat(r)||l.toggleFormat(r);l.hasFormat("code")||T(l,b,c);g&&T(g,b,c);f&&T(f,b,c)}else U(a,c)}
|
|
18
18
|
function U(a,b){a:for(;a;){for(let c of b){let d=a.getTextContent().match(c.importRegExp);if(!d)continue;let e=d.index||0,f=e+d[0].length,g,l;0===e?[g,a]=a.splitText(f):[,g,l]=a.splitText(e,f);l&&U(l,b);c.replace(g,d);continue a}break}}
|
|
19
19
|
function ja(a,b){var c=a.match(b.openTagsRegExp);if(null==c)return null;for(let f of c){var d=f.replace(/^\s/,"");c=b.fullMatchRegExpByTag[d];if(null!=c&&(c=a.match(c),d=b.transformersByTag[d],null!=c&&null!=d)){if(!1!==d.intraword)return c;var {index:e=0}=c;d=a[e-1];e=a[e+c[0].length];if(!(d&&!J.test(d)||e&&!J.test(e)))return c}}return null}
|
package/package.json
CHANGED
|
@@ -8,18 +8,18 @@
|
|
|
8
8
|
"markdown"
|
|
9
9
|
],
|
|
10
10
|
"license": "MIT",
|
|
11
|
-
"version": "0.13.
|
|
11
|
+
"version": "0.13.1",
|
|
12
12
|
"main": "LexicalMarkdown.js",
|
|
13
13
|
"peerDependencies": {
|
|
14
|
-
"lexical": "0.13.
|
|
14
|
+
"lexical": "0.13.1"
|
|
15
15
|
},
|
|
16
16
|
"dependencies": {
|
|
17
|
-
"@lexical/utils": "0.13.
|
|
18
|
-
"@lexical/code": "0.13.
|
|
19
|
-
"@lexical/text": "0.13.
|
|
20
|
-
"@lexical/rich-text": "0.13.
|
|
21
|
-
"@lexical/list": "0.13.
|
|
22
|
-
"@lexical/link": "0.13.
|
|
17
|
+
"@lexical/utils": "0.13.1",
|
|
18
|
+
"@lexical/code": "0.13.1",
|
|
19
|
+
"@lexical/text": "0.13.1",
|
|
20
|
+
"@lexical/rich-text": "0.13.1",
|
|
21
|
+
"@lexical/list": "0.13.1",
|
|
22
|
+
"@lexical/link": "0.13.1"
|
|
23
23
|
},
|
|
24
24
|
"repository": {
|
|
25
25
|
"type": "git",
|