@layers-app/editor 0.5.10-optimization → 0.6.0-specific.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 +2 -252
- package/dist/index.cjs +2 -2
- package/dist/index.d.ts +3 -4
- package/dist/index.js +11 -12
- package/dist/layers.BAh77n3h.js +53500 -0
- package/dist/layers.BR_PAAvW.js +319 -0
- package/dist/layers.BVrvmVeX.js +343 -0
- package/dist/layers.BeZDS7Yo.js +1 -0
- package/dist/layers.C9DRKDGJ.js +1 -0
- package/dist/layers.Dawun4Ev.js +44715 -0
- package/dist/layers.DwBS80Kn.js +285 -0
- package/dist/layers.Zo4c9OM_.js +161 -0
- package/package.json +23 -66
- package/dist/ExcalidrawComponent-D7Z_2awF.cjs +0 -1
- package/dist/ExcalidrawComponent-Re4zFgLg.js +0 -283
- package/dist/InlineImageComponent-DHgCaPNk.cjs +0 -1
- package/dist/InlineImageComponent-kXhZcmF6.js +0 -265
- package/dist/collaboration-C7xVk0Zj.cjs +0 -4
- package/dist/collaboration-Cn7KizEJ.js +0 -5997
- package/dist/excalidraw-C-6bid_P.js +0 -16497
- package/dist/excalidraw-DpwKTNBz.cjs +0 -574
- package/dist/index-B4yOqKUQ.cjs +0 -1
- package/dist/index-BZu8Qnrg.cjs +0 -1
- package/dist/index-CFA9Drk2.cjs +0 -16
- package/dist/index-CX5msaMB.js +0 -296
- package/dist/index-CbQX0N2c.js +0 -136
- package/dist/index-DEC5JR_F.js +0 -60
- package/dist/index-Dan3tqoj.cjs +0 -1
- package/dist/index-WCOc4LNL.js +0 -16600
- package/dist/lexical-2rxs76dr.cjs +0 -41
- package/dist/lexical-C60GkwxR.js +0 -13122
- package/dist/lexical-code-DKIWiZdJ.js +0 -604
- package/dist/lexical-code-VafvPacU.cjs +0 -9
- package/dist/lexical-collab-1tX9tFVC.js +0 -1025
- package/dist/lexical-collab-Nk2LVpJv.cjs +0 -1
- package/dist/lexical-file-C52Mze5k.cjs +0 -1
- package/dist/lexical-file-DjHP4vVw.js +0 -43
- package/dist/lexical-markdown-BSl_ahWw.cjs +0 -12
- package/dist/lexical-markdown-DcEwQQba.js +0 -488
- package/dist/lodash-3PEMjFQT.cjs +0 -1
- package/dist/lodash-jftOdrxX.js +0 -711
- package/dist/stats.html +0 -4949
- package/dist/vendor-BrXDSyZX.js +0 -136433
- package/dist/vendor-Bt6Lma3y.cjs +0 -2469
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";var ge=Object.defineProperty;var _e=(t,e,n)=>e in t?ge(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n;var P=(t,e,n)=>_e(t,typeof e!="symbol"?e+"":e,n);const c=require("./lexical-2rxs76dr.cjs"),S=require("./collaboration-C7xVk0Zj.cjs"),E=require("react"),ye=require("react-dom"),z=require("react/jsx-runtime");function me(t){const e=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(t){for(const n in t)if(n!=="default"){const o=Object.getOwnPropertyDescriptor(t,n);Object.defineProperty(e,n,o.get?o:{enumerable:!0,get:()=>t[n]})}}return e.default=t,Object.freeze(e)}const xe=me(E);function N(t,...e){const n=new URL("https://lexical.dev/docs/error"),o=new URLSearchParams;o.append("code",t);for(const s of e)o.append("v",s);throw n.search=o.toString(),Error(`Minified Lexical error #${t}; visit ${n.toString()} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`)}function be(t,e,n){const o=t.length,s=e.length;let r=0,i=0;for(;r<o&&r<s&&t[r]===e[r]&&r<n;)r++;for(;i+r<o&&i+r<s&&t[o-i-1]===e[s-i-1];)i++;for(;i+r<o&&i+r<s&&t[r]===e[r];)r++;return{index:r,insert:e.slice(r,s-i),remove:o-r-i}}let F=class{constructor(e,n,o){P(this,"_xmlElem");P(this,"_key");P(this,"_parent");P(this,"_type");this._key="",this._xmlElem=e,this._parent=n,this._type=o}getPrevNode(e){if(e===null)return null;const n=e.get(this._key);return c.Ti(n)?n:null}getNode(){const e=c.xo(this._key);return c.Ti(e)?e:null}getSharedType(){return this._xmlElem}getType(){return this._type}getKey(){return this._key}getSize(){return 1}getOffset(){return this._parent.getChildOffset(this)}syncPropertiesFromLexical(e,n,o){const s=this.getPrevNode(o);U(e,this._xmlElem,s,n)}syncPropertiesFromYjs(e,n){const o=this.getNode();o===null&&N(83),X(e,this._xmlElem,o,n)}destroy(e){const n=e.collabNodeMap;n.get(this._key)===this&&n.delete(this._key)}};function se(t,e,n){const o=new F(t,e,n);return t._collabNode=o,o}class L{constructor(e,n){P(this,"_map");P(this,"_key");P(this,"_parent");P(this,"_type");this._key="",this._map=e,this._parent=n,this._type="linebreak"}getNode(){const e=c.xo(this._key);return c.jn(e)?e:null}getKey(){return this._key}getSharedType(){return this._map}getType(){return this._type}getSize(){return 1}getOffset(){return this._parent.getChildOffset(this)}destroy(e){const n=e.collabNodeMap;n.get(this._key)===this&&n.delete(this._key)}}function re(t,e){const n=new L(t,e);return t._collabNode=n,n}class O{constructor(e,n,o,s){P(this,"_map");P(this,"_key");P(this,"_parent");P(this,"_text");P(this,"_type");P(this,"_normalized");this._key="",this._map=e,this._parent=o,this._text=n,this._type=s,this._normalized=!1}getPrevNode(e){if(e===null)return null;const n=e.get(this._key);return c.lr(n)?n:null}getNode(){const e=c.xo(this._key);return c.lr(e)?e:null}getSharedType(){return this._map}getType(){return this._type}getKey(){return this._key}getSize(){return this._text.length+(this._normalized?0:1)}getOffset(){return this._parent.getChildOffset(this)}spliceText(e,n,o){const s=this._parent._xmlText,r=this.getOffset()+1+e;n!==0&&s.delete(r,n),o!==""&&s.insert(r,o)}syncPropertiesAndTextFromLexical(e,n,o){const s=this.getPrevNode(o),r=n.__text;if(U(e,this._map,s,n),s!==null){const i=s.__text;i!==r&&((function(l,a,h,d){const f=c.Lr();let u=d.length;if(c.yr(f)&&f.isCollapsed()){const m=f.anchor;m.key===a&&(u=m.offset)}const p=be(h,d,u);l.spliceText(p.index,p.remove,p.insert)})(this,n.__key,i,r),this._text=r)}}syncPropertiesAndTextFromYjs(e,n){const o=this.getNode();o===null&&N(84),X(e,this._map,o,n);const s=this._text;o.__text!==s&&o.setTextContent(s)}destroy(e){const n=e.collabNodeMap;n.get(this._key)===this&&n.delete(this._key)}}function ie(t,e,n,o){const s=new O(t,e,n,o);return t._collabNode=s,s}class M{constructor(e,n,o){P(this,"_key");P(this,"_children");P(this,"_xmlText");P(this,"_type");P(this,"_parent");this._key="",this._children=[],this._xmlText=e,this._type=o,this._parent=n}getPrevNode(e){if(e===null)return null;const n=e.get(this._key);return c.Si(n)?n:null}getNode(){const e=c.xo(this._key);return c.Si(e)?e:null}getSharedType(){return this._xmlText}getType(){return this._type}getKey(){return this._key}isEmpty(){return this._children.length===0}getSize(){return 1}getOffset(){const e=this._parent;return e===null&&N(90),e.getChildOffset(this)}syncPropertiesFromYjs(e,n){const o=this.getNode();o===null&&N(91),X(e,this._xmlText,o,n)}applyChildrenYjsDelta(e,n){const o=this._children;let s=0,r=null;for(let i=0;i<n.length;i++){const l=n[i],a=l.insert,h=l.delete;if(l.retain!=null)s+=l.retain;else if(typeof h=="number"){let d=h;for(;d>0;){const{node:f,nodeIndex:u,offset:p,length:m}=K(this,s,!1);if(f instanceof M||f instanceof L||f instanceof F)o.splice(u,1),d-=1;else{if(!(f instanceof O))break;{const g=Math.min(d,m),_=u!==0?o[u-1]:null,b=f.getSize();if(p===0&&m===b){o.splice(u,1);const x=j(f._text,p,g-1,"");x.length>0&&(_ instanceof O?_._text+=x:this._xmlText.delete(p,x.length))}else f._text=j(f._text,p,g,"");d-=g}}}}else{if(a==null)throw new Error("Unexpected delta format");if(typeof a=="string"){const{node:d,offset:f}=K(this,s,!0);d instanceof O?d._text=j(d._text,f,0,a):this._xmlText.delete(f,a.length),s+=a.length}else{const d=a,{node:f,nodeIndex:u,length:p}=K(this,s,!1),m=A(e,d,this);if(f instanceof O&&p>0&&p<f._text.length){const g=f._text,_=g.length-p;f._text=j(g,_,p,""),o.splice(u+1,0,m),r=j(g,0,_,"")}else o.splice(u,0,m);r!==null&&m instanceof O&&(m._text=r+m._text,r=null),s+=1}}}}syncChildrenFromYjs(e){const n=this.getNode();n===null&&N(92);const o=n.__key,s=c.a(n,null),r=s.length,i=this._children,l=i.length,a=e.collabNodeMap,h=new Set;let d,f,u=0,p=null;l!==r&&(f=n.getWritable());for(let m=0;m<l;m++){const g=s[u],_=i[m],b=_.getNode(),x=_._key;if(b!==null&&g===x){const y=c.lr(b);if(h.add(g),y)if(_._key=g,_ instanceof M){const C=_._xmlText;_.syncPropertiesFromYjs(e,null),_.applyChildrenYjsDelta(e,C.toDelta()),_.syncChildrenFromYjs(e)}else _ instanceof O?_.syncPropertiesAndTextFromYjs(e,null):_ instanceof F?_.syncPropertiesFromYjs(e,null):_ instanceof L||N(93);p=b,u++}else{if(d===void 0){d=new Set;for(let T=0;T<l;T++){const k=i[T]._key;k!==""&&d.add(k)}}if(b!==null&&g!==void 0&&!d.has(g)){const T=c.hs(g);c._o(T),m--,u++;continue}f=n.getWritable();const y=Pe(e,_,o),C=y.__key;if(a.set(C,_),p===null){const T=f.getFirstChild();if(f.__first=C,T!==null){const k=T.getWritable();k.__prev=C,y.__next=k.__key}}else{const T=p.getWritable(),k=p.getNextSibling();if(T.__next=C,y.__prev=p.__key,k!==null){const v=k.getWritable();v.__prev=C,y.__next=v.__key}}m===l-1&&(f.__last=C),f.__size++,p=y}}for(let m=0;m<r;m++){const g=s[m];if(!h.has(g)){const _=c.hs(g),b=e.collabNodeMap.get(g);b!==void 0&&b.destroy(e),c._o(_)}}}syncPropertiesFromLexical(e,n,o){U(e,this._xmlText,this.getPrevNode(o),n)}_syncChildFromLexical(e,n,o,s,r,i){const l=this._children[n],a=c.hs(o);l instanceof M&&c.Si(a)?(l.syncPropertiesFromLexical(e,a,s),l.syncChildrenFromLexical(e,a,s,r,i)):l instanceof O&&c.lr(a)?l.syncPropertiesAndTextFromLexical(e,a,s):l instanceof F&&c.Ti(a)&&l.syncPropertiesFromLexical(e,a,s)}syncChildrenFromLexical(e,n,o,s,r){const i=this.getPrevNode(o),l=i===null?[]:c.a(i,o),a=c.a(n,null),h=l.length-1,d=a.length-1,f=e.collabNodeMap;let u,p,m=0,g=0;for(;m<=h&&g<=d;){const x=l[m],y=a[g];if(x===y)this._syncChildFromLexical(e,g,y,o,s,r),m++,g++;else{u===void 0&&(u=new Set(l)),p===void 0&&(p=new Set(a));const C=p.has(x),T=u.has(y);if(C){const k=B(e,c.hs(y),this);f.set(y,k),T?(this.splice(e,g,1,k),m++,g++):(this.splice(e,g,0,k),g++)}else this.splice(e,g,1),m++}}const _=m>h,b=g>d;if(_&&!b)for(;g<=d;++g){const x=a[g],y=B(e,c.hs(x),this);this.append(y),f.set(x,y)}else if(b&&!_)for(let x=this._children.length-1;x>=g;x--)this.splice(e,x,1)}append(e){const n=this._xmlText,o=this._children,s=o[o.length-1],r=s!==void 0?s.getOffset()+s.getSize():0;if(e instanceof M)n.insertEmbed(r,e._xmlText);else if(e instanceof O){const i=e._map;i.parent===null&&n.insertEmbed(r,i),n.insert(r+1,e._text)}else e instanceof L?n.insertEmbed(r,e._map):e instanceof F&&n.insertEmbed(r,e._xmlElem);this._children.push(e)}splice(e,n,o,s){const r=this._children,i=r[n];if(i===void 0)return s===void 0&&N(94),void this.append(s);const l=i.getOffset();l===-1&&N(95);const a=this._xmlText;if(o!==0&&a.delete(l,i.getSize()),s instanceof M)a.insertEmbed(l,s._xmlText);else if(s instanceof O){const h=s._map;h.parent===null&&a.insertEmbed(l,h),a.insert(l+1,s._text)}else s instanceof L?a.insertEmbed(l,s._map):s instanceof F&&a.insertEmbed(l,s._xmlElem);if(o!==0){const h=r.slice(n,n+o);for(let d=0;d<h.length;d++)h[d].destroy(e)}s!==void 0?r.splice(n,o,s):r.splice(n,o)}getChildOffset(e){let n=0;const o=this._children;for(let s=0;s<o.length;s++){const r=o[s];if(r===e)return n;n+=r.getSize()}return-1}destroy(e){const n=e.collabNodeMap,o=this._children;for(let s=0;s<o.length;s++)o[s].destroy(e);n.get(this._key)===this&&n.delete(this._key)}}function I(t,e,n){const o=new M(t,e,n);return t._collabNode=o,o}function ke(t,e,n,o,s){n==null&&N(81);const r={clientID:n.clientID,cursors:new Map,cursorsContainer:null,doc:n,docMap:o,editor:t,excludedProperties:s||new Map,id:e,nodeProperties:new Map};return(function(i){const{editor:l,nodeProperties:a}=i;l.update(()=>{l._nodes.forEach(h=>{const d=new h.klass,f={};for(const[u,p]of Object.entries(d))le(u,d,i)||(f[u]=p);a.set(d.__type,Object.freeze(f))})})})(r),r}function Se(t,e,n,o,s,r){o==null&&N(81);const i=I(o.get("root",S.YXmlText),null,"root");return i._key="root",{...ke(t,n,o,s,r),collabNodeMap:new Map,root:i}}function $(t){return Object.hasOwn(t,"collabNodeMap")}const Ce=new Set(["__key","__parent","__next","__prev","__state"]),ve=new Set(["__first","__last","__size"]),Te=new Set(["__cachedText"]),Ee=new Set(["__text"]);function le(t,e,n){if(Ce.has(t)||typeof e[t]=="function")return!0;if(c.lr(e)){if(Ee.has(t))return!0}else if(c.Si(e)&&(ve.has(t)||c.bi(e)&&Te.has(t)))return!0;const o=e.constructor,s=n.excludedProperties.get(o);return s!=null&&s.has(t)}function Ne(t,e){const n=t.__type,{nodeProperties:o}=e,s=o.get(n);return s===void 0&&N(330,n),s}function B(t,e,n){const o=e.__type;let s;if(c.Si(e))s=I(new S.YXmlText,n,o),s.syncPropertiesFromLexical(t,e,null),s.syncChildrenFromLexical(t,e,null,null,null);else if(c.lr(e))s=ie(new S.YMap,e.__text,n,o),s.syncPropertiesAndTextFromLexical(t,e,null);else if(c.jn(e)){const r=new S.YMap;r.set("__type","linebreak"),s=re(r,n)}else c.Ti(e)?(s=se(new S.YXmlElement,n,o),s.syncPropertiesFromLexical(t,e,null)):N(86);return s._key=e.__key,s}function ce(t){const e=R(t,"__type");return typeof e!="string"&&e!==void 0&&N(87),e}function A(t,e,n){const o=e._collabNode;if(o===void 0){const s=t.editor._nodes,r=ce(e);typeof r!="string"&&N(87),s.get(r)===void 0&&N(88,r);const i=e.parent,l=n===void 0&&i!==null?A(t,i):n||null;if(l instanceof M||N(89),e instanceof S.YXmlText)return I(e,l,r);if(e instanceof S.YMap)return r==="linebreak"?re(e,l):ie(e,"",l,r);if(e instanceof S.YXmlElement)return se(e,l,r)}return o}function Pe(t,e,n){const o=e.getType(),s=t.editor._nodes.get(o);s===void 0&&N(88,o);const r=new s.klass;if(r.__parent=n,e._key=r.__key,e instanceof M){const i=e._xmlText;e.syncPropertiesFromYjs(t,null),e.applyChildrenYjsDelta(t,i.toDelta()),e.syncChildrenFromYjs(t)}else e instanceof O?e.syncPropertiesAndTextFromYjs(t,null):e instanceof F&&e.syncPropertiesFromYjs(t,null);return t.collabNodeMap.set(r.__key,e),r}function X(t,e,n,o){const s=o===null?e instanceof S.YMap?Array.from(e.keys()):e instanceof S.YXmlText||e instanceof S.YXmlElement?Object.keys(e.getAttributes()):Object.keys(e):Array.from(o);let r;for(let i=0;i<s.length;i++){const l=s[i];if(le(l,n,t)){l==="__state"&&$(t)&&(r||(r=n.getWritable()),we(e,r));continue}const a=n[l];let h=R(e,l);if(a!==h){if(h instanceof S.Doc){const d=t.docMap;a instanceof S.Doc&&d.delete(a.guid);const f=c.$i(),u=h.guid;f._key=u,d.set(u,h),h=f}r===void 0&&(r=n.getWritable()),r[l]=h}}}function R(t,e){return t instanceof S.YMap?t.get(e):t instanceof S.YXmlText||t instanceof S.YXmlElement?t.getAttribute(e):t[e]}function q(t,e,n){t instanceof S.YMap?t.set(e,n):t.setAttribute(e,n)}function we(t,e){const n=R(t,"__state");n instanceof S.YMap&&c.ft$1(e).updateFromJSON(n.toJSON())}function U(t,e,n,o){const s=Object.keys(Ne(o,t)),r=t.editor.constructor;(function(i,l,a,h){const d=h.__state,f=R(l,"__state");if(!d)return;const[u,p]=d.getInternalState(),m=a&&a.__state,g=f instanceof S.YMap?f:new S.YMap;if(m===d)return;const[_,b]=m&&g.doc?m.getInternalState():[void 0,new Map];if(u)for(const[x,y]of Object.entries(u))_&&y!==_[x]&&g.set(x,y);for(const[x,y]of p)b.get(x)!==y&&g.set(x.key,x.unparse(y));f||q(l,"__state",g)})(0,e,n,o);for(let i=0;i<s.length;i++){const l=s[i],a=n===null?void 0:n[l];let h=o[l];if(a!==h){if(h instanceof r){const d=t.docMap;let f;if(a instanceof r){const m=a._key;f=d.get(m),d.delete(m)}const u=f||new S.Doc,p=u.guid;h._key=p,d.set(p,u),h=u,t.editor.update(()=>{o.markDirty()})}q(e,l,h)}}}function j(t,e,n,o){return t.slice(0,e)+o+t.slice(e+n)}function K(t,e,n){let o=0,s=0;const r=t._children,i=r.length;for(;s<i;s++){const l=r[s],a=o;if(o+=l.getSize(),(n?o>=e:o>e)&&l instanceof O){let h=e-a-1;return h<0&&(h=0),{length:o-e,node:l,nodeIndex:s,offset:h}}if(o>e)return{length:0,node:l,nodeIndex:s,offset:a};if(s===i-1)return{length:0,node:null,nodeIndex:s+1,offset:a+1}}return{length:0,node:null,nodeIndex:0,offset:0}}function V(t){const e=t.anchor,n=t.focus;let o=!1;try{const s=e.getNode(),r=n.getNode();(!s.isAttached()||!r.isAttached()||c.lr(s)&&e.offset>s.getTextContentSize()||c.lr(r)&&n.offset>r.getTextContentSize())&&(o=!0)}catch{o=!0}return o}function Oe(t,e){t.doc.transact(e,t)}function ae(t,e){const n=e._nodeMap.get(t);if(!n)return void c.No().selectStart();const o=n.__prev;let s=null;o&&(s=c.xo(o)),s===null&&n.__parent!==null&&(s=c.xo(n.__parent)),s!==null?s!==null&&s.isAttached()?s.selectEnd():ae(s.__key,e):c.No().selectStart()}c.ot("ychange",{isEqual:(t,e)=>t===e,parse:t=>t??null});function G(t,e){const n=e.collabNodeMap.get(t.key);if(n===void 0)return null;let o=t.offset,s=n.getSharedType();if(n instanceof O){s=n._parent._xmlText;const r=n.getOffset();if(r===-1)return null;o=r+1+o}else if(n instanceof M&&t.type==="element"){const r=t.getNode();c.Si(r)||N(184);let i=0,l=0,a=r.getFirstChild();for(;a!==null&&l++<o;)c.lr(a)?i+=a.getTextContentSize()+1:i++,a=a.getNextSibling();o=i}return S.createRelativePositionFromTypeIndex(s,o)}function J(t,e){const{mapping:n}=e,{offset:o}=t,s=t.getNode(),r=n.getSharedType(s);if(r===void 0)return null;if(t.type==="text"){c.lr(s)||N(326);let i=s.getPreviousSibling(),l=o;for(;c.lr(i);)l+=i.getTextContentSize(),i=i.getPreviousSibling();return S.createRelativePositionFromTypeIndex(r,l)}if(t.type==="element"){c.Si(s)||N(184);let i=0,l=s.getFirstChild();for(;l!==null&&i<o;){if(c.lr(l)){let a=l.getNextSibling();for(;c.lr(a);)a=a.getNextSibling()}i++,l=l.getNextSibling()}return S.createRelativePositionFromTypeIndex(r,i)}return null}function Q(t,e){return S.createAbsolutePositionFromRelativePosition(t,e.doc)}function H(t,e){if(t==null){if(e!=null)return!0}else if(e==null||!S.compareRelativePositions(t,e))return!0;return!1}function Me(t,e){return{color:e,name:t,selection:null}}function fe(t,e){const n=t.cursorsContainer;if(n!==null){const o=e.selections,s=o.length;for(let r=0;r<s;r++)n.removeChild(o[r])}}function Ye(t,e){const n=e.selection;n!==null&&fe(t,n)}function Fe(t,e,n,o,s){const r=t.color,i=document.createElement("span");i.style.cssText=`position:absolute;top:0;bottom:0;right:-1px;width:1px;background-color:${r};z-index:10;`;const l=document.createElement("span");return l.textContent=t.name,l.style.cssText=`position:absolute;left:-2px;top:-16px;background-color:${r};color:#fff;line-height:12px;font-size:12px;padding:2px;font-family:Arial;font-weight:bold;white-space:nowrap;`,i.appendChild(l),{anchor:{key:e,offset:n},caret:i,color:r,focus:{key:o,offset:s},name:l,selections:[]}}function je(t,e,n,o){const s=t.editor,r=s.getRootElement(),i=t.cursorsContainer;if(i===null||r===null)return;const l=i.offsetParent;if(l===null)return;const a=l.getBoundingClientRect(),h=e.selection;if(n===null)return h===null?void 0:(e.selection=null,void fe(t,h));e.selection=n;const d=n.caret,f=n.color,u=n.selections,p=n.anchor,m=n.focus,g=p.key,_=m.key,b=o.get(g),x=o.get(_);if(b==null||x==null)return;let y;if(b===x&&c.jn(b))y=[s.getElementByKey(g).getBoundingClientRect()];else{const k=c.I(s,b,p.offset,x,m.offset);if(k===null)return;y=c.B(s,k)}const C=u.length,T=y.length;for(let k=0;k<T;k++){const v=y[k];let w=u[k];if(w===void 0){w=document.createElement("span"),u[k]=w;const D=document.createElement("span");w.appendChild(D),i.appendChild(w)}const Y=`position:absolute;top:${v.top-a.top}px;left:${v.left-a.left}px;height:${v.height}px;width:${v.width}px;pointer-events:none;z-index:5;`;w.style.cssText=Y,w.firstChild.style.cssText=`${Y}left:0;top:0;background-color:${f};opacity:0.3;`,k===T-1&&d.parentNode!==w&&w.appendChild(d)}for(let k=C-1;k>=T;k--){const v=u[k];i.removeChild(v),u.pop()}}function ue(t,e){const{anchorPos:n,focusPos:o}=e,s=n?Q(n,t):null,r=o?Q(o,t):null;if(s===null||r===null)return{anchorKey:null,anchorOffset:0,focusKey:null,focusOffset:0};if($(t)){const[d,f]=te(s.type,s.index),[u,p]=te(r.type,r.index);return{anchorKey:d!==null?d.getKey():null,anchorOffset:f,focusKey:u!==null?u.getKey():null,focusOffset:p}}let[i,l]=ne(t.mapping,s),[a,h]=ne(t.mapping,r);if(a&&i&&(a!==i||h!==l)){const d=a.isBefore(i),f=d?a:i,u=d?h:l;c.lr(f)&&c.lr(f.getNextSibling())&&u===f.getTextContentSize()&&(d?(a=f.getNextSibling(),h=0):(i=f.getNextSibling(),l=0))}return{anchorKey:i!==null?i.getKey():null,anchorOffset:l,focusKey:a!==null?a.getKey():null,focusOffset:h}}function Z(t,e){const n=e.awareness.getLocalState();if(n===null)return;const{anchorKey:o,anchorOffset:s,focusKey:r,focusOffset:i}=ue(t,n);if(o!==null&&r!==null){const l=c.Lr();if(!c.yr(l))return;ee(l.anchor,o,s),ee(l.focus,r,i)}}function ee(t,e,n){if(t.key!==e||t.offset!==n){let o=c.xo(e);if(o!==null&&!c.Si(o)&&!c.lr(o)){const s=o.getParentOrThrow();e=s.getKey(),n=o.getIndexWithinParent(),o=s}t.set(e,n,c.Si(o)?"element":"text")}}function te(t,e){const n=t._collabNode;if(n===void 0)return[null,0];if(n instanceof M){const{node:o,offset:s}=K(n,e,!0);return o===null?[n,0]:[o,s]}return[null,0]}function ne(t,e){const n=e.type,o=e.index;if(n instanceof S.YXmlElement){const s=t.get(n);if(s===void 0)return[null,0];if(!c.Si(s))return[s,o];let r=o,i=0;const l=s.getChildren();for(;r>0&&i<l.length;){const a=l[i];if(r-=1,i+=1,c.lr(a))for(;i<l.length&&c.lr(l[i]);)i+=1}return[s,i]}{const s=t.get(n);if(s===void 0)return[null,0];let r=0,i=o;for(;i>s[r].getTextContentSize()&&r+1<s.length;)i-=s[r].getTextContentSize(),r++;const l=s[r];return[l,Math.min(i,l.getTextContentSize())]}}function Le(t,e){return e.awareness.getStates()}function W(t,e,n){const{getAwarenessStates:o=Le}=n??{},s=Array.from(o(t,e)),r=t.clientID,i=t.cursors,l=t.editor,a=l._editorState._nodeMap,h=new Set;for(let f=0;f<s.length;f++){const u=s[f],[p,m]=u;if(p!==0&&p!==r){h.add(p);const{name:g,color:_,focusing:b}=m;let x=null,y=i.get(p);if(y===void 0&&(y=Me(g,_),i.set(p,y)),b){const{anchorKey:C,anchorOffset:T,focusKey:k,focusOffset:v}=l.read(()=>ue(t,m));if(C!==null&&k!==null)if(x=y.selection,x===null)x=Fe(y,C,T,k,v);else{const w=x.anchor,Y=x.focus;w.key=C,w.offset=T,Y.key=k,Y.offset=v}}je(t,y,x,a)}}const d=Array.from(i.keys());for(let f=0;f<d.length;f++){const u=d[f];if(!h.has(u)){const p=i.get(u);p!==void 0&&(Ye(t,p),i.delete(u))}}}function de(t,e,n,o){const s=e.awareness,r=s.getLocalState();if(r===null)return;const{anchorPos:i,focusPos:l,name:a,color:h,focusing:d,awarenessData:f}=r;let u=null,p=null;(o!==null&&(i===null||o.is(n))||n!==null)&&(c.yr(o)&&($(t)?(u=G(o.anchor,t),p=G(o.focus,t)):(u=J(o.anchor,t),p=J(o.focus,t))),(H(i,u)||H(l,p))&&s.setLocalState({...r,anchorPos:u,awarenessData:f,color:h,focusPos:p,focusing:d,name:a}))}function De(t,e){if(e instanceof S.YMapEvent&&(function(s,r){const{target:i}=r;if(!i._item||i._item.parentSub!=="__state"||ce(i)!==void 0||!(i.parent instanceof S.YXmlText||i.parent instanceof S.YXmlElement||i.parent instanceof S.YMap))return!1;const l=A(s,i.parent).getNode();if(l){const a=c.ft$1(l.getWritable());for(const h of r.keysChanged)a.updateFromUnknown(h,i.get(h))}return!0})(t,e))return;const{target:n}=e,o=A(t,n);if(o instanceof M&&e instanceof S.YTextEvent){const{keysChanged:s,childListChanged:r,delta:i}=e;s.size>0&&o.syncPropertiesFromYjs(t,s),r&&(o.applyChildrenYjsDelta(t,i),o.syncChildrenFromYjs(t))}else if(o instanceof O&&e instanceof S.YMapEvent){const{keysChanged:s}=e;s.size>0&&o.syncPropertiesAndTextFromYjs(t,s)}else if(o instanceof F&&e instanceof S.YXmlEvent){const{attributesChanged:s}=e;s.size>0&&o.syncPropertiesFromYjs(t,s)}else N(82)}function ze(t,e,n,o,s=W){const r=t.editor,i=r._editorState;n.forEach(l=>l.delta),r.update(()=>{for(let l=0;l<n.length;l++){const a=n[l];De(t,a)}Ke(i,t,e),o||c.ns(c.Kn)},{onUpdate:()=>{s(t,e),r.update(()=>Ae())},skipTransforms:!0,tag:o?c.An:c.Ln})}function Ke(t,e,n){const o=c.Lr();if(c.yr(o))if(V(o)){const s=t._selection;c.yr(s)&&(Z(e,n),V(o))&&ae(o.anchor.key,t),de(e,n,s,c.Lr())}else Z(e,n)}function Ae(){c.No().getChildrenSize()===0&&c.No().append(c.Li())}function Re(t,e,n,o,s,r,i,l){Oe(t,()=>{o.read(()=>{if(l.has(c.Ln)||l.has(c.An))return void(i.size>0&&(function(d,f){const u=Array.from(f),p=d.collabNodeMap,m=[],g=[];for(let _=0;_<u.length;_++){const b=u[_],x=c.xo(b),y=p.get(b);if(y instanceof O)if(c.lr(x))m.push([y,x.__text]);else{const C=y.getOffset();if(C===-1)continue;const T=y._parent;y._normalized=!0,T._xmlText.delete(C,1),g.push(y)}}for(let _=0;_<g.length;_++){const b=g[_],x=b.getKey();p.delete(x);const y=b._parent._children,C=y.indexOf(b);y.splice(C,1)}for(let _=0;_<m.length;_++){const[b,x]=m[_];b._text=x}})(t,i));if(s.has("root")){const d=n._nodeMap,f=c.No(),u=t.root;u.syncPropertiesFromLexical(t,f,d),u.syncChildrenFromLexical(t,f,d,s,r)}const a=c.Lr(),h=n._selection;de(t,e,h,a)})})}const he=c.re("CONNECTED_COMMAND"),pe=c.re("TOGGLE_CONNECT_COMMAND");function Ie(t,e){return new S.UndoManager(e,{trackedOrigins:new Set([t,null])})}function $e(t,e,n,o,s){t.awareness.setLocalState({anchorPos:null,awarenessData:s,color:n,focusPos:null,focusing:o,name:e})}function oe(t,e,n,o,s){const{awareness:r}=t;let i=r.getLocalState();i===null&&(i={anchorPos:null,awarenessData:s,color:n,focusPos:null,focusing:o,name:e}),i.focusing=o,r.setLocalState(i)}function Xe(t,e,n,o,s,r,i,l,a,h,d,f,u=W){const p=E.useRef(!1),m=E.useCallback(()=>{const{root:g}=l;i&&g.isEmpty()&&g._xmlText._length===0&&Ge(t,d)},[l,t,d,i]);return E.useEffect(()=>{const{root:g}=l,_=(x,y)=>{const C=y.origin;C!==l&&ze(l,n,x,C instanceof S.UndoManager,u)};g.getSharedType().observeDeep(_);const b=t.registerUpdateListener(({prevEditorState:x,editorState:y,dirtyLeaves:C,dirtyElements:T,normalizedNodes:k,tags:v})=>{v.has(c.In)||Re(l,n,x,y,T,C,k,v)});return()=>{g.getSharedType().unobserveDeep(_),b()}},[l,n,t,a,o,e,u]),E.useEffect(()=>{const g=b=>{(function(x,y){if(x.update(()=>{const v=c.No();v.clear(),v.select()},{tag:c.In}),y.cursors==null)return;const C=y.cursors;if(C==null)return;const T=y.cursorsContainer;if(T==null)return;const k=Array.from(C.values());for(let v=0;v<k.length;v++){const w=k[v].selection;if(w&&w.selections!=null){const Y=w.selections;for(let D=0;D<Y.length;D++)T.removeChild(Y[v])}}})(t,l),a(b),o.set(e,b),p.current=!0},_=()=>{p.current=!1};return n.on("reload",g),n.on("sync",_),()=>{n.off("reload",g),n.off("sync",_)}},[l,n,t,a,o,e]),Ue(t,n,s,r,p,f,m),We(l,n),Be(l,h)}function Ue(t,e,n,o,s,r,i){const l=E.useCallback(()=>e.connect(),[e]),a=E.useCallback(()=>{try{e.disconnect()}catch{}},[e]);E.useEffect(()=>{const h=({status:u})=>{t.dispatchCommand(he,u==="connected")},d=u=>{u&&s.current===!1&&i&&i()};$e(e,n,o,document.activeElement===t.getRootElement(),r||{}),e.on("status",h),e.on("sync",d);const f=l();return()=>{s.current===!1&&(f?f.then(a):a()),e.off("sync",d),e.off("status",h)}},[t,e,n,o,s,r,i,l,a]),E.useEffect(()=>t.registerCommand(pe,h=>(h?(console.log("Collaboration connected!"),l()):(console.log("Collaboration disconnected!"),a()),!0),c.Ki),[l,a,t])}function We(t,e){E.useEffect(()=>{const{awareness:n}=e,o=()=>{W(t,e)};return n.on("update",o),()=>{n.off("update",o)}},[t,e])}function Be(t,e){return E.useMemo(()=>ye.createPortal(z.jsx("div",{ref:n=>{t.cursorsContainer=n}}),e&&e.current||document.body),[t,e])}function qe(t,e,n,o,s){E.useEffect(()=>c.U(t.registerCommand(c.Ve,()=>(oe(e,n,o,!0,s||{}),!1),c.Ki),t.registerCommand(c.Ye,()=>(oe(e,n,o,!1,s||{}),!1),c.Ki)),[o,t,n,e,s])}function Ve(t,e){E.useEffect(()=>c.U(t.registerCommand(c.pe,()=>(e.undo(),!0),c.Ki),t.registerCommand(c.ye,()=>(e.redo(),!0),c.Ki)));const n=E.useCallback(()=>{e.clear()},[e]);return xe.useEffect(()=>{const o=()=>{t.dispatchCommand(c.Ue,e.undoStack.length>0),t.dispatchCommand(c.$e,e.redoStack.length>0)};return e.on("stack-item-added",o),e.on("stack-item-popped",o),e.on("stack-cleared",o),()=>{e.off("stack-item-added",o),e.off("stack-item-popped",o),e.off("stack-cleared",o)}},[t,e]),n}function Ge(t,e){t.update(()=>{const n=c.No();if(n.isEmpty())if(e)switch(typeof e){case"string":{const o=t.parseEditorState(e);t.setEditorState(o,{tag:c.Dn});break}case"object":t.setEditorState(e,{tag:c.Dn});break;case"function":t.update(()=>{c.No().isEmpty()&&e(t)},{tag:c.Dn})}else{const o=c.Li();n.append(o);const{activeElement:s}=document;(c.Lr()!==null||s!==null&&s===t.getRootElement())&&o.select()}},{tag:c.Dn})}function Je({id:t,providerFactory:e,shouldBootstrap:n,username:o,cursorColor:s,cursorsContainerRef:r,initialEditorState:i,excludedProperties:l,awarenessData:a,syncCursorPositionsFn:h}){const d=E.useRef(!1),f=E.useRef(!1),u=c.b(o,s),{yjsDocMap:p,name:m,color:g}=u,[_]=c.o();He(u,_);const[b,x]=E.useState(),[y,C]=E.useState();E.useEffect(()=>{if(f.current)return;f.current=!0;const v=e(t,p);return x(v),C(p.get(t)),()=>{v.disconnect()}},[t,e,p]);const[T,k]=E.useState();return E.useEffect(()=>{if(!b||d.current)return;d.current=!0;const v=Se(_,b,t,y||p.get(t),p,l);return k(v),()=>{v.root.destroy(v)}},[_,b,t,p,y,l]),b&&T?z.jsx(Qe,{awarenessData:a,binding:T,collabContext:u,color:g,cursorsContainerRef:r,editor:_,id:t,initialEditorState:i,name:m,provider:b,setDoc:C,shouldBootstrap:n,yjsDocMap:p,syncCursorPositionsFn:h}):z.jsx(z.Fragment,{})}function Qe({editor:t,id:e,provider:n,yjsDocMap:o,name:s,color:r,shouldBootstrap:i,cursorsContainerRef:l,initialEditorState:a,awarenessData:h,collabContext:d,binding:f,setDoc:u,syncCursorPositionsFn:p}){const m=Xe(t,e,n,o,s,r,i,f,u,l,a,h,p);return(function(g,_){Ve(g,E.useMemo(()=>Ie(_,_.root.getSharedType()),[_]))})(t,f),qe(t,n,s,r,h),m}const He=(t,e)=>{E.useEffect(()=>(t.isCollabActive=!0,()=>{e._parentEditor==null&&(t.isCollabActive=!1)}),[t,e])};exports.Kt=pe;exports.Ot=he;exports.V=Je;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const f=require("./lexical-2rxs76dr.cjs");function s(t,e=Object.freeze({})){return{editorState:t.toJSON(),lastSaved:e.lastSaved||Date.now(),source:e.source||"Lexical",version:"0.38.2"}}function u(t,e){const o=typeof e=="string"?JSON.parse(e):e;return t.parseEditorState(o.editorState)}function S(t){(function(e){const o=document.createElement("input");o.type="file",o.accept=".lexical",o.addEventListener("change",c=>{const r=c.target;if(r.files){const n=r.files[0],i=new FileReader;i.readAsText(n,"UTF-8"),i.onload=a=>{if(a.target){const l=a.target.result;e(l)}}}}),o.click()})(e=>{t.setEditorState(u(t,e)),t.dispatchCommand(f.je,void 0)})}function m(t,e=Object.freeze({})){const o=new Date;(function(c,r){const n=document.createElement("a"),i=document.body;if(i===null)return;i.appendChild(n),n.style.display="none";const a=JSON.stringify(c),l=new Blob([a],{type:"octet/stream"}),d=window.URL.createObjectURL(l);n.href=d,n.download=r,n.click(),window.URL.revokeObjectURL(d),n.remove()})(s(t.getEditorState(),{...e,lastSaved:o.getTime()}),`${e.fileName||o.toISOString()}.lexical`)}exports.editorStateFromSerializedDocument=u;exports.exportFile=m;exports.importFile=S;exports.serializedDocumentFromEditorState=s;
|
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
import { ab as l } from "./lexical-C60GkwxR.js";
|
|
2
|
-
function f(t, e = Object.freeze({})) {
|
|
3
|
-
return { editorState: t.toJSON(), lastSaved: e.lastSaved || Date.now(), source: e.source || "Lexical", version: "0.38.2" };
|
|
4
|
-
}
|
|
5
|
-
function u(t, e) {
|
|
6
|
-
const o = typeof e == "string" ? JSON.parse(e) : e;
|
|
7
|
-
return t.parseEditorState(o.editorState);
|
|
8
|
-
}
|
|
9
|
-
function S(t) {
|
|
10
|
-
(function(e) {
|
|
11
|
-
const o = document.createElement("input");
|
|
12
|
-
o.type = "file", o.accept = ".lexical", o.addEventListener("change", (c) => {
|
|
13
|
-
const a = c.target;
|
|
14
|
-
if (a.files) {
|
|
15
|
-
const n = a.files[0], i = new FileReader();
|
|
16
|
-
i.readAsText(n, "UTF-8"), i.onload = (r) => {
|
|
17
|
-
if (r.target) {
|
|
18
|
-
const s = r.target.result;
|
|
19
|
-
e(s);
|
|
20
|
-
}
|
|
21
|
-
};
|
|
22
|
-
}
|
|
23
|
-
}), o.click();
|
|
24
|
-
})((e) => {
|
|
25
|
-
t.setEditorState(u(t, e)), t.dispatchCommand(l, void 0);
|
|
26
|
-
});
|
|
27
|
-
}
|
|
28
|
-
function p(t, e = Object.freeze({})) {
|
|
29
|
-
const o = /* @__PURE__ */ new Date();
|
|
30
|
-
(function(c, a) {
|
|
31
|
-
const n = document.createElement("a"), i = document.body;
|
|
32
|
-
if (i === null) return;
|
|
33
|
-
i.appendChild(n), n.style.display = "none";
|
|
34
|
-
const r = JSON.stringify(c), s = new Blob([r], { type: "octet/stream" }), d = window.URL.createObjectURL(s);
|
|
35
|
-
n.href = d, n.download = a, n.click(), window.URL.revokeObjectURL(d), n.remove();
|
|
36
|
-
})(f(t.getEditorState(), { ...e, lastSaved: o.getTime() }), `${e.fileName || o.toISOString()}.lexical`);
|
|
37
|
-
}
|
|
38
|
-
export {
|
|
39
|
-
u as editorStateFromSerializedDocument,
|
|
40
|
-
p as exportFile,
|
|
41
|
-
S as importFile,
|
|
42
|
-
f as serializedDocumentFromEditorState
|
|
43
|
-
};
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const a=require("./lexical-2rxs76dr.cjs"),N=require("./lexical-code-VafvPacU.cjs");function B(t,e){const o={};for(const i of t){const r=e(i);r&&(o[r]?o[r].push(i):o[r]=[i])}return o}function z(t){const e=B(t,o=>o.type);return{element:e.element||[],multilineElement:e["multiline-element"]||[],textFormat:e["text-format"]||[],textMatch:e["text-match"]||[]}}const M=/[!-/:-@[-`{-~\s]/,Nt=/^\s{0,3}$/;function U(t){if(!a.Ii(t))return!1;const e=t.getFirstChild();return e==null||t.getChildrenSize()===1&&a.lr(e)&&Nt.test(e.getTextContent())}function bt(t,e,o,i){for(const r of e){if(!r.export)continue;const p=r.export(t,s=>w(s,o,i));if(p!=null)return p}return a.Si(t)?w(t,o,i):a.Ti(t)?t.getTextContent():null}function w(t,e,o,i,r){const p=[],s=t.getChildren();i||(i=[]),r||(r=[]);t:for(const u of s){for(const d of o){if(!d.export)continue;const l=d.export(u,n=>w(n,e,o,i,[...r,...i]),(n,f)=>J(n,f,e,i,r));if(l!=null){p.push(l);continue t}}a.jn(u)?p.push(`
|
|
2
|
-
`):a.lr(u)?p.push(J(u,u.getTextContent(),e,i,r)):a.Si(u)?p.push(w(u,e,o,i,r)):a.Ti(u)&&p.push(u.getTextContent())}return p.join("")}function J(t,e,o,i,r){let p=t.getFormat()===0?e:(function(c){return c.replace(/^\s+|\s+$/g,g=>[...g].map(h=>"&#"+h.codePointAt(0)+";").join(""))})(e);t.hasFormat("code")||(p=p.replace(/([*_`~\\])/g,"\\$1"));let s="",u="",d="";const l=Q(t,!0),n=Q(t,!1),f=new Set;for(const c of o){const g=c.format[0],h=c.tag;A(t,g)&&!f.has(g)&&(f.add(g),A(l,g)&&i.find(m=>m.tag===h)||(i.push({format:g,tag:h}),s+=h))}for(let c=0;c<i.length;c++){const g=A(t,i[c].format),h=A(n,i[c].format);if(g&&h)continue;const m=[...i];for(;m.length>c;){const x=m.pop();r&&x&&r.find(E=>E.tag===x.tag)||(x&&typeof x.tag=="string"&&(g?h||(d+=x.tag):u+=x.tag),i.pop())}break}return p=s+p+d,u+p}function Q(t,e){let o=e?t.getPreviousSibling():t.getNextSibling();if(!o){const i=t.getParentOrThrow();i.isInline()&&(o=e?i.getPreviousSibling():i.getNextSibling())}for(;o;){if(a.Si(o)){if(!o.isInline())break;const i=e?o.getLastDescendant():o.getFirstDescendant();if(a.lr(i))return i;o=e?o.getPreviousSibling():o.getNextSibling()}if(a.lr(o))return o;if(!a.Si(o))return null}return null}function A(t,e){return a.lr(t)&&t.hasFormat(e)}function _t(t,e){const o=(function(r,p){const s=r.match(p.openTagsRegExp);if(s==null)return null;for(const u of s){const d=u.replace(/^\s/,""),l=p.fullMatchRegExpByTag[d];if(l==null)continue;const n=r.match(l),f=p.transformersByTag[d];if(n!=null&&f!=null){if(f.intraword!==!1)return n;const{index:c=0}=n,g=r[c-1],h=r[c+n[0].length];if((!g||M.test(g))&&(!h||M.test(h)))return n}}return null})(t.getTextContent(),e);if(!o)return null;const i=o.index||0;return{endIndex:i+o[0].length,match:o,startIndex:i,transformer:e.transformersByTag[o[1]]}}function b(t){return a.lr(t)&&!t.hasFormat("code")}function _(t,e,o){let i=_t(t,e),r=(function(s,u){const d=s;let l,n,f,c;for(const g of u){if(!g.replace||!g.importRegExp)continue;const h=d.getTextContent().match(g.importRegExp);if(!h)continue;const m=h.index||0,x=g.getEndIndex?g.getEndIndex(d,h):m+h[0].length;x!==!1&&(l===void 0||n===void 0||m<l&&(x>n||x<=l))&&(l=m,n=x,f=g,c=h)}return l===void 0||n===void 0||f===void 0||c===void 0?null:{endIndex:n,match:c,startIndex:l,transformer:f}})(t,o);if(i&&r&&(i.startIndex<=r.startIndex&&i.endIndex>=r.endIndex||r.startIndex>i.endIndex?r=null:i=null),i){const s=(function(u,d,l,n,f){const c=u.getTextContent();let g,h,m;if(f[0]===c?g=u:d===0?[g,h]=u.splitText(l):[m,g,h]=u.splitText(d,l),g.setTextContent(f[2]),n)for(const x of n.format)g.hasFormat(x)||g.toggleFormat(x);return{nodeAfter:h,nodeBefore:m,transformedNode:g}})(t,i.startIndex,i.endIndex,i.transformer,i.match);b(s.nodeAfter)&&_(s.nodeAfter,e,o),b(s.nodeBefore)&&_(s.nodeBefore,e,o),b(s.transformedNode)&&_(s.transformedNode,e,o)}else if(r){const s=(function(u,d,l,n,f){let c,g,h;return d===0?[c,g]=u.splitText(l):[h,c,g]=u.splitText(d,l),n.replace?{nodeAfter:g,nodeBefore:h,transformedNode:n.replace(c,f)||void 0}:null})(t,r.startIndex,r.endIndex,r.transformer,r.match);if(!s)return;b(s.nodeAfter)&&_(s.nodeAfter,e,o),b(s.nodeBefore)&&_(s.nodeBefore,e,o),b(s.transformedNode)&&_(s.transformedNode,e,o)}const p=t.getTextContent().replace(/\\([*_`~\\])/g,"$1").replace(/&#(\d+);/g,(s,u)=>String.fromCodePoint(u));t.setTextContent(p)}function Ft(t,e=!1){const o=z(t),i=(function(r){const p={},s={},u=[],d="(?<![\\\\])";for(const l of r){const{tag:n}=l;p[n]=l;const f=n.replace(/(\*|\^|\+)/g,"\\$1");u.push(f),n.length===1?s[n]=n==="`"?new RegExp("(?<![\\\\`])(`)((?:\\\\`|[^`])+?)(`)(?!`)"):new RegExp(`(?<![\\\\${f}])(${f})((\\\\${f})?.*?[^${f}\\s](\\\\${f})?)((?<!\\\\)|(?<=\\\\\\\\))(${f})(?![\\\\${f}])`):s[n]=new RegExp(`(?<!\\\\)(${f})((\\\\${f})?.*?[^\\s](\\\\${f})?)((?<!\\\\)|(?<=\\\\\\\\))(${f})(?!\\\\)`)}return{fullMatchRegExpByTag:s,openTagsRegExp:new RegExp(`${d}(${u.join("|")})`,"g"),transformersByTag:p}})(o.textFormat);return(r,p)=>{const s=r.split(`
|
|
3
|
-
`),u=s.length,d=p||a.No();d.clear();for(let n=0;n<u;n++){const f=s[n],[c,g]=At(s,n,o.multilineElement,d);c?n=g:Mt(f,d,o.element,i,o.textMatch,e)}const l=d.getChildren();for(const n of l)!e&&U(n)&&d.getChildrenSize()>1&&n.remove();a.Lr()!==null&&d.selectStart()}}function At(t,e,o,i){for(const r of o){const{handleImportAfterStartMatch:p,regExpEnd:s,regExpStart:u,replace:d}=r,l=t[e].match(u);if(!l)continue;if(p){const h=p({lines:t,rootNode:i,startLineIndex:e,startMatch:l,transformer:r});if(h===null)continue;if(h)return h}const n=typeof s=="object"&&"regExp"in s?s.regExp:s,f=s&&typeof s=="object"&&"optional"in s?s.optional:!s;let c=e;const g=t.length;for(;c<g;){const h=n?t[c].match(n):null;if(!h&&(!f||f&&c<g-1)){c++;continue}if(h&&e===c&&h.index===l.index){c++;continue}const m=[];if(h&&e===c)m.push(t[e].slice(l[0].length,-h[0].length));else for(let x=e;x<=c;x++)if(x===e){const E=t[x].slice(l[0].length);m.push(E)}else if(x===c&&h){const E=t[x].slice(0,-h[0].length);m.push(E)}else m.push(t[x]);if(d(i,null,l,h,m,!0)!==!1)return[!0,c];break}}return[!1,e]}function Mt(t,e,o,i,r,p){const s=a.sr(t),u=a.Li();u.append(s),e.append(u);for(const{regExp:d,replace:l}of o){const n=t.match(d);if(n&&(s.setTextContent(t.slice(n[0].length)),l(u,[s],n,!0)!==!1))break}if(_(s,i,r),u.isAttached()&&t.length>0){const d=u.getPreviousSibling();if(!p&&(a.Ii(d)||a.Ot(d)||a.dt(d))){let l=d;if(a.dt(d)){const n=d.getLastDescendant();l=n==null?null:a.zs(n,a.ot$1)}l!=null&&l.getTextContentSize()>0&&(l.splice(l.getChildrenSize(),0,[a.Jn(),...u.getChildren()]),u.remove())}}}function wt(t,...e){const o=new URL("https://lexical.dev/docs/error"),i=new URLSearchParams;i.append("code",t);for(const r of e)i.append("v",r);throw o.search=i.toString(),Error(`Minified Lexical error #${t}; visit ${o.toString()} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`)}const et=/^(\s*)(\d{1,})\.\s/,nt=/^(\s*)[-*+]\s/,rt=/^(\s*)(?:[-*+]\s)?\s?(\[(\s|x)?\])\s/i,P=/^(#{1,6})\s/,ot=/^>\s/,st=/^[ \t]*```([\w-]+)?/,j=/[ \t]*```$/,Ot=/^[ \t]*```[^`]+(?:(?:`{1,2}|`{4,})[^`]+)*```(?:[^`]|$)/,Dt=/^(?:\|)(.+)(?:\|)\s?$/,kt=/^(\| ?:?-*:? ?)+\|\s?$/,V=/^<[a-z_][\w-]*(?:\s[^<>]*)?\/?>/i,Y=/^<\/[a-z_][\w-]*\s*>/i,Z=t=>new RegExp(`(?:${t.source})$`,t.flags),F=a.ot("mdListMarker",{parse:t=>typeof t=="string"&&/^[-*+]$/.test(t)?t:"-"}),it=t=>(e,o,i,r)=>{const p=t(i);p.append(...o),e.replace(p),r||p.select(0,0)},H=t=>(e,o,i,r)=>{const p=e.getPreviousSibling(),s=e.getNextSibling(),u=a.st(t==="check"?i[3]==="x":void 0),d=i[0].trim()[0],l=t!=="bullet"&&t!=="check"||d!==F.parse(d)?void 0:d;if(a.dt(s)&&s.getListType()===t){l&&a.ct(s,F,l);const f=s.getFirstChild();f!==null?f.insertBefore(u):s.append(u),e.remove()}else if(a.dt(p)&&p.getListType()===t)l&&a.ct(p,F,l),p.append(u),e.remove();else{const f=a.ht(t,t==="number"?Number(i[2]):void 0);l&&a.ct(f,F,l),f.append(u),e.replace(f)}u.append(...o),r||u.select(0,0);const n=(function(f){const c=f.match(/\t/g),g=f.match(/ /g);let h=0;return c&&(h+=c.length),g&&(h+=Math.floor(g.length/4)),h})(i[1]);n&&u.setIndent(n)},O=(t,e,o)=>{const i=[],r=t.getChildren();let p=0;for(const s of r)if(a.ot$1(s)){if(s.getChildrenSize()===1){const f=s.getFirstChild();if(a.dt(f)){i.push(O(f,e,o+1));continue}}const u=" ".repeat(4*o),d=t.getListType(),l=a.st$1(t,F),n=d==="number"?`${t.getStart()+p}. `:d==="check"?`${l} [${s.getChecked()?"x":" "}] `:l+" ";i.push(u+n+e(s)),p++}return i.join(`
|
|
4
|
-
`)},lt={dependencies:[a.Pt],export:(t,e)=>{if(!a.It(t))return null;const o=Number(t.getTag().slice(1));return"#".repeat(o)+" "+e(t)},regExp:P,replace:it(t=>{const e="h"+t[1].length;return a.St(e)}),type:"element"},ct={dependencies:[a.Et],export:(t,e)=>{if(!a.Ot(t))return null;const o=e(t).split(`
|
|
5
|
-
`),i=[];for(const r of o)i.push("> "+r);return i.join(`
|
|
6
|
-
`)},regExp:ot,replace:(t,e,o,i)=>{if(i){const p=t.getPreviousSibling();if(a.Ot(p))return p.splice(p.getChildrenSize(),0,[a.Jn(),...e]),void t.remove()}const r=a._t();r.append(...e),t.replace(r),i||r.select(0,0)},type:"element"},ft={dependencies:[N.q],export:t=>{if(!N.X(t))return null;const e=t.getTextContent();return"```"+(t.getLanguage()||"")+(e?`
|
|
7
|
-
`+e:"")+"\n```"},regExpEnd:{optional:!0,regExp:j},regExpStart:st,replace:(t,e,o,i,r,p)=>{let s,u;if(!e&&r){if(r.length===1)i?(s=N.U(),u=o[1]+r[0]):(s=N.U(o[1]),u=r[0].startsWith(" ")?r[0].slice(1):r[0]);else{if(s=N.U(o[1]),r[0].trim().length===0)for(;r.length>0&&!r[0].length;)r.shift();else r[0]=r[0].startsWith(" ")?r[0].slice(1):r[0];for(;r.length>0&&!r[r.length-1].length;)r.pop();u=r.join(`
|
|
8
|
-
`)}const d=a.sr(u);s.append(d),t.append(s)}else e&&it(d=>N.U(d?d[1]:void 0))(t,e,o,p)},type:"multiline-element"},at={dependencies:[a.lt$1,a.nt],export:(t,e)=>a.dt(t)?O(t,e,0):null,regExp:nt,replace:H("bullet"),type:"element"},Bt={dependencies:[a.lt$1,a.nt],export:(t,e)=>a.dt(t)?O(t,e,0):null,regExp:rt,replace:H("check"),type:"element"},ut={dependencies:[a.lt$1,a.nt],export:(t,e)=>a.dt(t)?O(t,e,0):null,regExp:et,replace:H("number"),type:"element"},gt={format:["code"],tag:"`",type:"text-format"},pt={format:["highlight"],tag:"==",type:"text-format"},dt={format:["bold","italic"],tag:"***",type:"text-format"},ht={format:["bold","italic"],intraword:!1,tag:"___",type:"text-format"},mt={format:["bold"],tag:"**",type:"text-format"},xt={format:["bold"],intraword:!1,tag:"__",type:"text-format"},Et={format:["strikethrough"],tag:"~~",type:"text-format"},Tt={format:["italic"],tag:"*",type:"text-format"},St={format:["italic"],intraword:!1,tag:"_",type:"text-format"},Ct={dependencies:[a.y],export:(t,e,o)=>{if(!a.w(t)||a.E(t))return null;const i=t.getTitle(),r=e(t);return i?`[${r}](${t.getURL()} "${i}")`:`[${r}](${t.getURL()})`},importRegExp:/(?:\[(.+?)\])(?:\((?:([^()\s]+)(?:\s"((?:[^"]*\\")*[^"]*)"\s*)?)\))/,regExp:/(?:\[(.+?)\])(?:\((?:([^()\s]+)(?:\s"((?:[^"]*\\")*[^"]*)"\s*)?)\))$/,replace:(t,e)=>{const[,o,i,r]=e,p=a.D(i,{title:r}),s=o.split("[").length-1,u=o.split("]").length-1;let d=o,l="";if(s<u)return;if(s>u){const f=o.split("[");l="["+f[0],d=f.slice(1).join("[")}const n=a.sr(d);return n.setFormat(t.getFormat()),p.append(n),t.replace(p),l&&p.insertBefore(a.sr(l)),n},trigger:")",type:"text-match"},Rt=[lt,ct,at,ut],$t=[ft],yt=[gt,dt,ht,mt,xt,pt,Tt,St,Et],It=[Ct],D=[...Rt,...$t,...yt,...It];function tt(t,e,o){const i=o.length;for(let r=e;r>=i;r--){const p=r-i;if(Lt(t,p,o,0,i)&&t[p+i]!==" ")return p}return-1}function Lt(t,e,o,i,r){for(let p=0;p<r;p++)if(t[e+p]!==o[i+p])return!1;return!0}function Ut(t,e=D){const o=z(e),i=B(o.textFormat,({tag:s})=>s[s.length-1]),r=B(o.textMatch,({trigger:s})=>s);for(const s of e){const u=s.type;if(u==="element"||u==="text-match"||u==="multiline-element"){const d=s.dependencies;for(const l of d)t.hasNode(l)||wt(173,l.getType())}}const p=(s,u,d)=>{(function(l,n,f,c){const g=l.getParent();if(!a.as(g)||l.getFirstChild()!==n)return!1;const h=n.getTextContent();if(h[f-1]!==" ")return!1;for(const{regExp:m,replace:x}of c){const E=h.match(m);if(E&&E[0].length===(E[0].endsWith(" ")?f:f-1)){const T=n.getNextSiblings(),[C,L]=n.splitText(f);if(x(l,L?[L,...T]:T,E,!1)!==!1)return C.remove(),!0}}return!1})(s,u,d,o.element)||(function(l,n,f,c){const g=l.getParent();if(!a.as(g)||l.getFirstChild()!==n)return!1;const h=n.getTextContent();if(h[f-1]!==" ")return!1;for(const{regExpStart:m,replace:x,regExpEnd:E}of c){if(E&&!("optional"in E)||E&&"optional"in E&&!E.optional)continue;const T=h.match(m);if(T&&T[0].length===(T[0].endsWith(" ")?f:f-1)){const C=n.getNextSiblings(),[L,R]=n.splitText(f);if(x(l,R?[R,...C]:C,T,null,null,!1)!==!1)return L.remove(),!0}}return!1})(s,u,d,o.multilineElement)||(function(l,n,f){let c=l.getTextContent();const g=f[c[n-1]];if(g==null)return!1;n<c.length&&(c=c.slice(0,n));for(const h of g){if(!h.replace||!h.regExp)continue;const m=c.match(h.regExp);if(m===null)continue;const x=m.index||0,E=x+m[0].length;let T;return x===0?[T]=l.splitText(E):[,T]=l.splitText(x,E),T.selectNext(0,0),h.replace(T,m),!0}return!1})(u,d,r)||(function(l,n,f){const c=l.getTextContent(),g=n-1,h=c[g],m=f[h];if(!m)return!1;for(const x of m){const{tag:E}=x,T=E.length,C=g-T+1;if(T>1&&!Lt(c,C,E,0,T)||c[C-1]===" ")continue;const L=c[g+1];if(x.intraword===!1&&L&&!M.test(L))continue;const R=l;let y=R,$=tt(c,C,E),v=y;for(;$<0&&(v=v.getPreviousSibling())&&!a.jn(v);)if(a.lr(v)){if(v.hasFormat("code"))continue;const I=v.getTextContent();y=v,$=tt(I,I.length,E)}if($<0||y===R&&$+T===C)continue;const k=y.getTextContent();if($>0&&k[$-1]===h)continue;const W=k[$-1];if(x.intraword===!1&&W&&!M.test(W))continue;const q=R.getTextContent(),G=q.slice(0,C)+q.slice(g+1);R.setTextContent(G);const X=y===R?G:k;y.setTextContent(X.slice(0,$)+X.slice($+T));const K=a.Lr(),S=a.Ar();a.wo(S);const vt=g-T*(y===R?2:1)+1;S.anchor.set(y.__key,$,"text"),S.focus.set(R.__key,vt,"text");for(const I of x.format)S.hasFormat(I)||S.formatText(I);S.anchor.set(S.focus.key,S.focus.offset,S.focus.type);for(const I of x.format)S.hasFormat(I)&&S.toggleFormat(I);return a.yr(K)&&(S.format=K.format),!0}})(u,d,i)};return t.registerUpdateListener(({tags:s,dirtyLeaves:u,editorState:d,prevEditorState:l})=>{if(s.has(a.Ln)||s.has(a.An)||t.isComposing())return;const n=d.read(a.Lr),f=l.read(a.Lr);if(!a.yr(f)||!a.yr(n)||!n.isCollapsed()||n.is(f))return;const c=n.anchor.key,g=n.anchor.offset,h=d._nodeMap.get(c);!a.lr(h)||!u.has(c)||g!==1&&g>f.anchor.offset+1||t.update(()=>{if(!b(h))return;const m=h.getParent();m===null||N.X(m)||p(m,h,n.anchor.offset)})})}function Pt(t,e=D,o,i=!1,r=!1){const p=i?t:(function(s,u=!1){const d=s.split(`
|
|
9
|
-
`);let l=!1;const n=[];for(let f=0;f<d.length;f++){const c=d[f].trimEnd(),g=n[n.length-1];Ot.test(c)?n.push(c):st.test(c)||j.test(c)?(l=!l,n.push(c)):l||c===""||g===""||!g||P.test(g)||P.test(c)||ot.test(c)||et.test(c)||nt.test(c)||rt.test(c)||Dt.test(c)||kt.test(c)||!u||V.test(c)||Y.test(c)||Z(Y).test(g)||Z(V).test(g)||j.test(g)?n.push(c):n[n.length-1]=g+" "+c.trimStart()}return n.join(`
|
|
10
|
-
`)})(t,r);return Ft(e,i)(p,o)}function jt(t=D,e,o=!1){return(function(r,p=!1){const s=z(r),u=[...s.multilineElement,...s.element],d=!p,l=s.textFormat.filter(n=>n.format.length===1).sort((n,f)=>Number(n.format.includes("code"))-Number(f.format.includes("code")));return n=>{const f=[],c=(n||a.No()).getChildren();for(let g=0;g<c.length;g++){const h=c[g],m=bt(h,u,l,s.textMatch);m!=null&&f.push(d&&g>0&&!U(h)&&!U(c[g-1])?`
|
|
11
|
-
`.concat(m):m)}return f.join(`
|
|
12
|
-
`)}})(t,o)(e)}exports.$convertFromMarkdownString=Pt;exports.$convertToMarkdownString=jt;exports.BOLD_ITALIC_STAR=dt;exports.BOLD_ITALIC_UNDERSCORE=ht;exports.BOLD_STAR=mt;exports.BOLD_UNDERSCORE=xt;exports.CHECK_LIST=Bt;exports.CODE=ft;exports.ELEMENT_TRANSFORMERS=Rt;exports.HEADING=lt;exports.HIGHLIGHT=pt;exports.INLINE_CODE=gt;exports.ITALIC_STAR=Tt;exports.ITALIC_UNDERSCORE=St;exports.LINK=Ct;exports.MULTILINE_ELEMENT_TRANSFORMERS=$t;exports.ORDERED_LIST=ut;exports.QUOTE=ct;exports.STRIKETHROUGH=Et;exports.TEXT_FORMAT_TRANSFORMERS=yt;exports.TEXT_MATCH_TRANSFORMERS=It;exports.TRANSFORMERS=D;exports.UNORDERED_LIST=at;exports.registerMarkdownShortcuts=Ut;
|
|
@@ -1,488 +0,0 @@
|
|
|
1
|
-
import { ac as K, ad as J, ae as vt, af as Lt, ag as Nt, ah as y, ai as _t, Z as bt, aj as j, ak as Ft, al as ut, am as wt, an as At, ao as H, J as gt, ap as Mt, s as O, aq as Ot, ar as kt, as as Dt, V as Bt, R as Pt, g as M, y as z, a as v, Y as pt, at as rt, m as dt, au as Ut, av as jt, r as k, G as ht, aw as mt, L as zt, ax as Ht, ay as Gt } from "./lexical-C60GkwxR.js";
|
|
2
|
-
import { q as Wt, U as w, X as xt } from "./lexical-code-DKIWiZdJ.js";
|
|
3
|
-
function G(t, e) {
|
|
4
|
-
const r = {};
|
|
5
|
-
for (const i of t) {
|
|
6
|
-
const o = e(i);
|
|
7
|
-
o && (r[o] ? r[o].push(i) : r[o] = [i]);
|
|
8
|
-
}
|
|
9
|
-
return r;
|
|
10
|
-
}
|
|
11
|
-
function Q(t) {
|
|
12
|
-
const e = G(t, (r) => r.type);
|
|
13
|
-
return { element: e.element || [], multilineElement: e["multiline-element"] || [], textFormat: e["text-format"] || [], textMatch: e["text-match"] || [] };
|
|
14
|
-
}
|
|
15
|
-
const D = /[!-/:-@[-`{-~\s]/, qt = /^\s{0,3}$/;
|
|
16
|
-
function W(t) {
|
|
17
|
-
if (!mt(t)) return !1;
|
|
18
|
-
const e = t.getFirstChild();
|
|
19
|
-
return e == null || t.getChildrenSize() === 1 && v(e) && qt.test(e.getTextContent());
|
|
20
|
-
}
|
|
21
|
-
function Xt(t, e, r, i) {
|
|
22
|
-
for (const o of e) {
|
|
23
|
-
if (!o.export) continue;
|
|
24
|
-
const g = o.export(t, (s) => B(s, r, i));
|
|
25
|
-
if (g != null) return g;
|
|
26
|
-
}
|
|
27
|
-
return k(t) ? B(t, r, i) : ht(t) ? t.getTextContent() : null;
|
|
28
|
-
}
|
|
29
|
-
function B(t, e, r, i, o) {
|
|
30
|
-
const g = [], s = t.getChildren();
|
|
31
|
-
i || (i = []), o || (o = []);
|
|
32
|
-
t: for (const f of s) {
|
|
33
|
-
for (const p of r) {
|
|
34
|
-
if (!p.export) continue;
|
|
35
|
-
const a = p.export(f, (n) => B(n, e, r, i, [...o, ...i]), (n, c) => st(n, c, e, i, o));
|
|
36
|
-
if (a != null) {
|
|
37
|
-
g.push(a);
|
|
38
|
-
continue t;
|
|
39
|
-
}
|
|
40
|
-
}
|
|
41
|
-
dt(f) ? g.push(`
|
|
42
|
-
`) : v(f) ? g.push(st(f, f.getTextContent(), e, i, o)) : k(f) ? g.push(B(f, e, r, i, o)) : ht(f) && g.push(f.getTextContent());
|
|
43
|
-
}
|
|
44
|
-
return g.join("");
|
|
45
|
-
}
|
|
46
|
-
function st(t, e, r, i, o) {
|
|
47
|
-
let g = t.getFormat() === 0 ? e : (function(l) {
|
|
48
|
-
return l.replace(/^\s+|\s+$/g, (u) => [...u].map((d) => "&#" + d.codePointAt(0) + ";").join(""));
|
|
49
|
-
})(e);
|
|
50
|
-
t.hasFormat("code") || (g = g.replace(/([*_`~\\])/g, "\\$1"));
|
|
51
|
-
let s = "", f = "", p = "";
|
|
52
|
-
const a = it(t, !0), n = it(t, !1), c = /* @__PURE__ */ new Set();
|
|
53
|
-
for (const l of r) {
|
|
54
|
-
const u = l.format[0], d = l.tag;
|
|
55
|
-
A(t, u) && !c.has(u) && (c.add(u), A(a, u) && i.find((h) => h.tag === d) || (i.push({ format: u, tag: d }), s += d));
|
|
56
|
-
}
|
|
57
|
-
for (let l = 0; l < i.length; l++) {
|
|
58
|
-
const u = A(t, i[l].format), d = A(n, i[l].format);
|
|
59
|
-
if (u && d) continue;
|
|
60
|
-
const h = [...i];
|
|
61
|
-
for (; h.length > l; ) {
|
|
62
|
-
const m = h.pop();
|
|
63
|
-
o && m && o.find((x) => x.tag === m.tag) || (m && typeof m.tag == "string" && (u ? d || (p += m.tag) : f += m.tag), i.pop());
|
|
64
|
-
}
|
|
65
|
-
break;
|
|
66
|
-
}
|
|
67
|
-
return g = s + g + p, f + g;
|
|
68
|
-
}
|
|
69
|
-
function it(t, e) {
|
|
70
|
-
let r = e ? t.getPreviousSibling() : t.getNextSibling();
|
|
71
|
-
if (!r) {
|
|
72
|
-
const i = t.getParentOrThrow();
|
|
73
|
-
i.isInline() && (r = e ? i.getPreviousSibling() : i.getNextSibling());
|
|
74
|
-
}
|
|
75
|
-
for (; r; ) {
|
|
76
|
-
if (k(r)) {
|
|
77
|
-
if (!r.isInline()) break;
|
|
78
|
-
const i = e ? r.getLastDescendant() : r.getFirstDescendant();
|
|
79
|
-
if (v(i)) return i;
|
|
80
|
-
r = e ? r.getPreviousSibling() : r.getNextSibling();
|
|
81
|
-
}
|
|
82
|
-
if (v(r)) return r;
|
|
83
|
-
if (!k(r)) return null;
|
|
84
|
-
}
|
|
85
|
-
return null;
|
|
86
|
-
}
|
|
87
|
-
function A(t, e) {
|
|
88
|
-
return v(t) && t.hasFormat(e);
|
|
89
|
-
}
|
|
90
|
-
function Kt(t, e) {
|
|
91
|
-
const r = (function(o, g) {
|
|
92
|
-
const s = o.match(g.openTagsRegExp);
|
|
93
|
-
if (s == null) return null;
|
|
94
|
-
for (const f of s) {
|
|
95
|
-
const p = f.replace(/^\s/, ""), a = g.fullMatchRegExpByTag[p];
|
|
96
|
-
if (a == null) continue;
|
|
97
|
-
const n = o.match(a), c = g.transformersByTag[p];
|
|
98
|
-
if (n != null && c != null) {
|
|
99
|
-
if (c.intraword !== !1) return n;
|
|
100
|
-
const { index: l = 0 } = n, u = o[l - 1], d = o[l + n[0].length];
|
|
101
|
-
if ((!u || D.test(u)) && (!d || D.test(d))) return n;
|
|
102
|
-
}
|
|
103
|
-
}
|
|
104
|
-
return null;
|
|
105
|
-
})(t.getTextContent(), e);
|
|
106
|
-
if (!r) return null;
|
|
107
|
-
const i = r.index || 0;
|
|
108
|
-
return { endIndex: i + r[0].length, match: r, startIndex: i, transformer: e.transformersByTag[r[1]] };
|
|
109
|
-
}
|
|
110
|
-
function _(t) {
|
|
111
|
-
return v(t) && !t.hasFormat("code");
|
|
112
|
-
}
|
|
113
|
-
function b(t, e, r) {
|
|
114
|
-
let i = Kt(t, e), o = (function(s, f) {
|
|
115
|
-
const p = s;
|
|
116
|
-
let a, n, c, l;
|
|
117
|
-
for (const u of f) {
|
|
118
|
-
if (!u.replace || !u.importRegExp) continue;
|
|
119
|
-
const d = p.getTextContent().match(u.importRegExp);
|
|
120
|
-
if (!d) continue;
|
|
121
|
-
const h = d.index || 0, m = u.getEndIndex ? u.getEndIndex(p, d) : h + d[0].length;
|
|
122
|
-
m !== !1 && (a === void 0 || n === void 0 || h < a && (m > n || m <= a)) && (a = h, n = m, c = u, l = d);
|
|
123
|
-
}
|
|
124
|
-
return a === void 0 || n === void 0 || c === void 0 || l === void 0 ? null : { endIndex: n, match: l, startIndex: a, transformer: c };
|
|
125
|
-
})(t, r);
|
|
126
|
-
if (i && o && (i.startIndex <= o.startIndex && i.endIndex >= o.endIndex || o.startIndex > i.endIndex ? o = null : i = null), i) {
|
|
127
|
-
const s = (function(f, p, a, n, c) {
|
|
128
|
-
const l = f.getTextContent();
|
|
129
|
-
let u, d, h;
|
|
130
|
-
if (c[0] === l ? u = f : p === 0 ? [u, d] = f.splitText(a) : [h, u, d] = f.splitText(p, a), u.setTextContent(c[2]), n) for (const m of n.format) u.hasFormat(m) || u.toggleFormat(m);
|
|
131
|
-
return { nodeAfter: d, nodeBefore: h, transformedNode: u };
|
|
132
|
-
})(t, i.startIndex, i.endIndex, i.transformer, i.match);
|
|
133
|
-
_(s.nodeAfter) && b(s.nodeAfter, e, r), _(s.nodeBefore) && b(s.nodeBefore, e, r), _(s.transformedNode) && b(s.transformedNode, e, r);
|
|
134
|
-
} else if (o) {
|
|
135
|
-
const s = (function(f, p, a, n, c) {
|
|
136
|
-
let l, u, d;
|
|
137
|
-
return p === 0 ? [l, u] = f.splitText(a) : [d, l, u] = f.splitText(p, a), n.replace ? { nodeAfter: u, nodeBefore: d, transformedNode: n.replace(l, c) || void 0 } : null;
|
|
138
|
-
})(t, o.startIndex, o.endIndex, o.transformer, o.match);
|
|
139
|
-
if (!s) return;
|
|
140
|
-
_(s.nodeAfter) && b(s.nodeAfter, e, r), _(s.nodeBefore) && b(s.nodeBefore, e, r), _(s.transformedNode) && b(s.transformedNode, e, r);
|
|
141
|
-
}
|
|
142
|
-
const g = t.getTextContent().replace(/\\([*_`~\\])/g, "$1").replace(/&#(\d+);/g, (s, f) => String.fromCodePoint(f));
|
|
143
|
-
t.setTextContent(g);
|
|
144
|
-
}
|
|
145
|
-
function Jt(t, e = !1) {
|
|
146
|
-
const r = Q(t), i = (function(o) {
|
|
147
|
-
const g = {}, s = {}, f = [], p = "(?<![\\\\])";
|
|
148
|
-
for (const a of o) {
|
|
149
|
-
const { tag: n } = a;
|
|
150
|
-
g[n] = a;
|
|
151
|
-
const c = n.replace(/(\*|\^|\+)/g, "\\$1");
|
|
152
|
-
f.push(c), n.length === 1 ? s[n] = n === "`" ? new RegExp("(?<![\\\\`])(`)((?:\\\\`|[^`])+?)(`)(?!`)") : new RegExp(`(?<![\\\\${c}])(${c})((\\\\${c})?.*?[^${c}\\s](\\\\${c})?)((?<!\\\\)|(?<=\\\\\\\\))(${c})(?![\\\\${c}])`) : s[n] = new RegExp(`(?<!\\\\)(${c})((\\\\${c})?.*?[^\\s](\\\\${c})?)((?<!\\\\)|(?<=\\\\\\\\))(${c})(?!\\\\)`);
|
|
153
|
-
}
|
|
154
|
-
return { fullMatchRegExpByTag: s, openTagsRegExp: new RegExp(`${p}(${f.join("|")})`, "g"), transformersByTag: g };
|
|
155
|
-
})(r.textFormat);
|
|
156
|
-
return (o, g) => {
|
|
157
|
-
const s = o.split(`
|
|
158
|
-
`), f = s.length, p = g || pt();
|
|
159
|
-
p.clear();
|
|
160
|
-
for (let n = 0; n < f; n++) {
|
|
161
|
-
const c = s[n], [l, u] = Qt(s, n, r.multilineElement, p);
|
|
162
|
-
l ? n = u : Vt(c, p, r.element, i, r.textMatch, e);
|
|
163
|
-
}
|
|
164
|
-
const a = p.getChildren();
|
|
165
|
-
for (const n of a) !e && W(n) && p.getChildrenSize() > 1 && n.remove();
|
|
166
|
-
M() !== null && p.selectStart();
|
|
167
|
-
};
|
|
168
|
-
}
|
|
169
|
-
function Qt(t, e, r, i) {
|
|
170
|
-
for (const o of r) {
|
|
171
|
-
const { handleImportAfterStartMatch: g, regExpEnd: s, regExpStart: f, replace: p } = o, a = t[e].match(f);
|
|
172
|
-
if (!a) continue;
|
|
173
|
-
if (g) {
|
|
174
|
-
const d = g({ lines: t, rootNode: i, startLineIndex: e, startMatch: a, transformer: o });
|
|
175
|
-
if (d === null) continue;
|
|
176
|
-
if (d) return d;
|
|
177
|
-
}
|
|
178
|
-
const n = typeof s == "object" && "regExp" in s ? s.regExp : s, c = s && typeof s == "object" && "optional" in s ? s.optional : !s;
|
|
179
|
-
let l = e;
|
|
180
|
-
const u = t.length;
|
|
181
|
-
for (; l < u; ) {
|
|
182
|
-
const d = n ? t[l].match(n) : null;
|
|
183
|
-
if (!d && (!c || c && l < u - 1)) {
|
|
184
|
-
l++;
|
|
185
|
-
continue;
|
|
186
|
-
}
|
|
187
|
-
if (d && e === l && d.index === a.index) {
|
|
188
|
-
l++;
|
|
189
|
-
continue;
|
|
190
|
-
}
|
|
191
|
-
const h = [];
|
|
192
|
-
if (d && e === l) h.push(t[e].slice(a[0].length, -d[0].length));
|
|
193
|
-
else for (let m = e; m <= l; m++) if (m === e) {
|
|
194
|
-
const x = t[m].slice(a[0].length);
|
|
195
|
-
h.push(x);
|
|
196
|
-
} else if (m === l && d) {
|
|
197
|
-
const x = t[m].slice(0, -d[0].length);
|
|
198
|
-
h.push(x);
|
|
199
|
-
} else h.push(t[m]);
|
|
200
|
-
if (p(i, null, a, d, h, !0) !== !1) return [!0, l];
|
|
201
|
-
break;
|
|
202
|
-
}
|
|
203
|
-
}
|
|
204
|
-
return [!1, e];
|
|
205
|
-
}
|
|
206
|
-
function Vt(t, e, r, i, o, g) {
|
|
207
|
-
const s = O(t), f = zt();
|
|
208
|
-
f.append(s), e.append(f);
|
|
209
|
-
for (const { regExp: p, replace: a } of r) {
|
|
210
|
-
const n = t.match(p);
|
|
211
|
-
if (n && (s.setTextContent(t.slice(n[0].length)), a(f, [s], n, !0) !== !1)) break;
|
|
212
|
-
}
|
|
213
|
-
if (b(s, i, o), f.isAttached() && t.length > 0) {
|
|
214
|
-
const p = f.getPreviousSibling();
|
|
215
|
-
if (!g && (mt(p) || H(p) || y(p))) {
|
|
216
|
-
let a = p;
|
|
217
|
-
if (y(p)) {
|
|
218
|
-
const n = p.getLastDescendant();
|
|
219
|
-
a = n == null ? null : Ht(n, ut);
|
|
220
|
-
}
|
|
221
|
-
a != null && a.getTextContentSize() > 0 && (a.splice(a.getChildrenSize(), 0, [gt(), ...f.getChildren()]), f.remove());
|
|
222
|
-
}
|
|
223
|
-
}
|
|
224
|
-
}
|
|
225
|
-
function Yt(t, ...e) {
|
|
226
|
-
const r = new URL("https://lexical.dev/docs/error"), i = new URLSearchParams();
|
|
227
|
-
i.append("code", t);
|
|
228
|
-
for (const o of e) i.append("v", o);
|
|
229
|
-
throw r.search = i.toString(), Error(`Minified Lexical error #${t}; visit ${r.toString()} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`);
|
|
230
|
-
}
|
|
231
|
-
const Et = /^(\s*)(\d{1,})\.\s/, Tt = /^(\s*)[-*+]\s/, St = /^(\s*)(?:[-*+]\s)?\s?(\[(\s|x)?\])\s/i, q = /^(#{1,6})\s/, $t = /^>\s/, Ct = /^[ \t]*```([\w-]+)?/, X = /[ \t]*```$/, Zt = /^[ \t]*```[^`]+(?:(?:`{1,2}|`{4,})[^`]+)*```(?:[^`]|$)/, te = /^(?:\|)(.+)(?:\|)\s?$/, ee = /^(\| ?:?-*:? ?)+\|\s?$/, at = /^<[a-z_][\w-]*(?:\s[^<>]*)?\/?>/i, lt = /^<\/[a-z_][\w-]*\s*>/i, ct = (t) => new RegExp(`(?:${t.source})$`, t.flags), F = bt("mdListMarker", { parse: (t) => typeof t == "string" && /^[-*+]$/.test(t) ? t : "-" }), Rt = (t) => (e, r, i, o) => {
|
|
232
|
-
const g = t(i);
|
|
233
|
-
g.append(...r), e.replace(g), o || g.select(0, 0);
|
|
234
|
-
}, V = (t) => (e, r, i, o) => {
|
|
235
|
-
const g = e.getPreviousSibling(), s = e.getNextSibling(), f = _t(t === "check" ? i[3] === "x" : void 0), p = i[0].trim()[0], a = t !== "bullet" && t !== "check" || p !== F.parse(p) ? void 0 : p;
|
|
236
|
-
if (y(s) && s.getListType() === t) {
|
|
237
|
-
a && j(s, F, a);
|
|
238
|
-
const c = s.getFirstChild();
|
|
239
|
-
c !== null ? c.insertBefore(f) : s.append(f), e.remove();
|
|
240
|
-
} else if (y(g) && g.getListType() === t) a && j(g, F, a), g.append(f), e.remove();
|
|
241
|
-
else {
|
|
242
|
-
const c = Ft(t, t === "number" ? Number(i[2]) : void 0);
|
|
243
|
-
a && j(c, F, a), c.append(f), e.replace(c);
|
|
244
|
-
}
|
|
245
|
-
f.append(...r), o || f.select(0, 0);
|
|
246
|
-
const n = (function(c) {
|
|
247
|
-
const l = c.match(/\t/g), u = c.match(/ /g);
|
|
248
|
-
let d = 0;
|
|
249
|
-
return l && (d += l.length), u && (d += Math.floor(u.length / 4)), d;
|
|
250
|
-
})(i[1]);
|
|
251
|
-
n && f.setIndent(n);
|
|
252
|
-
}, P = (t, e, r) => {
|
|
253
|
-
const i = [], o = t.getChildren();
|
|
254
|
-
let g = 0;
|
|
255
|
-
for (const s of o) if (ut(s)) {
|
|
256
|
-
if (s.getChildrenSize() === 1) {
|
|
257
|
-
const c = s.getFirstChild();
|
|
258
|
-
if (y(c)) {
|
|
259
|
-
i.push(P(c, e, r + 1));
|
|
260
|
-
continue;
|
|
261
|
-
}
|
|
262
|
-
}
|
|
263
|
-
const f = " ".repeat(4 * r), p = t.getListType(), a = wt(t, F), n = p === "number" ? `${t.getStart() + g}. ` : p === "check" ? `${a} [${s.getChecked() ? "x" : " "}] ` : a + " ";
|
|
264
|
-
i.push(f + n + e(s)), g++;
|
|
265
|
-
}
|
|
266
|
-
return i.join(`
|
|
267
|
-
`);
|
|
268
|
-
}, ne = { dependencies: [vt], export: (t, e) => {
|
|
269
|
-
if (!At(t)) return null;
|
|
270
|
-
const r = Number(t.getTag().slice(1));
|
|
271
|
-
return "#".repeat(r) + " " + e(t);
|
|
272
|
-
}, regExp: q, replace: Rt((t) => {
|
|
273
|
-
const e = "h" + t[1].length;
|
|
274
|
-
return Gt(e);
|
|
275
|
-
}), type: "element" }, oe = { dependencies: [Lt], export: (t, e) => {
|
|
276
|
-
if (!H(t)) return null;
|
|
277
|
-
const r = e(t).split(`
|
|
278
|
-
`), i = [];
|
|
279
|
-
for (const o of r) i.push("> " + o);
|
|
280
|
-
return i.join(`
|
|
281
|
-
`);
|
|
282
|
-
}, regExp: $t, replace: (t, e, r, i) => {
|
|
283
|
-
if (i) {
|
|
284
|
-
const g = t.getPreviousSibling();
|
|
285
|
-
if (H(g)) return g.splice(g.getChildrenSize(), 0, [gt(), ...e]), void t.remove();
|
|
286
|
-
}
|
|
287
|
-
const o = Mt();
|
|
288
|
-
o.append(...e), t.replace(o), i || o.select(0, 0);
|
|
289
|
-
}, type: "element" }, re = { dependencies: [Wt], export: (t) => {
|
|
290
|
-
if (!xt(t)) return null;
|
|
291
|
-
const e = t.getTextContent();
|
|
292
|
-
return "```" + (t.getLanguage() || "") + (e ? `
|
|
293
|
-
` + e : "") + "\n```";
|
|
294
|
-
}, regExpEnd: { optional: !0, regExp: X }, regExpStart: Ct, replace: (t, e, r, i, o, g) => {
|
|
295
|
-
let s, f;
|
|
296
|
-
if (!e && o) {
|
|
297
|
-
if (o.length === 1) i ? (s = w(), f = r[1] + o[0]) : (s = w(r[1]), f = o[0].startsWith(" ") ? o[0].slice(1) : o[0]);
|
|
298
|
-
else {
|
|
299
|
-
if (s = w(r[1]), o[0].trim().length === 0) for (; o.length > 0 && !o[0].length; ) o.shift();
|
|
300
|
-
else o[0] = o[0].startsWith(" ") ? o[0].slice(1) : o[0];
|
|
301
|
-
for (; o.length > 0 && !o[o.length - 1].length; ) o.pop();
|
|
302
|
-
f = o.join(`
|
|
303
|
-
`);
|
|
304
|
-
}
|
|
305
|
-
const p = O(f);
|
|
306
|
-
s.append(p), t.append(s);
|
|
307
|
-
} else e && Rt((p) => w(p ? p[1] : void 0))(t, e, r, g);
|
|
308
|
-
}, type: "multiline-element" }, se = { dependencies: [K, J], export: (t, e) => y(t) ? P(t, e, 0) : null, regExp: Tt, replace: V("bullet"), type: "element" }, Re = { dependencies: [K, J], export: (t, e) => y(t) ? P(t, e, 0) : null, regExp: St, replace: V("check"), type: "element" }, ie = { dependencies: [K, J], export: (t, e) => y(t) ? P(t, e, 0) : null, regExp: Et, replace: V("number"), type: "element" }, ae = { format: ["code"], tag: "`", type: "text-format" }, le = { format: ["highlight"], tag: "==", type: "text-format" }, ce = { format: ["bold", "italic"], tag: "***", type: "text-format" }, fe = { format: ["bold", "italic"], intraword: !1, tag: "___", type: "text-format" }, ue = { format: ["bold"], tag: "**", type: "text-format" }, ge = { format: ["bold"], intraword: !1, tag: "__", type: "text-format" }, pe = { format: ["strikethrough"], tag: "~~", type: "text-format" }, de = { format: ["italic"], tag: "*", type: "text-format" }, he = { format: ["italic"], intraword: !1, tag: "_", type: "text-format" }, me = { dependencies: [Nt], export: (t, e, r) => {
|
|
309
|
-
if (!kt(t) || Dt(t)) return null;
|
|
310
|
-
const i = t.getTitle(), o = e(t);
|
|
311
|
-
return i ? `[${o}](${t.getURL()} "${i}")` : `[${o}](${t.getURL()})`;
|
|
312
|
-
}, importRegExp: /(?:\[(.+?)\])(?:\((?:([^()\s]+)(?:\s"((?:[^"]*\\")*[^"]*)"\s*)?)\))/, regExp: /(?:\[(.+?)\])(?:\((?:([^()\s]+)(?:\s"((?:[^"]*\\")*[^"]*)"\s*)?)\))$/, replace: (t, e) => {
|
|
313
|
-
const [, r, i, o] = e, g = Ot(i, { title: o }), s = r.split("[").length - 1, f = r.split("]").length - 1;
|
|
314
|
-
let p = r, a = "";
|
|
315
|
-
if (s < f) return;
|
|
316
|
-
if (s > f) {
|
|
317
|
-
const c = r.split("[");
|
|
318
|
-
a = "[" + c[0], p = c.slice(1).join("[");
|
|
319
|
-
}
|
|
320
|
-
const n = O(p);
|
|
321
|
-
return n.setFormat(t.getFormat()), g.append(n), t.replace(g), a && g.insertBefore(O(a)), n;
|
|
322
|
-
}, trigger: ")", type: "text-match" }, xe = [ne, oe, se, ie], Ee = [re], Te = [ae, ce, fe, ue, ge, le, de, he, pe], Se = [me], Y = [...xe, ...Ee, ...Te, ...Se];
|
|
323
|
-
function ft(t, e, r) {
|
|
324
|
-
const i = r.length;
|
|
325
|
-
for (let o = e; o >= i; o--) {
|
|
326
|
-
const g = o - i;
|
|
327
|
-
if (It(t, g, r, 0, i) && t[g + i] !== " ") return g;
|
|
328
|
-
}
|
|
329
|
-
return -1;
|
|
330
|
-
}
|
|
331
|
-
function It(t, e, r, i, o) {
|
|
332
|
-
for (let g = 0; g < o; g++) if (t[e + g] !== r[i + g]) return !1;
|
|
333
|
-
return !0;
|
|
334
|
-
}
|
|
335
|
-
function Ie(t, e = Y) {
|
|
336
|
-
const r = Q(e), i = G(r.textFormat, ({ tag: s }) => s[s.length - 1]), o = G(r.textMatch, ({ trigger: s }) => s);
|
|
337
|
-
for (const s of e) {
|
|
338
|
-
const f = s.type;
|
|
339
|
-
if (f === "element" || f === "text-match" || f === "multiline-element") {
|
|
340
|
-
const p = s.dependencies;
|
|
341
|
-
for (const a of p) t.hasNode(a) || Yt(173, a.getType());
|
|
342
|
-
}
|
|
343
|
-
}
|
|
344
|
-
const g = (s, f, p) => {
|
|
345
|
-
(function(a, n, c, l) {
|
|
346
|
-
const u = a.getParent();
|
|
347
|
-
if (!rt(u) || a.getFirstChild() !== n) return !1;
|
|
348
|
-
const d = n.getTextContent();
|
|
349
|
-
if (d[c - 1] !== " ") return !1;
|
|
350
|
-
for (const { regExp: h, replace: m } of l) {
|
|
351
|
-
const x = d.match(h);
|
|
352
|
-
if (x && x[0].length === (x[0].endsWith(" ") ? c : c - 1)) {
|
|
353
|
-
const E = n.getNextSiblings(), [S, L] = n.splitText(c);
|
|
354
|
-
if (m(a, L ? [L, ...E] : E, x, !1) !== !1) return S.remove(), !0;
|
|
355
|
-
}
|
|
356
|
-
}
|
|
357
|
-
return !1;
|
|
358
|
-
})(s, f, p, r.element) || (function(a, n, c, l) {
|
|
359
|
-
const u = a.getParent();
|
|
360
|
-
if (!rt(u) || a.getFirstChild() !== n) return !1;
|
|
361
|
-
const d = n.getTextContent();
|
|
362
|
-
if (d[c - 1] !== " ") return !1;
|
|
363
|
-
for (const { regExpStart: h, replace: m, regExpEnd: x } of l) {
|
|
364
|
-
if (x && !("optional" in x) || x && "optional" in x && !x.optional) continue;
|
|
365
|
-
const E = d.match(h);
|
|
366
|
-
if (E && E[0].length === (E[0].endsWith(" ") ? c : c - 1)) {
|
|
367
|
-
const S = n.getNextSiblings(), [L, $] = n.splitText(c);
|
|
368
|
-
if (m(a, $ ? [$, ...S] : S, E, null, null, !1) !== !1) return L.remove(), !0;
|
|
369
|
-
}
|
|
370
|
-
}
|
|
371
|
-
return !1;
|
|
372
|
-
})(s, f, p, r.multilineElement) || (function(a, n, c) {
|
|
373
|
-
let l = a.getTextContent();
|
|
374
|
-
const u = c[l[n - 1]];
|
|
375
|
-
if (u == null) return !1;
|
|
376
|
-
n < l.length && (l = l.slice(0, n));
|
|
377
|
-
for (const d of u) {
|
|
378
|
-
if (!d.replace || !d.regExp) continue;
|
|
379
|
-
const h = l.match(d.regExp);
|
|
380
|
-
if (h === null) continue;
|
|
381
|
-
const m = h.index || 0, x = m + h[0].length;
|
|
382
|
-
let E;
|
|
383
|
-
return m === 0 ? [E] = a.splitText(x) : [, E] = a.splitText(m, x), E.selectNext(0, 0), d.replace(E, h), !0;
|
|
384
|
-
}
|
|
385
|
-
return !1;
|
|
386
|
-
})(f, p, o) || (function(a, n, c) {
|
|
387
|
-
const l = a.getTextContent(), u = n - 1, d = l[u], h = c[d];
|
|
388
|
-
if (!h) return !1;
|
|
389
|
-
for (const m of h) {
|
|
390
|
-
const { tag: x } = m, E = x.length, S = u - E + 1;
|
|
391
|
-
if (E > 1 && !It(l, S, x, 0, E) || l[S - 1] === " ") continue;
|
|
392
|
-
const L = l[u + 1];
|
|
393
|
-
if (m.intraword === !1 && L && !D.test(L)) continue;
|
|
394
|
-
const $ = a;
|
|
395
|
-
let R = $, C = ft(l, S, x), N = R;
|
|
396
|
-
for (; C < 0 && (N = N.getPreviousSibling()) && !dt(N); ) if (v(N)) {
|
|
397
|
-
if (N.hasFormat("code")) continue;
|
|
398
|
-
const I = N.getTextContent();
|
|
399
|
-
R = N, C = ft(I, I.length, x);
|
|
400
|
-
}
|
|
401
|
-
if (C < 0 || R === $ && C + E === S) continue;
|
|
402
|
-
const U = R.getTextContent();
|
|
403
|
-
if (C > 0 && U[C - 1] === d) continue;
|
|
404
|
-
const Z = U[C - 1];
|
|
405
|
-
if (m.intraword === !1 && Z && !D.test(Z)) continue;
|
|
406
|
-
const tt = $.getTextContent(), et = tt.slice(0, S) + tt.slice(u + 1);
|
|
407
|
-
$.setTextContent(et);
|
|
408
|
-
const nt = R === $ ? et : U;
|
|
409
|
-
R.setTextContent(nt.slice(0, C) + nt.slice(C + E));
|
|
410
|
-
const ot = M(), T = Ut();
|
|
411
|
-
jt(T);
|
|
412
|
-
const yt = u - E * (R === $ ? 2 : 1) + 1;
|
|
413
|
-
T.anchor.set(R.__key, C, "text"), T.focus.set($.__key, yt, "text");
|
|
414
|
-
for (const I of m.format) T.hasFormat(I) || T.formatText(I);
|
|
415
|
-
T.anchor.set(T.focus.key, T.focus.offset, T.focus.type);
|
|
416
|
-
for (const I of m.format) T.hasFormat(I) && T.toggleFormat(I);
|
|
417
|
-
return z(ot) && (T.format = ot.format), !0;
|
|
418
|
-
}
|
|
419
|
-
})(f, p, i);
|
|
420
|
-
};
|
|
421
|
-
return t.registerUpdateListener(({ tags: s, dirtyLeaves: f, editorState: p, prevEditorState: a }) => {
|
|
422
|
-
if (s.has(Bt) || s.has(Pt) || t.isComposing()) return;
|
|
423
|
-
const n = p.read(M), c = a.read(M);
|
|
424
|
-
if (!z(c) || !z(n) || !n.isCollapsed() || n.is(c)) return;
|
|
425
|
-
const l = n.anchor.key, u = n.anchor.offset, d = p._nodeMap.get(l);
|
|
426
|
-
!v(d) || !f.has(l) || u !== 1 && u > c.anchor.offset + 1 || t.update(() => {
|
|
427
|
-
if (!_(d)) return;
|
|
428
|
-
const h = d.getParent();
|
|
429
|
-
h === null || xt(h) || g(h, d, n.anchor.offset);
|
|
430
|
-
});
|
|
431
|
-
});
|
|
432
|
-
}
|
|
433
|
-
function ye(t, e = Y, r, i = !1, o = !1) {
|
|
434
|
-
const g = i ? t : (function(s, f = !1) {
|
|
435
|
-
const p = s.split(`
|
|
436
|
-
`);
|
|
437
|
-
let a = !1;
|
|
438
|
-
const n = [];
|
|
439
|
-
for (let c = 0; c < p.length; c++) {
|
|
440
|
-
const l = p[c].trimEnd(), u = n[n.length - 1];
|
|
441
|
-
Zt.test(l) ? n.push(l) : Ct.test(l) || X.test(l) ? (a = !a, n.push(l)) : a || l === "" || u === "" || !u || q.test(u) || q.test(l) || $t.test(l) || Et.test(l) || Tt.test(l) || St.test(l) || te.test(l) || ee.test(l) || !f || at.test(l) || lt.test(l) || ct(lt).test(u) || ct(at).test(u) || X.test(u) ? n.push(l) : n[n.length - 1] = u + " " + l.trimStart();
|
|
442
|
-
}
|
|
443
|
-
return n.join(`
|
|
444
|
-
`);
|
|
445
|
-
})(t, o);
|
|
446
|
-
return Jt(e, i)(g, r);
|
|
447
|
-
}
|
|
448
|
-
function ve(t = Y, e, r = !1) {
|
|
449
|
-
return (function(o, g = !1) {
|
|
450
|
-
const s = Q(o), f = [...s.multilineElement, ...s.element], p = !g, a = s.textFormat.filter((n) => n.format.length === 1).sort((n, c) => Number(n.format.includes("code")) - Number(c.format.includes("code")));
|
|
451
|
-
return (n) => {
|
|
452
|
-
const c = [], l = (n || pt()).getChildren();
|
|
453
|
-
for (let u = 0; u < l.length; u++) {
|
|
454
|
-
const d = l[u], h = Xt(d, f, a, s.textMatch);
|
|
455
|
-
h != null && c.push(p && u > 0 && !W(d) && !W(l[u - 1]) ? `
|
|
456
|
-
`.concat(h) : h);
|
|
457
|
-
}
|
|
458
|
-
return c.join(`
|
|
459
|
-
`);
|
|
460
|
-
};
|
|
461
|
-
})(t, r)(e);
|
|
462
|
-
}
|
|
463
|
-
export {
|
|
464
|
-
ye as $convertFromMarkdownString,
|
|
465
|
-
ve as $convertToMarkdownString,
|
|
466
|
-
ce as BOLD_ITALIC_STAR,
|
|
467
|
-
fe as BOLD_ITALIC_UNDERSCORE,
|
|
468
|
-
ue as BOLD_STAR,
|
|
469
|
-
ge as BOLD_UNDERSCORE,
|
|
470
|
-
Re as CHECK_LIST,
|
|
471
|
-
re as CODE,
|
|
472
|
-
xe as ELEMENT_TRANSFORMERS,
|
|
473
|
-
ne as HEADING,
|
|
474
|
-
le as HIGHLIGHT,
|
|
475
|
-
ae as INLINE_CODE,
|
|
476
|
-
de as ITALIC_STAR,
|
|
477
|
-
he as ITALIC_UNDERSCORE,
|
|
478
|
-
me as LINK,
|
|
479
|
-
Ee as MULTILINE_ELEMENT_TRANSFORMERS,
|
|
480
|
-
ie as ORDERED_LIST,
|
|
481
|
-
oe as QUOTE,
|
|
482
|
-
pe as STRIKETHROUGH,
|
|
483
|
-
Te as TEXT_FORMAT_TRANSFORMERS,
|
|
484
|
-
Se as TEXT_MATCH_TRANSFORMERS,
|
|
485
|
-
Y as TRANSFORMERS,
|
|
486
|
-
se as UNORDERED_LIST,
|
|
487
|
-
Ie as registerMarkdownShortcuts
|
|
488
|
-
};
|