@lexical/text 0.23.2-nightly.20250113.0 → 0.23.2-nightly.20250115.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -6,10 +6,4 @@
6
6
  *
7
7
  */
8
8
 
9
- 'use strict';var g=require("lexical");function r(){return g.$getRoot().getTextContent()}function u(b,e=!0){if(b)return!1;b=r();e&&(b=b.trim());return""===b}function v(b){if(!u(b,!1))return!1;b=g.$getRoot().getChildren();let e=b.length;if(1<e)return!1;for(let f=0;f<e;f++){var a=b[f];if(g.$isDecoratorNode(a))return!1;if(g.$isElementNode(a)){if(!g.$isParagraphNode(a)||0!==a.__indent)return!1;a=a.getChildren();let n=a.length;for(let t=0;t<n;t++)if(!g.$isTextNode(a[f]))return!1}}return!0}var w;
10
- function x(b){let e=new URLSearchParams;e.append("code",b);for(let a=1;a<arguments.length;a++)e.append("v",arguments[a]);throw Error(`Minified Lexical error #${b}; visit https://lexical.dev/docs/error?${e} for the full message or `+"use the non-minified dev environment for full errors and additional helpful warnings.");}w=x&&x.__esModule&&Object.prototype.hasOwnProperty.call(x,"default")?x["default"]:x;exports.$canShowPlaceholder=v;exports.$canShowPlaceholderCurry=function(b){return()=>v(b)};
11
- exports.$findTextIntersectionFromCharacters=function(b,e){var a=b.getFirstChild();b=0;a:for(;null!==a;){if(g.$isElementNode(a)){var f=a.getFirstChild();if(null!==f){a=f;continue}}else if(g.$isTextNode(a)){f=a.getTextContentSize();if(b+f>e)return{node:a,offset:e-b};b+=f}f=a.getNextSibling();if(null!==f)a=f;else{for(a=a.getParent();null!==a;){f=a.getNextSibling();if(null!==f){a=f;continue a}a=a.getParent()}break}}return null};exports.$isRootTextContentEmpty=u;
12
- exports.$isRootTextContentEmptyCurry=function(b,e){return()=>u(b,e)};exports.$rootTextContent=r;
13
- exports.registerLexicalTextEntity=function(b,e,a,f){let n=d=>{const c=g.$createTextNode(d.getTextContent());c.setFormat(d.getFormat());d.replace(c)},t=b.registerNodeTransform(g.TextNode,d=>{if(d.isSimpleText()){var c=d.getPreviousSibling(),k=d.getTextContent(),m=d;if(g.$isTextNode(c)){var l=c.getTextContent();var h=e(l+k);if(c instanceof a){if(null===h||0!==c.getLatest().__mode){n(c);return}h=h.end-l.length;if(0<h){m=k.slice(0,h);m=l+m;c.select();c.setTextContent(m);h===k.length?d.remove():(k=k.slice(h),
14
- d.setTextContent(k));return}}else if(null===h||h.start<l.length)return}for(d=0;;){l=e(k);var p=null===l?"":k.slice(l.end);k=p;if(""===p&&(h=m.getNextSibling(),g.$isTextNode(h)))if(p=m.getTextContent()+h.getTextContent(),p=e(p),null===p){h instanceof a?n(h):h.markDirty();break}else if(0!==p.start)break;if(null===l)break;if(0===l.start&&g.$isTextNode(c)&&c.isTextEntity()){d+=l.end;continue}let q;0===l.start?[q,m]=m.splitText(l.end):[,q,m]=m.splitText(l.start+d,l.end+d);void 0===q&&w(165,"nodeToReplace");
15
- c=f(q);c.setFormat(q.getFormat());q.replace(c);if(null==m)break;d=0}}});b=b.registerNodeTransform(a,d=>{var c=d.getTextContent();const k=e(c);null===k||0!==k.start?n(d):c.length>k.end?d.splitText(k.end):(c=d.getPreviousSibling(),g.$isTextNode(c)&&c.isTextEntity()&&(n(c),n(d)),c=d.getNextSibling(),g.$isTextNode(c)&&c.isTextEntity()&&(n(c),d instanceof a&&n(d)))});return[t,b]}
9
+ "use strict";var t=require("lexical");function e(){return t.$getRoot().getTextContent()}function n(t,n=!0){if(t)return!1;let r=e();return n&&(r=r.trim()),""===r}function r(e){if(!n(e,!1))return!1;const r=t.$getRoot().getChildren(),o=r.length;if(o>1)return!1;for(let e=0;e<o;e++){const n=r[e];if(t.$isDecoratorNode(n))return!1;if(t.$isElementNode(n)){if(!t.$isParagraphNode(n))return!1;if(0!==n.__indent)return!1;const r=n.getChildren(),o=r.length;for(let n=0;n<o;n++){const n=r[e];if(!t.$isTextNode(n))return!1}}}return!0}function o(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var i=o((function(t){const e=new URLSearchParams;e.append("code",t);for(let t=1;t<arguments.length;t++)e.append("v",arguments[t]);throw Error(`Minified Lexical error #${t}; visit https://lexical.dev/docs/error?${e} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`)}));exports.$canShowPlaceholder=r,exports.$canShowPlaceholderCurry=function(t){return()=>r(t)},exports.$findTextIntersectionFromCharacters=function(e,n){let r=e.getFirstChild(),o=0;t:for(;null!==r;){if(t.$isElementNode(r)){const t=r.getFirstChild();if(null!==t){r=t;continue}}else if(t.$isTextNode(r)){const t=r.getTextContentSize();if(o+t>n)return{node:r,offset:n-o};o+=t}const e=r.getNextSibling();if(null!==e){r=e;continue}let i=r.getParent();for(;null!==i;){const t=i.getNextSibling();if(null!==t){r=t;continue t}i=i.getParent()}break}return null},exports.$isRootTextContentEmpty=n,exports.$isRootTextContentEmptyCurry=function(t,e){return()=>n(t,e)},exports.$rootTextContent=e,exports.registerLexicalTextEntity=function(e,n,r,o){const s=t=>t instanceof r,l=e=>{const n=t.$createTextNode(e.getTextContent());n.setFormat(e.getFormat()),e.replace(n)};return[e.registerNodeTransform(t.TextNode,(e=>{if(!e.isSimpleText())return;let r,u=e.getPreviousSibling(),c=e.getTextContent(),f=e;if(t.$isTextNode(u)){const t=u.getTextContent(),r=n(t+c);if(s(u)){if(null===r||0!==(t=>t.getLatest().__mode)(u))return void l(u);{const n=r.end-t.length;if(n>0){const r=t+c.slice(0,n);if(u.select(),u.setTextContent(r),n===c.length)e.remove();else{const t=c.slice(n);e.setTextContent(t)}return}}}else if(null===r||r.start<t.length)return}let a=0;for(;;){r=n(c);let e,d=null===r?"":c.slice(r.end);if(c=d,""===d){const e=f.getNextSibling();if(t.$isTextNode(e)){d=f.getTextContent()+e.getTextContent();const t=n(d);if(null===t)return void(s(e)?l(e):e.markDirty());if(0!==t.start)return}}if(null===r)return;if(0===r.start&&t.$isTextNode(u)&&u.isTextEntity()){a+=r.end;continue}0===r.start?[e,f]=f.splitText(r.end):[,e,f]=f.splitText(r.start+a,r.end+a),void 0===e&&i(165,"nodeToReplace");const x=o(e);if(x.setFormat(e.getFormat()),e.replace(x),null==f)return;a=0,u=x}})),e.registerNodeTransform(r,(e=>{const r=e.getTextContent(),o=n(r);if(null===o||0!==o.start)return void l(e);if(r.length>o.end)return void e.splitText(o.end);const i=e.getPreviousSibling();t.$isTextNode(i)&&i.isTextEntity()&&(l(i),l(e));const u=e.getNextSibling();t.$isTextNode(u)&&u.isTextEntity()&&(l(u),s(e)&&l(e))}))]};
package/package.json CHANGED
@@ -9,7 +9,7 @@
9
9
  "text"
10
10
  ],
11
11
  "license": "MIT",
12
- "version": "0.23.2-nightly.20250113.0",
12
+ "version": "0.23.2-nightly.20250115.0",
13
13
  "main": "LexicalText.js",
14
14
  "types": "index.d.ts",
15
15
  "repository": {
@@ -37,6 +37,6 @@
37
37
  }
38
38
  },
39
39
  "dependencies": {
40
- "lexical": "0.23.2-nightly.20250113.0"
40
+ "lexical": "0.23.2-nightly.20250115.0"
41
41
  }
42
42
  }