Compare commits
3 Commits
v13.0.0-48
...
v13.0.0-49
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
fdcc19d8f5 | ||
|
|
bbd3317d62 | ||
|
|
5d3922cb64 |
2
package-lock.json
generated
2
package-lock.json
generated
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "yjs",
|
"name": "yjs",
|
||||||
"version": "13.0.0-48",
|
"version": "13.0.0-49",
|
||||||
"lockfileVersion": 1,
|
"lockfileVersion": 1,
|
||||||
"requires": true,
|
"requires": true,
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "yjs",
|
"name": "yjs",
|
||||||
"version": "13.0.0-48",
|
"version": "13.0.0-49",
|
||||||
"description": "A framework for real-time p2p shared editing on any data",
|
"description": "A framework for real-time p2p shared editing on any data",
|
||||||
"main": "./y.node.js",
|
"main": "./y.node.js",
|
||||||
"browser": "./y.js",
|
"browser": "./y.js",
|
||||||
|
|||||||
@@ -55,14 +55,16 @@ export default class Item {
|
|||||||
/**
|
/**
|
||||||
* Copy the effect of struct
|
* Copy the effect of struct
|
||||||
*/
|
*/
|
||||||
_copy () {
|
_copy (undeleteChildren, copyPosition) {
|
||||||
let struct = new this.constructor()
|
let struct = new this.constructor()
|
||||||
struct._origin = this._left
|
if (copyPosition) {
|
||||||
struct._left = this._left
|
struct._origin = this._left
|
||||||
struct._right = this
|
struct._left = this._left
|
||||||
struct._right_origin = this
|
struct._right = this
|
||||||
struct._parent = this._parent
|
struct._right_origin = this
|
||||||
struct._parentSub = this._parentSub
|
struct._parent = this._parent
|
||||||
|
struct._parentSub = this._parentSub
|
||||||
|
}
|
||||||
return struct
|
return struct
|
||||||
}
|
}
|
||||||
get _lastId () {
|
get _lastId () {
|
||||||
|
|||||||
@@ -6,8 +6,8 @@ export default class ItemJSON extends Item {
|
|||||||
super()
|
super()
|
||||||
this._content = null
|
this._content = null
|
||||||
}
|
}
|
||||||
_copy () {
|
_copy (undeleteChildren, copyPosition) {
|
||||||
let struct = super._copy()
|
let struct = super._copy(undeleteChildren, copyPosition)
|
||||||
struct._content = this._content
|
struct._content = this._content
|
||||||
return struct
|
return struct
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,8 +6,8 @@ export default class ItemString extends Item {
|
|||||||
super()
|
super()
|
||||||
this._content = null
|
this._content = null
|
||||||
}
|
}
|
||||||
_copy () {
|
_copy (undeleteChildren, copyPosition) {
|
||||||
let struct = super._copy()
|
let struct = super._copy(undeleteChildren, copyPosition)
|
||||||
struct._content = this._content
|
struct._content = this._content
|
||||||
return struct
|
return struct
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -79,15 +79,16 @@ export default class Type extends Item {
|
|||||||
type = type._parent
|
type = type._parent
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
_copy (undeleteChildren) {
|
_copy (undeleteChildren, copyPosition) {
|
||||||
let copy = super._copy()
|
let copy = super._copy(undeleteChildren, copyPosition)
|
||||||
let map = new Map()
|
let map = new Map()
|
||||||
copy._map = map
|
copy._map = map
|
||||||
for (let [key, value] of this._map) {
|
for (let [key, value] of this._map) {
|
||||||
if (undeleteChildren.has(value) || !value.deleted) {
|
if (undeleteChildren.has(value) || !value.deleted) {
|
||||||
let _item = value._copy(undeleteChildren)
|
let _item = value._copy(undeleteChildren, false)
|
||||||
_item._parent = copy
|
_item._parent = copy
|
||||||
map.set(key, value._copy(undeleteChildren))
|
_item._parentSub = key
|
||||||
|
map.set(key, _item)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
let prevUndeleted = null
|
let prevUndeleted = null
|
||||||
@@ -95,7 +96,7 @@ export default class Type extends Item {
|
|||||||
let item = this._start
|
let item = this._start
|
||||||
while (item !== null) {
|
while (item !== null) {
|
||||||
if (undeleteChildren.has(item) || !item.deleted) {
|
if (undeleteChildren.has(item) || !item.deleted) {
|
||||||
let _item = item._copy(undeleteChildren)
|
let _item = item._copy(undeleteChildren, false)
|
||||||
_item._left = prevUndeleted
|
_item._left = prevUndeleted
|
||||||
_item._origin = prevUndeleted
|
_item._origin = prevUndeleted
|
||||||
_item._right = null
|
_item._right = null
|
||||||
|
|||||||
@@ -20,8 +20,8 @@ export default class YXmlElement extends YXmlFragment {
|
|||||||
this._domFilter = arg2
|
this._domFilter = arg2
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
_copy (undeleteChildren) {
|
_copy (undeleteChildren, copyPosition) {
|
||||||
let struct = super._copy(undeleteChildren)
|
let struct = super._copy(undeleteChildren, copyPosition)
|
||||||
struct.nodeName = this.nodeName
|
struct.nodeName = this.nodeName
|
||||||
return struct
|
return struct
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -152,18 +152,20 @@ export default class YXmlFragment extends YArray {
|
|||||||
attributes.set(key, attrs[key])
|
attributes.set(key, attrs[key])
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
let result = this._domFilter(this.nodeName, new Map(attributes))
|
this._y.transact(() => {
|
||||||
if (result === null) {
|
let result = this._domFilter(this.nodeName, new Map(attributes))
|
||||||
this._delete(this._y)
|
if (result === null) {
|
||||||
} else {
|
this._delete(this._y)
|
||||||
attributes.forEach((value, key) => {
|
} else {
|
||||||
if (!result.has(key)) {
|
attributes.forEach((value, key) => {
|
||||||
this.removeAttribute(key)
|
if (!result.has(key)) {
|
||||||
}
|
this.removeAttribute(key)
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
this.forEach(xml => {
|
||||||
|
xml.setDomFilter(f)
|
||||||
})
|
})
|
||||||
}
|
|
||||||
this.forEach(xml => {
|
|
||||||
xml.setDomFilter(f)
|
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
_callObserver (transaction, parentSubs, remote) {
|
_callObserver (transaction, parentSubs, remote) {
|
||||||
|
|||||||
@@ -14,6 +14,11 @@ export default class YXmlHook extends YMap {
|
|||||||
getHook(hookName).fillType(dom, this)
|
getHook(hookName).fillType(dom, this)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
_copy (undeleteChildren, copyPosition) {
|
||||||
|
const struct = super._copy(undeleteChildren, copyPosition)
|
||||||
|
struct.hookName = this.hookName
|
||||||
|
return struct
|
||||||
|
}
|
||||||
getDom (_document) {
|
getDom (_document) {
|
||||||
_document = _document || document
|
_document = _document || document
|
||||||
if (this._dom === null) {
|
if (this._dom === null) {
|
||||||
|
|||||||
@@ -50,7 +50,7 @@ function applyReverseOperation (y, scope, reverseBuffer) {
|
|||||||
)
|
)
|
||||||
) {
|
) {
|
||||||
performedUndo = true
|
performedUndo = true
|
||||||
op = op._copy(undoOp.deletedStructs)
|
op = op._copy(undoOp.deletedStructs, true)
|
||||||
op._integrate(y)
|
op._integrate(y)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
72
y.node.js
72
y.node.js
@@ -1,7 +1,7 @@
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* yjs - A framework for real-time p2p shared editing on any data
|
* yjs - A framework for real-time p2p shared editing on any data
|
||||||
* @version v13.0.0-48
|
* @version v13.0.0-49
|
||||||
* @license MIT
|
* @license MIT
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@@ -1344,14 +1344,16 @@ class Item {
|
|||||||
/**
|
/**
|
||||||
* Copy the effect of struct
|
* Copy the effect of struct
|
||||||
*/
|
*/
|
||||||
_copy () {
|
_copy (undeleteChildren, copyPosition) {
|
||||||
let struct = new this.constructor();
|
let struct = new this.constructor();
|
||||||
struct._origin = this._left;
|
if (copyPosition) {
|
||||||
struct._left = this._left;
|
struct._origin = this._left;
|
||||||
struct._right = this;
|
struct._left = this._left;
|
||||||
struct._right_origin = this;
|
struct._right = this;
|
||||||
struct._parent = this._parent;
|
struct._right_origin = this;
|
||||||
struct._parentSub = this._parentSub;
|
struct._parent = this._parent;
|
||||||
|
struct._parentSub = this._parentSub;
|
||||||
|
}
|
||||||
return struct
|
return struct
|
||||||
}
|
}
|
||||||
get _lastId () {
|
get _lastId () {
|
||||||
@@ -1718,15 +1720,16 @@ class Type extends Item {
|
|||||||
type = type._parent;
|
type = type._parent;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
_copy (undeleteChildren) {
|
_copy (undeleteChildren, copyPosition) {
|
||||||
let copy = super._copy();
|
let copy = super._copy(undeleteChildren, copyPosition);
|
||||||
let map = new Map();
|
let map = new Map();
|
||||||
copy._map = map;
|
copy._map = map;
|
||||||
for (let [key, value] of this._map) {
|
for (let [key, value] of this._map) {
|
||||||
if (undeleteChildren.has(value) || !value.deleted) {
|
if (undeleteChildren.has(value) || !value.deleted) {
|
||||||
let _item = value._copy(undeleteChildren);
|
let _item = value._copy(undeleteChildren, false);
|
||||||
_item._parent = copy;
|
_item._parent = copy;
|
||||||
map.set(key, value._copy(undeleteChildren));
|
_item._parentSub = key;
|
||||||
|
map.set(key, _item);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
let prevUndeleted = null;
|
let prevUndeleted = null;
|
||||||
@@ -1734,7 +1737,7 @@ class Type extends Item {
|
|||||||
let item = this._start;
|
let item = this._start;
|
||||||
while (item !== null) {
|
while (item !== null) {
|
||||||
if (undeleteChildren.has(item) || !item.deleted) {
|
if (undeleteChildren.has(item) || !item.deleted) {
|
||||||
let _item = item._copy(undeleteChildren);
|
let _item = item._copy(undeleteChildren, false);
|
||||||
_item._left = prevUndeleted;
|
_item._left = prevUndeleted;
|
||||||
_item._origin = prevUndeleted;
|
_item._origin = prevUndeleted;
|
||||||
_item._right = null;
|
_item._right = null;
|
||||||
@@ -1814,8 +1817,8 @@ class ItemJSON extends Item {
|
|||||||
super();
|
super();
|
||||||
this._content = null;
|
this._content = null;
|
||||||
}
|
}
|
||||||
_copy () {
|
_copy (undeleteChildren, copyPosition) {
|
||||||
let struct = super._copy();
|
let struct = super._copy(undeleteChildren, copyPosition);
|
||||||
struct._content = this._content;
|
struct._content = this._content;
|
||||||
return struct
|
return struct
|
||||||
}
|
}
|
||||||
@@ -1876,8 +1879,8 @@ class ItemString extends Item {
|
|||||||
super();
|
super();
|
||||||
this._content = null;
|
this._content = null;
|
||||||
}
|
}
|
||||||
_copy () {
|
_copy (undeleteChildren, copyPosition) {
|
||||||
let struct = super._copy();
|
let struct = super._copy(undeleteChildren, copyPosition);
|
||||||
struct._content = this._content;
|
struct._content = this._content;
|
||||||
return struct
|
return struct
|
||||||
}
|
}
|
||||||
@@ -2912,18 +2915,20 @@ class YXmlFragment extends YArray {
|
|||||||
attributes.set(key, attrs[key]);
|
attributes.set(key, attrs[key]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
let result = this._domFilter(this.nodeName, new Map(attributes));
|
this._y.transact(() => {
|
||||||
if (result === null) {
|
let result = this._domFilter(this.nodeName, new Map(attributes));
|
||||||
this._delete(this._y);
|
if (result === null) {
|
||||||
} else {
|
this._delete(this._y);
|
||||||
attributes.forEach((value, key) => {
|
} else {
|
||||||
if (!result.has(key)) {
|
attributes.forEach((value, key) => {
|
||||||
this.removeAttribute(key);
|
if (!result.has(key)) {
|
||||||
}
|
this.removeAttribute(key);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
this.forEach(xml => {
|
||||||
|
xml.setDomFilter(f);
|
||||||
});
|
});
|
||||||
}
|
|
||||||
this.forEach(xml => {
|
|
||||||
xml.setDomFilter(f);
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
_callObserver (transaction, parentSubs, remote) {
|
_callObserver (transaction, parentSubs, remote) {
|
||||||
@@ -3128,8 +3133,8 @@ class YXmlElement extends YXmlFragment {
|
|||||||
this._domFilter = arg2;
|
this._domFilter = arg2;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
_copy (undeleteChildren) {
|
_copy (undeleteChildren, copyPosition) {
|
||||||
let struct = super._copy(undeleteChildren);
|
let struct = super._copy(undeleteChildren, copyPosition);
|
||||||
struct.nodeName = this.nodeName;
|
struct.nodeName = this.nodeName;
|
||||||
return struct
|
return struct
|
||||||
}
|
}
|
||||||
@@ -3267,6 +3272,11 @@ class YXmlHook extends YMap {
|
|||||||
getHook(hookName).fillType(dom, this);
|
getHook(hookName).fillType(dom, this);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
_copy (undeleteChildren, copyPosition) {
|
||||||
|
const struct = super._copy(undeleteChildren, copyPosition);
|
||||||
|
struct.hookName = this.hookName;
|
||||||
|
return struct
|
||||||
|
}
|
||||||
getDom (_document) {
|
getDom (_document) {
|
||||||
_document = _document || document;
|
_document = _document || document;
|
||||||
if (this._dom === null) {
|
if (this._dom === null) {
|
||||||
@@ -3707,7 +3717,7 @@ function applyReverseOperation (y, scope, reverseBuffer) {
|
|||||||
)
|
)
|
||||||
) {
|
) {
|
||||||
performedUndo = true;
|
performedUndo = true;
|
||||||
op = op._copy(undoOp.deletedStructs);
|
op = op._copy(undoOp.deletedStructs, true);
|
||||||
op._integrate(y);
|
op._integrate(y);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user