@lexical/yjs 0.12.2 → 0.12.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/CollabDecoratorNode.d.ts +0 -1
- package/LexicalYjs.dev.js +49 -335
- package/LexicalYjs.prod.js +2 -2
- package/package.json +3 -3
package/LexicalYjs.prod.js
CHANGED
|
@@ -18,8 +18,8 @@ function Q(a,b,c){let d=0,e=0,f=a._children,h=f.length;for(;e<h;e++){a=f[e];let
|
|
|
18
18
|
function R(a){let b=a.anchor;a=a.focus;let c=!1;try{let d=b.getNode(),e=a.getNode();if(!d.isAttached()||!e.isAttached()||r.$isTextNode(d)&&b.offset>d.getTextContentSize()||r.$isTextNode(e)&&a.offset>e.getTextContentSize())c=!0}catch(d){c=!0}return c}function la(a,b){a.doc.transact(b,a)}function S(a,b){let c=[];for(a=a.__first;null!==a;){let d=null===b?r.$getNodeByKey(a):b.get(a);null!==d&&void 0!==d||A(101);c.push(a);a=d.__next}return c}
|
|
19
19
|
function T(a){var b=a.getParent();if(null!==b){let e=a.getWritable();b=b.getWritable();var c=a.getPreviousSibling();a=a.getNextSibling();if(null===c)if(null!==a){var d=a.getWritable();b.__first=a.__key;d.__prev=null}else b.__first=null;else{d=c.getWritable();if(null!==a){let f=a.getWritable();f.__prev=d.__key;d.__next=f.__key}else d.__next=null;e.__prev=null}null===a?null!==c?(a=c.getWritable(),b.__last=c.__key,a.__next=null):b.__last=null:(a=a.getWritable(),null!==c?(c=c.getWritable(),c.__next=a.__key,
|
|
20
20
|
a.__prev=c.__key):a.__prev=null,e.__next=null);b.__size--;e.__parent=null}}
|
|
21
|
-
class U{constructor(a,b,c){this._key="";this._xmlElem=a;this._parent=b;this._type=c
|
|
22
|
-
|
|
21
|
+
class U{constructor(a,b,c){this._key="";this._xmlElem=a;this._parent=b;this._type=c}getPrevNode(a){if(null===a)return null;a=a.get(this._key);return r.$isDecoratorNode(a)?a:null}getNode(){let a=r.$getNodeByKey(this._key);return r.$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);G(a,this._xmlElem,c,b)}syncPropertiesFromYjs(a,
|
|
22
|
+
b){let c=this.getNode();null===c&&A(83);H(a,this._xmlElem,c,b)}destroy(a){a.collabNodeMap.delete(this._key)}}function N(a,b,c){b=new U(a,b,c);return a._collabNode=b}
|
|
23
23
|
class P{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 r.$isElementNode(a)?a:null}getNode(){let a=r.$getNodeByKey(this._key);return r.$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(){let a=this._parent;null===a&&A(90);return a.getChildOffset(this)}syncPropertiesFromYjs(a,
|
|
24
24
|
b){let c=this.getNode();null===c&&A(91);H(a,this._xmlText,c,b)}applyChildrenYjsDelta(a,b){let c=this._children,d=0;for(let n=0;n<b.length;n++){var e=b[n],f=e.insert,h=e.delete;if(null!=e.retain)d+=e.retain;else if("number"===typeof h)for(f=h;0<f;){let {node:k,nodeIndex:l,offset:q,length:u}=Q(this,d,!1);if(k instanceof P||k instanceof C||k instanceof U)c.splice(l,1),--f;else if(k instanceof F){e=Math.min(f,u);h=0!==l?c[l-1]:null;var g=k.getSize();if(0===q&&1===e&&0<l&&h instanceof F&&u===g&&0===Array.from(k._map.keys()).length)h._text+=
|
|
25
25
|
k._text,c.splice(l,1);else if(0===q&&e===g)c.splice(l,1);else{h=k;g=k._text;var m=q,p=e;g=g.slice(0,m)+""+g.slice(m+p);h._text=g}f-=e}else break}else if(null!=f)if("string"===typeof f){let {node:k,offset:l}=Q(this,d,!0);k instanceof F?(e=k,h=k._text,g=l,m=f,h=h.slice(0,g)+m+h.slice(g+0),e._text=h):this._xmlText.delete(l,f.length);d+=f.length}else e=f,{nodeIndex:f}=Q(this,d,!1),e=O(a,e,this),c.splice(f,0,e),d+=1;else throw Error("Unexpected delta format");}}syncChildrenFromYjs(a){var b=this.getNode();
|
package/package.json
CHANGED
|
@@ -11,13 +11,13 @@
|
|
|
11
11
|
"crdt"
|
|
12
12
|
],
|
|
13
13
|
"license": "MIT",
|
|
14
|
-
"version": "0.12.
|
|
14
|
+
"version": "0.12.3",
|
|
15
15
|
"main": "LexicalYjs.js",
|
|
16
16
|
"dependencies": {
|
|
17
|
-
"@lexical/offset": "0.12.
|
|
17
|
+
"@lexical/offset": "0.12.3"
|
|
18
18
|
},
|
|
19
19
|
"peerDependencies": {
|
|
20
|
-
"lexical": "0.12.
|
|
20
|
+
"lexical": "0.12.3",
|
|
21
21
|
"yjs": ">=13.5.22"
|
|
22
22
|
},
|
|
23
23
|
"repository": {
|