@lexical/yjs 0.2.2 → 0.2.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/LexicalYjs.dev.js CHANGED
@@ -1337,17 +1337,25 @@ function updateCursor(binding, cursor, nextSelection, nodeMap) {
1337
1337
  const selectionRects = Array.from(range.getClientRects());
1338
1338
  let selectionRectsLength = selectionRects.length;
1339
1339
  const selectionsLength = selections.length;
1340
+ let prevRect;
1340
1341
 
1341
1342
  for (let i = 0; i < selectionRectsLength; i++) {
1342
- const selectionRect = selectionRects[i];
1343
+ const selectionRect = selectionRects[i]; // Exclude a rect that is the exact same as the last rect. getClientRects() can return
1344
+ // the same rect twice for some elements. A more sophisticated thing to do here is to
1345
+ // merge all the rects together into a set of rects that don't overlap, so we don't
1346
+ // generate backgrounds that are too dark.
1343
1347
 
1344
- if (selectionRect.width + rootPadding === rootRect.width) {
1345
- // Exclude selections that span the entire element
1348
+ const isDuplicateRect = prevRect && prevRect.top === selectionRect.top && prevRect.left === selectionRect.left && prevRect.width === selectionRect.width && prevRect.height === selectionRect.height; // Exclude selections that span the entire element
1349
+
1350
+ const selectionSpansElement = selectionRect.width + rootPadding === rootRect.width;
1351
+
1352
+ if (isDuplicateRect || selectionSpansElement) {
1346
1353
  selectionRects.splice(i--, 1);
1347
1354
  selectionRectsLength--;
1348
1355
  continue;
1349
1356
  }
1350
1357
 
1358
+ prevRect = selectionRect;
1351
1359
  let selection = selections[i];
1352
1360
 
1353
1361
  if (selection === undefined) {
@@ -6,43 +6,44 @@
6
6
  */
7
7
  var q=require("lexical"),w=require("yjs"),z=require("@lexical/offset");class B{constructor(a,b){this._key="";this._map=a;this._parent=b;this._type="linebreak"}getNode(){const a=q.$getNodeByKey(this._key);return q.$isLineBreakNode(a)?a:null}getKey(){return this._key}getSharedType(){return this._map}getType(){return this._type}getSize(){return 1}getOffset(){return this._parent.getChildOffset(this)}destroy(a){a.collabNodeMap.delete(this._key)}}function C(a,b){b=new B(a,b);return a._collabNode=b}
8
8
  class D{constructor(a,b,c,d){this._key="";this._map=a;this._parent=c;this._text=b;this._type=d;this._normalized=!1}getPrevNode(a){if(null===a)return null;a=a.get(this._key);return q.$isTextNode(a)?a:null}getNode(){const a=q.$getNodeByKey(this._key);return q.$isTextNode(a)?a: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(a,b,c){const d=
9
- this._parent._xmlText;a=this.getOffset()+1+a;0!==b&&d.delete(a,b);""!==c&&d.insert(a,c)}syncPropertiesAndTextFromLexical(a,b,c){var d=this.getPrevNode(c);c=b.__text;F(a,this._map,d,b);if(null!==d&&(a=d.__text,a!==c)){d=b.__key;b=a;var e=q.$getSelection();a=c.length;q.$isRangeSelection(e)&&e.isCollapsed()&&(e=e.anchor,e.key===d&&(a=e.offset));d=b.length;const f=c.length;let h=e=0;for(;e<d&&e<f&&b[e]===c[e]&&e<a;)e++;for(;h+e<d&&h+e<f&&b[d-h-1]===c[f-h-1];)h++;for(;h+e<d&&h+e<f&&b[e]===c[e];)e++;b=
10
- e;a=c.slice(e,f-h);d=d-e-h;this.spliceText(b,d,a);this._text=c}}syncPropertiesAndTextFromYjs(a,b){const c=this.getNode();if(null===c)throw Error("Should never happen");G(a,this._map,c,b);a=this._text;c.__text!==a&&(c.getWritable().__text=a)}destroy(a){a.collabNodeMap.delete(this._key)}}function H(a,b,c,d){b=new D(a,b,c,d);return a._collabNode=b}const J=new Set(["__key","__children","__parent","__cachedText","__text"]);
11
- function K(a){a=q.$getNodeByKey(a);if(null===a)throw Error("Should never happen");return a}
12
- function L(a,b,c){const d=b.__type;if(q.$isElementNode(b)){var e=new w.XmlText;c=M(e,c,d);c.syncPropertiesFromLexical(a,b,null);c.syncChildrenFromLexical(a,b,null,null,null)}else if(q.$isTextNode(b))e=new w.Map,c=H(e,b.__text,c,d),c.syncPropertiesAndTextFromLexical(a,b,null);else if(q.$isLineBreakNode(b))a=new w.Map,a.set("__type","linebreak"),c=C(a,c);else if(q.$isDecoratorNode(b))e=new w.XmlElement,c=O(e,c,d),c.syncPropertiesFromLexical(a,b,null);else throw Error("Should never happen");c._key=b.__key;
9
+ this._parent._xmlText;a=this.getOffset()+1+a;0!==b&&d.delete(a,b);""!==c&&d.insert(a,c)}syncPropertiesAndTextFromLexical(a,b,c){var d=this.getPrevNode(c);c=b.__text;G(a,this._map,d,b);if(null!==d&&(a=d.__text,a!==c)){d=b.__key;b=a;var e=q.$getSelection();a=c.length;q.$isRangeSelection(e)&&e.isCollapsed()&&(e=e.anchor,e.key===d&&(a=e.offset));d=b.length;const f=c.length;let g=e=0;for(;e<d&&e<f&&b[e]===c[e]&&e<a;)e++;for(;g+e<d&&g+e<f&&b[d-g-1]===c[f-g-1];)g++;for(;g+e<d&&g+e<f&&b[e]===c[e];)e++;b=
10
+ e;a=c.slice(e,f-g);d=d-e-g;this.spliceText(b,d,a);this._text=c}}syncPropertiesAndTextFromYjs(a,b){const c=this.getNode();if(null===c)throw Error("Should never happen");H(a,this._map,c,b);a=this._text;c.__text!==a&&(c.getWritable().__text=a)}destroy(a){a.collabNodeMap.delete(this._key)}}function I(a,b,c,d){b=new D(a,b,c,d);return a._collabNode=b}const K=new Set(["__key","__children","__parent","__cachedText","__text"]);
11
+ function L(a){a=q.$getNodeByKey(a);if(null===a)throw Error("Should never happen");return a}
12
+ function M(a,b,c){const d=b.__type;if(q.$isElementNode(b)){var e=new w.XmlText;c=N(e,c,d);c.syncPropertiesFromLexical(a,b,null);c.syncChildrenFromLexical(a,b,null,null,null)}else if(q.$isTextNode(b))e=new w.Map,c=I(e,b.__text,c,d),c.syncPropertiesAndTextFromLexical(a,b,null);else if(q.$isLineBreakNode(b))a=new w.Map,a.set("__type","linebreak"),c=C(a,c);else if(q.$isDecoratorNode(b))e=new w.XmlElement,c=P(e,c,d),c.syncPropertiesFromLexical(a,b,null);else throw Error("Should never happen");c._key=b.__key;
13
13
  return c}
14
- function P(a,b,c){const d=b._collabNode;if(void 0===d){var e=a.editor._nodes;const f=b instanceof w.Map?b.get("__type"):b.getAttribute("__type");if(null==f)throw Error("Should never happen");if(void 0===e.get(f))throw Error("Should never happen");e=b.parent;a=void 0===c&&null!==e?P(a,e):c||null;if(!(a instanceof Q))throw Error("Should never happen");if(b instanceof w.XmlText)return M(b,a,f);if(b instanceof w.Map){if(null===a)throw Error("Should never happen");return"linebreak"===f?C(b,a):H(b,"",a,
15
- f)}if(b instanceof w.XmlElement)return O(b,a,f)}return d}function G(a,b,c,d){d=null===d?b instanceof w.Map?Array.from(b.keys()):Object.keys(b.getAttributes()):Array.from(d);let e;for(let h=0;h<d.length;h++){const g=d[h];if(J.has(g))continue;var f=c[g];let k=b instanceof w.Map?b.get(g):b.getAttribute(g);if(f!==k){if(k instanceof w.Doc){const m=a.docMap;f instanceof w.Doc&&m.delete(f.guid);f=q.createEditor();const l=k.guid;f._key=l;m.set(l,k);k=f}void 0===e&&(e=c.getWritable());e[g]=k}}}
16
- function F(a,b,c,d){var e=d.__type,f=a.nodeProperties;let h=f.get(e);void 0===h&&(h=Object.keys(d).filter(k=>!J.has(k)),f.set(e,h));e=a.editor.constructor;for(f=0;f<h.length;f++){const k=h[f];var g=null===c?void 0:c[k];let m=d[k];if(g!==m){if(m instanceof e){const l=a.docMap;let r;g instanceof e&&(g=g._key,r=l.get(g),l.delete(g));g=r||new w.Doc;const t=g.guid;m._key=t;l.set(t,g);m=g;a.editor.update(()=>{d.markDirty()})}b instanceof w.Map?b.set(k,m):b.setAttribute(k,m)}}}
17
- function R(a,b,c){let d=0,e=0;const f=a._children,h=f.length;for(;e<h;e++){a=f[e];const g=d,k=a.getSize();d+=k;if((c?d>=b:d>b)&&a instanceof D)return b=b-g-1,0>b&&(b=0),{length:k-b,node:a,nodeIndex:e,offset:b};if(d>b)return{length:0,node:a,nodeIndex:e,offset:g};if(e===h-1)return{length:0,node:null,nodeIndex:e+1,offset:g+1}}return{length:0,node:null,nodeIndex:0,offset:0}}
18
- function S(a){const b=a.anchor;a=a.focus;let c=!1;try{const d=b.getNode(),e=a.getNode();if(!d.isAttached()||!e.isAttached()||q.$isTextNode(d)&&b.offset>d.getTextContentSize()||q.$isTextNode(e)&&a.offset>e.getTextContentSize())c=!0}catch(d){c=!0}return c}function aa(a,b){a.doc.transact(b,a)}
19
- class T{constructor(a,b,c){this._key="";this._xmlElem=a;this._parent=b;this._type=c;this._unobservers=new Set}getPrevNode(a){if(null===a)return null;a=a.get(this._key);return q.$isDecoratorNode(a)?a:null}getNode(){const a=q.$getNodeByKey(this._key);return q.$isDecoratorNode(a)?a:null}getSharedType(){return this._xmlElem}getType(){return this._type}getKey(){return this._key}getSize(){return 1}getOffset(){return this._parent.getChildOffset(this)}syncPropertiesFromLexical(a,b,c){c=this.getPrevNode(c);
20
- F(a,this._xmlElem,c,b)}syncPropertiesFromYjs(a,b){const c=this.getNode();if(null===c)throw Error("Should never happen");G(a,this._xmlElem,c,b)}destroy(a){a.collabNodeMap.delete(this._key);this._unobservers.forEach(b=>b());this._unobservers.clear()}}function O(a,b,c){b=new T(a,b,c);return a._collabNode=b}
21
- class Q{constructor(a,b,c){this._key="";this._children=[];this._xmlText=a;this._type=c;this._parent=b}getPrevNode(a){if(null===a)return null;a=a.get(this._key);return q.$isElementNode(a)?a:null}getNode(){const a=q.$getNodeByKey(this._key);return q.$isElementNode(a)?a:null}getSharedType(){return this._xmlText}getType(){return this._type}getKey(){return this._key}isEmpty(){return 0===this._children.length}getSize(){return 1}getOffset(){const a=this._parent;if(null===a)throw Error("Should never happen");
22
- return a.getChildOffset(this)}syncPropertiesFromYjs(a,b){const c=this.getNode();if(null===c)throw this.getNode(),Error("Should never happen");G(a,this._xmlText,c,b)}applyChildrenYjsDelta(a,b){const c=this._children;let d=0;for(let m=0;m<b.length;m++){var e=b[m],f=e.insert,h=e.delete;if(null!=e.retain)d+=e.retain;else if("number"===typeof h)for(f=h;0<f;){const {node:l,nodeIndex:r,offset:t,length:p}=R(this,d,!1);if(l instanceof Q||l instanceof B||l instanceof T)c.splice(r,1),--f;else if(l instanceof
23
- D){e=Math.min(f,p);h=0!==r?c[r-1]:null;var g=l.getSize();if(0===t&&1===e&&0<r&&h instanceof D&&p===g&&0===Array.from(l._map.keys()).length)h._text+=l._text,c.splice(r,1);else if(0===t&&e===g)c.splice(r,1);else{h=l._text;g=t;var k=e;h=h.slice(0,g)+""+h.slice(g+k);l._text=h}f-=e}else break}else if(null!=f)if("string"===typeof f){const {node:l,offset:r}=R(this,d,!0);l instanceof D?(e=l._text,h=r,g=f,e=e.slice(0,h)+g+e.slice(h+0),l._text=e):this._xmlText.delete(r,f.length);d+=f.length}else e=f,{nodeIndex:f}=
24
- R(this,d,!1),e=P(a,e,this),c.splice(f,0,e),d+=1;else throw Error("Unexpected delta format");}}syncChildrenFromYjs(a){var b=this.getNode();if(null===b)throw this.getNode(),Error("Should never happen");var c=b.__key;const d=b.__children;var e=[];const f=d.length,h=this._children,g=h.length,k=a.collabNodeMap,m=new Set;let l,r;g!==f&&(r=U(b,r,e));let t=0;for(let y=0;y<g;y++){var p=d[t];const x=h[y];var n=x.getNode(),v=x._key;if(null!==n&&p===v){n=q.$isTextNode(n);m.add(p);if(n)if(x._key=p,x instanceof
25
- Q)n=x._xmlText,x.syncPropertiesFromYjs(a,null),x.applyChildrenYjsDelta(a,n.toDelta()),x.syncChildrenFromYjs(a);else if(x instanceof D)x.syncPropertiesAndTextFromYjs(a,null);else if(x instanceof T)x.syncPropertiesFromYjs(a,null);else if(!(x instanceof B))throw Error("Should never happen");e[y]=p;t++}else{if(void 0===l)for(l=new Set,v=0;v<g;v++){var u=h[v]._key;""!==u&&l.add(u)}if(null===n||void 0===p||l.has(p)){r=U(b,r,e);p=a;n=x;v=c;u=n.getType();u=p.editor._nodes.get(u);if(void 0===u)throw Error("createLexicalNode failed");
26
- u=new u.klass;u.__parent=v;n._key=u.__key;n instanceof Q?(v=n._xmlText,n.syncPropertiesFromYjs(p,null),n.applyChildrenYjsDelta(p,v.toDelta()),n.syncChildrenFromYjs(p)):n instanceof D?n.syncPropertiesAndTextFromYjs(p,null):n instanceof T&&n.syncPropertiesFromYjs(p,null);p.collabNodeMap.set(u.__key,n);p=u.__key;k.set(p,x);e[y]=p}else y--,t++}}for(b=0;b<f;b++)e=d[b],m.has(e)||(c=K(e).getWritable(),e=a.collabNodeMap.get(e),void 0!==e&&e.destroy(a),c.__parent=null)}syncPropertiesFromLexical(a,b,c){F(a,
27
- this._xmlText,this.getPrevNode(c),b)}_syncChildFromLexical(a,b,c,d,e,f){b=this._children[b];c=K(c);b instanceof Q&&q.$isElementNode(c)?(b.syncPropertiesFromLexical(a,c,d),b.syncChildrenFromLexical(a,c,d,e,f)):b instanceof D&&q.$isTextNode(c)?b.syncPropertiesAndTextFromLexical(a,c,d):b instanceof T&&q.$isDecoratorNode(c)&&b.syncPropertiesFromLexical(a,c,d)}syncChildrenFromLexical(a,b,c,d,e){var f=this.getPrevNode(c);const h=null===f?[]:f.__children;f=b.__children;const g=h.length-1,k=f.length-1,m=
28
- a.collabNodeMap;let l,r,t=0;for(b=0;t<=g&&b<=k;){var p=h[t];const v=f[b];if(p===v)this._syncChildFromLexical(a,b,v,c,d,e),t++,b++;else{void 0===l&&(l=new Set(h));void 0===r&&(r=new Set(f));var n=r.has(p);p=l.has(v);n?(n=K(v),n=L(a,n,this),m.set(v,n),p?(this.splice(a,b,1,n),t++):this.splice(a,b,0,n),b++):(this.splice(a,b,1),t++)}}c=t>g;d=b>k;if(c&&!d)for(;b<=k;++b)c=f[b],d=K(c),d=L(a,d,this),this.append(d),m.set(c,d);else if(d&&!c)for(f=this._children.length-1;f>=b;f--)this.splice(a,f,1)}append(a){const b=
29
- this._xmlText;var c=this._children;c=c[c.length-1];c=void 0!==c?c.getOffset()+c.getSize():0;if(a instanceof Q)b.insertEmbed(c,a._xmlText);else if(a instanceof D){const d=a._map;null===d.parent&&b.insertEmbed(c,d);b.insert(c+1,a._text)}else a instanceof B?b.insertEmbed(c,a._map):a instanceof T&&b.insertEmbed(c,a._xmlElem);this._children.push(a)}splice(a,b,c,d){const e=this._children;var f=e[b];if(void 0===f)if(void 0!==d)this.append(d);else throw Error("Should never happen");else{var h=f.getOffset();
30
- if(-1===h)throw Error("Should never happen");var g=this._xmlText;0!==c&&g.delete(h,f.getSize());d instanceof Q?g.insertEmbed(h,d._xmlText):d instanceof D?(f=d._map,null===f.parent&&g.insertEmbed(h,f),g.insert(h+1,d._text)):d instanceof B?g.insertEmbed(h,d._map):d instanceof T&&g.insertEmbed(h,d._xmlElem);if(0!==c)for(h=e.slice(b,b+c),g=0;g<h.length;g++)h[g].destroy(a);void 0!==d?e.splice(b,c,d):e.splice(b,c)}}getChildOffset(a){let b=0;const c=this._children;for(let d=0;d<c.length;d++){const e=c[d];
31
- if(e===a)return b;b+=e.getSize()}return-1}destroy(a){const b=a.collabNodeMap,c=this._children;for(let d=0;d<c.length;d++)c[d].destroy(a);b.delete(this._key)}}function U(a,b,c){return void 0===b?(a=a.getWritable(),a.__children=c,a):b}function M(a,b,c){b=new Q(a,b,c);return a._collabNode=b}
32
- function V(a,b){b=b.collabNodeMap.get(a.key);if(void 0===b)return null;a=a.offset;let c=b.getSharedType();if(b instanceof D){c=b._parent._xmlText;b=b.getOffset();if(-1===b)return null;a=b+1+a}return w.createRelativePositionFromTypeIndex(c,a)}function W(a,b){if(null==a){if(null!=b)return!0}else if(null==b||!w.compareRelativePositions(a,b))return!0;return!1}function X(a,b){a=a.cursorsContainer;if(null!==a){b=b.selections;const c=b.length;for(let d=0;d<c;d++)a.removeChild(b[d])}}
33
- function Y(a){for(;null!=a;){if(3===a.nodeType)return a;a=a.firstChild}return null}function ba(a){const b=a.parentNode;if(null==b)throw Error("Should never happen");return[b,Array.from(b.childNodes).indexOf(a)]}
34
- function ca(a,b){var c=b.awareness.getLocalState();if(null!==c&&(b=c.anchorPos,c=c.focusPos,null!==b&&null!==c&&(b=w.createAbsolutePositionFromRelativePosition(b,a.doc),a=w.createAbsolutePositionFromRelativePosition(c,a.doc),null!==b&&null!==a))){const [e,f]=Z(b.type,b.index),[h,g]=Z(a.type,a.index);if(null!==e&&null!==h){const k=e.getKey();a=h.getKey();b=q.$getSelection();if(q.$isRangeSelection(b)){var d=b.anchor;c=b.focus;if(d.key!==k||d.offset!==f)d=q.$getNodeByKey(k),b.anchor.set(k,f,q.$isElementNode(d)?
35
- "element":"text");if(c.key!==a||c.offset!==g)c=q.$getNodeByKey(a),b.focus.set(a,g,q.$isElementNode(c)?"element":"text")}}}}function Z(a,b){a=a._collabNode;if(void 0===a)return[null,0];if(a instanceof Q){const {node:c,offset:d}=R(a,b,!0);return null===c?[a,0]:[c,d]}return[null,0]}
36
- function ia(a,b){var c=Array.from(b.awareness.getStates()),d=a.clientID;b=a.cursors;var e=a.editor._editorState._nodeMap;const f=new Set;for(var h=0;h<c.length;h++){const [I,ka]=c[h];if(I!==d){f.add(I);const {anchorPos:da,focusPos:ea,name:la,color:ma,focusing:na}=ka;var g=null,k=b.get(I);void 0===k&&(k={color:ma,name:la,selection:null},b.set(I,k));if(null!==da&&null!==ea&&na){var m=w.createAbsolutePositionFromRelativePosition(da,a.doc),l=w.createAbsolutePositionFromRelativePosition(ea,a.doc);if(null!==
37
- m&&null!==l){const [E,N]=Z(m.type,m.index),[fa,ha]=Z(l.type,l.index);if(null!==E&&null!==fa){l=E.getKey();var r=fa.getKey();g=k.selection;if(null===g){m=k;g=l;l=N;var t=ha,p=m.color,n=document.createElement("span");n.style.cssText=`position:absolute;top:0;bottom:0;right:-1px;width:1px;background-color:rgb(${p});z-index:10;`;var v=document.createElement("span");v.textContent=m.name;v.style.cssText=`position:absolute;left:-2px;top:-16px;background-color:rgb(${p});color:#fff;line-height:12px;height:12px;font-size:12px;padding:2px;font-family:Arial;font-weight:bold;white-space:nowrap;`;
38
- n.appendChild(v);g={anchor:{key:g,offset:l},caret:n,color:p,focus:{key:r,offset:t},name:v,range:document.createRange(),selections:[]}}else m=g.anchor,t=g.focus,m.key=l,m.offset=N,t.key=r,t.offset=ha}}}a:{m=a;l=k;n=g;var u=e;p=m.editor;r=p.getRootElement();k=m.cursorsContainer;if(null===k||null===r)break a;g=l.selection;if(null===n){null!==g&&(l.selection=null,X(m,g));break a}else l.selection=n;t=n.range;g=n.caret;l=n.color;m=n.selections;var y=n.anchor,x=n.focus;n=y.key;v=x.key;var A=u.get(n);const E=
39
- u.get(v);u=p.getElementByKey(n);p=p.getElementByKey(v);y=y.offset;x=x.offset;q.$isTextNode(A)&&(u=Y(u));q.$isTextNode(E)&&(p=Y(p));if(void 0!==A&&void 0!==E&&null!==u&&null!==p){"BR"===u.nodeName&&([u,y]=ba(u));"BR"===p.nodeName&&([p,x]=ba(p));A=u.firstChild;u===p&&null!=A&&"BR"===A.nodeName&&0===y&&0===x&&(x=1);try{t.setStart(u,y),t.setEnd(p,x)}catch(N){break a}!t.collapsed||y===x&&n===v||(t.setStart(p,x),t.setEnd(u,y));p=r.getBoundingClientRect();r=getComputedStyle(r);r=parseFloat(r.paddingLeft)+
40
- parseFloat(r.paddingRight);n=Array.from(t.getClientRects());t=n.length;v=m.length;for(A=0;A<t;A++)u=n[A],u.width+r===p.width?(n.splice(A--,1),t--):(y=m[A],void 0===y&&(y=document.createElement("span"),m[A]=y,k.appendChild(y)),y.style.cssText=`position:absolute;top:${u.top}px;left:${u.left}px;height:${u.height}px;width:${u.width}px;background-color:rgba(${l}, 0.3);pointer-events:none;z-index:10;`,A===t-1&&g.parentNode!==y&&y.appendChild(g));for(g=v-1;g>=t;g--)k.removeChild(m[g]),m.pop()}}}}c=Array.from(b.keys());
41
- for(d=0;d<c.length;d++)e=c[d],f.has(e)||(h=b.get(e),void 0!==h&&(h=h.selection,null!==h&&X(a,h),b.delete(e)))}function ja(a,b,c,d){b=b.awareness;var e=b.getLocalState();if(null!==e){var {anchorPos:f,focusPos:h,name:g,color:k,focusing:m}=e,l=e=null;if(null!==d&&(null===f||d.is(c))||null!==c)q.$isRangeSelection(d)&&(e=V(d.anchor,a),l=V(d.focus,a)),(W(f,e)||W(h,l))&&b.setLocalState({anchorPos:e,color:k,focusPos:l,focusing:m,name:g})}}const oa=q.createCommand(),pa=q.createCommand();
42
- exports.CONNECTED_COMMAND=oa;exports.TOGGLE_CONNECT_COMMAND=pa;exports.createBinding=function(a,b,c,d,e){if(void 0===d||null===d)throw Error("Should never happen");b=d.get("root",w.XmlText);b=M(b,null,"root");b._key="root";return{clientID:d.clientID,collabNodeMap:new Map,cursors:new Map,cursorsContainer:null,doc:d,docMap:e,editor:a,id:c,nodeProperties:new Map,root:b}};exports.createUndoManager=function(a,b){return new w.UndoManager(b,{trackedOrigins:new Set([a,null])})};
43
- exports.initLocalState=function(a,b,c,d){a.awareness.setLocalState({anchorPos:null,color:c,focusPos:null,focusing:d,name:b})};exports.setLocalStateFocus=function(a,b,c,d){({awareness:a}=a);let e=a.getLocalState();null===e&&(e={anchorPos:null,color:c,focusPos:null,focusing:d,name:b});e.focusing=d;a.setLocalState(e)};exports.syncCursorPositions=ia;
44
- exports.syncLexicalUpdateToYjs=function(a,b,c,d,e,f,h,g){aa(a,()=>{d.read(()=>{if(g.has("collaboration")){if(0<h.size){var k=Array.from(h),m=a.collabNodeMap,l=[];for(let n=0;n<k.length;n++){var r=k[n],t=q.$getNodeByKey(r),p=m.get(r);if(p instanceof D)if(q.$isTextNode(t))l.push([p,t.__text]);else{t=p.getOffset();if(-1===t)continue;const v=p._parent;p._normalized=!0;v._xmlText.delete(t,1);m.delete(r);r=v._children;p=r.indexOf(p);r.splice(p,1)}}for(k=0;k<l.length;k++){const [n,v]=l[k];n._text=v}}}else e.has("root")&&
45
- (l=c._nodeMap,k=q.$getRoot(),m=a.root,m.syncPropertiesFromLexical(a,k,l),m.syncChildrenFromLexical(a,k,l,e,f)),l=q.$getSelection(),ja(a,b,c._selection,l)})})};
46
- exports.syncYjsChangesToLexical=function(a,b,c){const d=a.editor,e=d._editorState;d.update(()=>{var f=d._pendingEditorState;for(var h=0;h<c.length;h++){var g=a,k=c[h],{target:m}=k;m=P(g,m);if(m instanceof Q&&k instanceof w.YTextEvent){const {keysChanged:l,childListChanged:r,delta:t}=k;0<l.size&&m.syncPropertiesFromYjs(g,l);r&&(m.applyChildrenYjsDelta(g,t),m.syncChildrenFromYjs(g))}else if(m instanceof D&&k instanceof w.YMapEvent)({keysChanged:k}=k),0<k.size&&m.syncPropertiesAndTextFromYjs(g,k);else if(m instanceof
47
- T&&k instanceof w.YXmlEvent)({attributesChanged:k}=k),0<k.size&&m.syncPropertiesFromYjs(g,k);else throw Error("Should never happen");}h=q.$getSelection();if(q.$isRangeSelection(h))if(S(h)){g=e._selection;if(q.$isRangeSelection(g)){m=z.$createOffsetView(d,0,e);f=z.$createOffsetView(d,0,f);const [l,r]=m.getOffsetsFromSelection(g);f=f.createSelectionFromOffsets(l,r,m);null!==f?q.$setSelection(f):(ca(a,b),S(h)&&(f=q.$getRoot(),0===f.getChildrenSize()&&f.append(q.$createParagraphNode()),q.$getRoot().selectEnd()))}ja(a,
48
- b,g,q.$getSelection())}else ca(a,b)},{onUpdate:()=>{ia(a,b)},skipTransforms:!0,tag:"collaboration"})};
14
+ function Q(a,b,c){const d=b._collabNode;if(void 0===d){var e=a.editor._nodes;const f=b instanceof w.Map?b.get("__type"):b.getAttribute("__type");if(null==f)throw Error("Should never happen");if(void 0===e.get(f))throw Error("Should never happen");e=b.parent;a=void 0===c&&null!==e?Q(a,e):c||null;if(!(a instanceof R))throw Error("Should never happen");if(b instanceof w.XmlText)return N(b,a,f);if(b instanceof w.Map){if(null===a)throw Error("Should never happen");return"linebreak"===f?C(b,a):I(b,"",a,
15
+ f)}if(b instanceof w.XmlElement)return P(b,a,f)}return d}function H(a,b,c,d){d=null===d?b instanceof w.Map?Array.from(b.keys()):Object.keys(b.getAttributes()):Array.from(d);let e;for(let g=0;g<d.length;g++){const h=d[g];if(K.has(h))continue;var f=c[h];let k=b instanceof w.Map?b.get(h):b.getAttribute(h);if(f!==k){if(k instanceof w.Doc){const m=a.docMap;f instanceof w.Doc&&m.delete(f.guid);f=q.createEditor();const l=k.guid;f._key=l;m.set(l,k);k=f}void 0===e&&(e=c.getWritable());e[h]=k}}}
16
+ function G(a,b,c,d){var e=d.__type,f=a.nodeProperties;let g=f.get(e);void 0===g&&(g=Object.keys(d).filter(k=>!K.has(k)),f.set(e,g));e=a.editor.constructor;for(f=0;f<g.length;f++){const k=g[f];var h=null===c?void 0:c[k];let m=d[k];if(h!==m){if(m instanceof e){const l=a.docMap;let t;h instanceof e&&(h=h._key,t=l.get(h),l.delete(h));h=t||new w.Doc;const u=h.guid;m._key=u;l.set(u,h);m=h;a.editor.update(()=>{d.markDirty()})}b instanceof w.Map?b.set(k,m):b.setAttribute(k,m)}}}
17
+ function S(a,b,c){let d=0,e=0;const f=a._children,g=f.length;for(;e<g;e++){a=f[e];const h=d,k=a.getSize();d+=k;if((c?d>=b:d>b)&&a instanceof D)return b=b-h-1,0>b&&(b=0),{length:k-b,node:a,nodeIndex:e,offset:b};if(d>b)return{length:0,node:a,nodeIndex:e,offset:h};if(e===g-1)return{length:0,node:null,nodeIndex:e+1,offset:h+1}}return{length:0,node:null,nodeIndex:0,offset:0}}
18
+ function T(a){const b=a.anchor;a=a.focus;let c=!1;try{const d=b.getNode(),e=a.getNode();if(!d.isAttached()||!e.isAttached()||q.$isTextNode(d)&&b.offset>d.getTextContentSize()||q.$isTextNode(e)&&a.offset>e.getTextContentSize())c=!0}catch(d){c=!0}return c}function aa(a,b){a.doc.transact(b,a)}
19
+ class U{constructor(a,b,c){this._key="";this._xmlElem=a;this._parent=b;this._type=c;this._unobservers=new Set}getPrevNode(a){if(null===a)return null;a=a.get(this._key);return q.$isDecoratorNode(a)?a:null}getNode(){const a=q.$getNodeByKey(this._key);return q.$isDecoratorNode(a)?a:null}getSharedType(){return this._xmlElem}getType(){return this._type}getKey(){return this._key}getSize(){return 1}getOffset(){return this._parent.getChildOffset(this)}syncPropertiesFromLexical(a,b,c){c=this.getPrevNode(c);
20
+ G(a,this._xmlElem,c,b)}syncPropertiesFromYjs(a,b){const c=this.getNode();if(null===c)throw Error("Should never happen");H(a,this._xmlElem,c,b)}destroy(a){a.collabNodeMap.delete(this._key);this._unobservers.forEach(b=>b());this._unobservers.clear()}}function P(a,b,c){b=new U(a,b,c);return a._collabNode=b}
21
+ class R{constructor(a,b,c){this._key="";this._children=[];this._xmlText=a;this._type=c;this._parent=b}getPrevNode(a){if(null===a)return null;a=a.get(this._key);return q.$isElementNode(a)?a:null}getNode(){const a=q.$getNodeByKey(this._key);return q.$isElementNode(a)?a:null}getSharedType(){return this._xmlText}getType(){return this._type}getKey(){return this._key}isEmpty(){return 0===this._children.length}getSize(){return 1}getOffset(){const a=this._parent;if(null===a)throw Error("Should never happen");
22
+ return a.getChildOffset(this)}syncPropertiesFromYjs(a,b){const c=this.getNode();if(null===c)throw this.getNode(),Error("Should never happen");H(a,this._xmlText,c,b)}applyChildrenYjsDelta(a,b){const c=this._children;let d=0;for(let m=0;m<b.length;m++){var e=b[m],f=e.insert,g=e.delete;if(null!=e.retain)d+=e.retain;else if("number"===typeof g)for(f=g;0<f;){const {node:l,nodeIndex:t,offset:u,length:p}=S(this,d,!1);if(l instanceof R||l instanceof B||l instanceof U)c.splice(t,1),--f;else if(l instanceof
23
+ D){e=Math.min(f,p);g=0!==t?c[t-1]:null;var h=l.getSize();if(0===u&&1===e&&0<t&&g instanceof D&&p===h&&0===Array.from(l._map.keys()).length)g._text+=l._text,c.splice(t,1);else if(0===u&&e===h)c.splice(t,1);else{g=l._text;h=u;var k=e;g=g.slice(0,h)+""+g.slice(h+k);l._text=g}f-=e}else break}else if(null!=f)if("string"===typeof f){const {node:l,offset:t}=S(this,d,!0);l instanceof D?(e=l._text,g=t,h=f,e=e.slice(0,g)+h+e.slice(g+0),l._text=e):this._xmlText.delete(t,f.length);d+=f.length}else e=f,{nodeIndex:f}=
24
+ S(this,d,!1),e=Q(a,e,this),c.splice(f,0,e),d+=1;else throw Error("Unexpected delta format");}}syncChildrenFromYjs(a){var b=this.getNode();if(null===b)throw this.getNode(),Error("Should never happen");var c=b.__key;const d=b.__children;var e=[];const f=d.length,g=this._children,h=g.length,k=a.collabNodeMap,m=new Set;let l,t;h!==f&&(t=V(b,t,e));let u=0;for(let x=0;x<h;x++){var p=d[u];const y=g[x];var n=y.getNode(),r=y._key;if(null!==n&&p===r){n=q.$isTextNode(n);m.add(p);if(n)if(y._key=p,y instanceof
25
+ R)n=y._xmlText,y.syncPropertiesFromYjs(a,null),y.applyChildrenYjsDelta(a,n.toDelta()),y.syncChildrenFromYjs(a);else if(y instanceof D)y.syncPropertiesAndTextFromYjs(a,null);else if(y instanceof U)y.syncPropertiesFromYjs(a,null);else if(!(y instanceof B))throw Error("Should never happen");e[x]=p;u++}else{if(void 0===l)for(l=new Set,r=0;r<h;r++){var v=g[r]._key;""!==v&&l.add(v)}if(null===n||void 0===p||l.has(p)){t=V(b,t,e);p=a;n=y;r=c;v=n.getType();v=p.editor._nodes.get(v);if(void 0===v)throw Error("createLexicalNode failed");
26
+ v=new v.klass;v.__parent=r;n._key=v.__key;n instanceof R?(r=n._xmlText,n.syncPropertiesFromYjs(p,null),n.applyChildrenYjsDelta(p,r.toDelta()),n.syncChildrenFromYjs(p)):n instanceof D?n.syncPropertiesAndTextFromYjs(p,null):n instanceof U&&n.syncPropertiesFromYjs(p,null);p.collabNodeMap.set(v.__key,n);p=v.__key;k.set(p,y);e[x]=p}else x--,u++}}for(b=0;b<f;b++)e=d[b],m.has(e)||(c=L(e).getWritable(),e=a.collabNodeMap.get(e),void 0!==e&&e.destroy(a),c.__parent=null)}syncPropertiesFromLexical(a,b,c){G(a,
27
+ this._xmlText,this.getPrevNode(c),b)}_syncChildFromLexical(a,b,c,d,e,f){b=this._children[b];c=L(c);b instanceof R&&q.$isElementNode(c)?(b.syncPropertiesFromLexical(a,c,d),b.syncChildrenFromLexical(a,c,d,e,f)):b instanceof D&&q.$isTextNode(c)?b.syncPropertiesAndTextFromLexical(a,c,d):b instanceof U&&q.$isDecoratorNode(c)&&b.syncPropertiesFromLexical(a,c,d)}syncChildrenFromLexical(a,b,c,d,e){var f=this.getPrevNode(c);const g=null===f?[]:f.__children;f=b.__children;const h=g.length-1,k=f.length-1,m=
28
+ a.collabNodeMap;let l,t,u=0;for(b=0;u<=h&&b<=k;){var p=g[u];const r=f[b];if(p===r)this._syncChildFromLexical(a,b,r,c,d,e),u++,b++;else{void 0===l&&(l=new Set(g));void 0===t&&(t=new Set(f));var n=t.has(p);p=l.has(r);n?(n=L(r),n=M(a,n,this),m.set(r,n),p?(this.splice(a,b,1,n),u++):this.splice(a,b,0,n),b++):(this.splice(a,b,1),u++)}}c=u>h;d=b>k;if(c&&!d)for(;b<=k;++b)c=f[b],d=L(c),d=M(a,d,this),this.append(d),m.set(c,d);else if(d&&!c)for(f=this._children.length-1;f>=b;f--)this.splice(a,f,1)}append(a){const b=
29
+ this._xmlText;var c=this._children;c=c[c.length-1];c=void 0!==c?c.getOffset()+c.getSize():0;if(a instanceof R)b.insertEmbed(c,a._xmlText);else if(a instanceof D){const d=a._map;null===d.parent&&b.insertEmbed(c,d);b.insert(c+1,a._text)}else a instanceof B?b.insertEmbed(c,a._map):a instanceof U&&b.insertEmbed(c,a._xmlElem);this._children.push(a)}splice(a,b,c,d){const e=this._children;var f=e[b];if(void 0===f)if(void 0!==d)this.append(d);else throw Error("Should never happen");else{var g=f.getOffset();
30
+ if(-1===g)throw Error("Should never happen");var h=this._xmlText;0!==c&&h.delete(g,f.getSize());d instanceof R?h.insertEmbed(g,d._xmlText):d instanceof D?(f=d._map,null===f.parent&&h.insertEmbed(g,f),h.insert(g+1,d._text)):d instanceof B?h.insertEmbed(g,d._map):d instanceof U&&h.insertEmbed(g,d._xmlElem);if(0!==c)for(g=e.slice(b,b+c),h=0;h<g.length;h++)g[h].destroy(a);void 0!==d?e.splice(b,c,d):e.splice(b,c)}}getChildOffset(a){let b=0;const c=this._children;for(let d=0;d<c.length;d++){const e=c[d];
31
+ if(e===a)return b;b+=e.getSize()}return-1}destroy(a){const b=a.collabNodeMap,c=this._children;for(let d=0;d<c.length;d++)c[d].destroy(a);b.delete(this._key)}}function V(a,b,c){return void 0===b?(a=a.getWritable(),a.__children=c,a):b}function N(a,b,c){b=new R(a,b,c);return a._collabNode=b}
32
+ function W(a,b){b=b.collabNodeMap.get(a.key);if(void 0===b)return null;a=a.offset;let c=b.getSharedType();if(b instanceof D){c=b._parent._xmlText;b=b.getOffset();if(-1===b)return null;a=b+1+a}return w.createRelativePositionFromTypeIndex(c,a)}function X(a,b){if(null==a){if(null!=b)return!0}else if(null==b||!w.compareRelativePositions(a,b))return!0;return!1}function Y(a,b){a=a.cursorsContainer;if(null!==a){b=b.selections;const c=b.length;for(let d=0;d<c;d++)a.removeChild(b[d])}}
33
+ function ba(a){for(;null!=a;){if(3===a.nodeType)return a;a=a.firstChild}return null}function ca(a){const b=a.parentNode;if(null==b)throw Error("Should never happen");return[b,Array.from(b.childNodes).indexOf(a)]}
34
+ function da(a,b){var c=b.awareness.getLocalState();if(null!==c&&(b=c.anchorPos,c=c.focusPos,null!==b&&null!==c&&(b=w.createAbsolutePositionFromRelativePosition(b,a.doc),a=w.createAbsolutePositionFromRelativePosition(c,a.doc),null!==b&&null!==a))){const [e,f]=Z(b.type,b.index),[g,h]=Z(a.type,a.index);if(null!==e&&null!==g){const k=e.getKey();a=g.getKey();b=q.$getSelection();if(q.$isRangeSelection(b)){var d=b.anchor;c=b.focus;if(d.key!==k||d.offset!==f)d=q.$getNodeByKey(k),b.anchor.set(k,f,q.$isElementNode(d)?
35
+ "element":"text");if(c.key!==a||c.offset!==h)c=q.$getNodeByKey(a),b.focus.set(a,h,q.$isElementNode(c)?"element":"text")}}}}function Z(a,b){a=a._collabNode;if(void 0===a)return[null,0];if(a instanceof R){const {node:c,offset:d}=S(a,b,!0);return null===c?[a,0]:[c,d]}return[null,0]}
36
+ function ja(a,b){var c=Array.from(b.awareness.getStates()),d=a.clientID;b=a.cursors;var e=a.editor._editorState._nodeMap;const f=new Set;for(var g=0;g<c.length;g++){const [J,la]=c[g];if(J!==d){f.add(J);const {anchorPos:ea,focusPos:fa,name:ma,color:na,focusing:oa}=la;var h=null,k=b.get(J);void 0===k&&(k={color:na,name:ma,selection:null},b.set(J,k));if(null!==ea&&null!==fa&&oa){var m=w.createAbsolutePositionFromRelativePosition(ea,a.doc),l=w.createAbsolutePositionFromRelativePosition(fa,a.doc);if(null!==
37
+ m&&null!==l){const [E,O]=Z(m.type,m.index),[ha,ia]=Z(l.type,l.index);if(null!==E&&null!==ha){l=E.getKey();var t=ha.getKey();h=k.selection;if(null===h){m=k;h=O;var u=ia,p=m.color,n=document.createElement("span");n.style.cssText=`position:absolute;top:0;bottom:0;right:-1px;width:1px;background-color:rgb(${p});z-index:10;`;var r=document.createElement("span");r.textContent=m.name;r.style.cssText=`position:absolute;left:-2px;top:-16px;background-color:rgb(${p});color:#fff;line-height:12px;height:12px;font-size:12px;padding:2px;font-family:Arial;font-weight:bold;white-space:nowrap;`;
38
+ n.appendChild(r);h={anchor:{key:l,offset:h},caret:n,color:p,focus:{key:t,offset:u},name:r,range:document.createRange(),selections:[]}}else m=h.anchor,u=h.focus,m.key=l,m.offset=O,u.key=t,u.offset=ia}}}a:{m=void 0;l=a;t=k;r=h;var v=e;n=l.editor;u=n.getRootElement();k=l.cursorsContainer;if(null===k||null===u)break a;h=t.selection;if(null===r){null!==h&&(t.selection=null,Y(l,h));break a}else t.selection=r;p=r.range;h=r.caret;t=r.color;l=r.selections;var x=r.anchor,y=r.focus;r=x.key;var F=y.key,A=v.get(r);
39
+ const E=v.get(F);v=n.getElementByKey(r);n=n.getElementByKey(F);x=x.offset;y=y.offset;q.$isTextNode(A)&&(v=ba(v));q.$isTextNode(E)&&(n=ba(n));if(void 0!==A&&void 0!==E&&null!==v&&null!==n){"BR"===v.nodeName&&([v,x]=ca(v));"BR"===n.nodeName&&([n,y]=ca(n));A=v.firstChild;v===n&&null!=A&&"BR"===A.nodeName&&0===x&&0===y&&(y=1);try{p.setStart(v,x),p.setEnd(n,y)}catch(O){break a}!p.collapsed||x===y&&r===F||(p.setStart(n,y),p.setEnd(v,x));n=u.getBoundingClientRect();u=getComputedStyle(u);u=parseFloat(u.paddingLeft)+
40
+ parseFloat(u.paddingRight);r=Array.from(p.getClientRects());p=r.length;F=l.length;for(A=0;A<p;A++)v=r[A],x=v.width+u===n.width,m&&m.top===v.top&&m.left===v.left&&m.width===v.width&&m.height===v.height||x?(r.splice(A--,1),p--):(m=v,x=l[A],void 0===x&&(x=document.createElement("span"),l[A]=x,k.appendChild(x)),x.style.cssText=`position:absolute;top:${v.top}px;left:${v.left}px;height:${v.height}px;width:${v.width}px;background-color:rgba(${t}, 0.3);pointer-events:none;z-index:10;`,A===p-1&&h.parentNode!==
41
+ x&&x.appendChild(h));for(m=F-1;m>=p;m--)k.removeChild(l[m]),l.pop()}}}}c=Array.from(b.keys());for(d=0;d<c.length;d++)e=c[d],f.has(e)||(g=b.get(e),void 0!==g&&(g=g.selection,null!==g&&Y(a,g),b.delete(e)))}
42
+ function ka(a,b,c,d){b=b.awareness;var e=b.getLocalState();if(null!==e){var {anchorPos:f,focusPos:g,name:h,color:k,focusing:m}=e,l=e=null;if(null!==d&&(null===f||d.is(c))||null!==c)q.$isRangeSelection(d)&&(e=W(d.anchor,a),l=W(d.focus,a)),(X(f,e)||X(g,l))&&b.setLocalState({anchorPos:e,color:k,focusPos:l,focusing:m,name:h})}}const pa=q.createCommand(),qa=q.createCommand();exports.CONNECTED_COMMAND=pa;exports.TOGGLE_CONNECT_COMMAND=qa;
43
+ exports.createBinding=function(a,b,c,d,e){if(void 0===d||null===d)throw Error("Should never happen");b=d.get("root",w.XmlText);b=N(b,null,"root");b._key="root";return{clientID:d.clientID,collabNodeMap:new Map,cursors:new Map,cursorsContainer:null,doc:d,docMap:e,editor:a,id:c,nodeProperties:new Map,root:b}};exports.createUndoManager=function(a,b){return new w.UndoManager(b,{trackedOrigins:new Set([a,null])})};
44
+ exports.initLocalState=function(a,b,c,d){a.awareness.setLocalState({anchorPos:null,color:c,focusPos:null,focusing:d,name:b})};exports.setLocalStateFocus=function(a,b,c,d){({awareness:a}=a);let e=a.getLocalState();null===e&&(e={anchorPos:null,color:c,focusPos:null,focusing:d,name:b});e.focusing=d;a.setLocalState(e)};exports.syncCursorPositions=ja;
45
+ exports.syncLexicalUpdateToYjs=function(a,b,c,d,e,f,g,h){aa(a,()=>{d.read(()=>{if(h.has("collaboration")){if(0<g.size){var k=Array.from(g),m=a.collabNodeMap,l=[];for(let n=0;n<k.length;n++){var t=k[n],u=q.$getNodeByKey(t),p=m.get(t);if(p instanceof D)if(q.$isTextNode(u))l.push([p,u.__text]);else{u=p.getOffset();if(-1===u)continue;const r=p._parent;p._normalized=!0;r._xmlText.delete(u,1);m.delete(t);t=r._children;p=t.indexOf(p);t.splice(p,1)}}for(k=0;k<l.length;k++){const [n,r]=l[k];n._text=r}}}else e.has("root")&&
46
+ (l=c._nodeMap,k=q.$getRoot(),m=a.root,m.syncPropertiesFromLexical(a,k,l),m.syncChildrenFromLexical(a,k,l,e,f)),l=q.$getSelection(),ka(a,b,c._selection,l)})})};
47
+ exports.syncYjsChangesToLexical=function(a,b,c){const d=a.editor,e=d._editorState;d.update(()=>{var f=d._pendingEditorState;for(var g=0;g<c.length;g++){var h=a,k=c[g],{target:m}=k;m=Q(h,m);if(m instanceof R&&k instanceof w.YTextEvent){const {keysChanged:l,childListChanged:t,delta:u}=k;0<l.size&&m.syncPropertiesFromYjs(h,l);t&&(m.applyChildrenYjsDelta(h,u),m.syncChildrenFromYjs(h))}else if(m instanceof D&&k instanceof w.YMapEvent)({keysChanged:k}=k),0<k.size&&m.syncPropertiesAndTextFromYjs(h,k);else if(m instanceof
48
+ U&&k instanceof w.YXmlEvent)({attributesChanged:k}=k),0<k.size&&m.syncPropertiesFromYjs(h,k);else throw Error("Should never happen");}g=q.$getSelection();if(q.$isRangeSelection(g))if(T(g)){h=e._selection;if(q.$isRangeSelection(h)){m=z.$createOffsetView(d,0,e);f=z.$createOffsetView(d,0,f);const [l,t]=m.getOffsetsFromSelection(h);f=f.createSelectionFromOffsets(l,t,m);null!==f?q.$setSelection(f):(da(a,b),T(g)&&(f=q.$getRoot(),0===f.getChildrenSize()&&f.append(q.$createParagraphNode()),q.$getRoot().selectEnd()))}ka(a,
49
+ b,h,q.$getSelection())}else da(a,b)},{onUpdate:()=>{ja(a,b)},skipTransforms:!0,tag:"collaboration"})};
package/package.json CHANGED
@@ -11,13 +11,13 @@
11
11
  "crdt"
12
12
  ],
13
13
  "license": "MIT",
14
- "version": "0.2.2",
14
+ "version": "0.2.3",
15
15
  "main": "LexicalYjs.js",
16
16
  "dependencies": {
17
- "@lexical/offset": "0.2.2"
17
+ "@lexical/offset": "0.2.3"
18
18
  },
19
19
  "peerDependencies": {
20
- "lexical": "0.2.2",
20
+ "lexical": "0.2.3",
21
21
  "yjs": ">=13.5.22"
22
22
  },
23
23
  "repository": {