This commit is contained in:
root 2018-06-24 10:44:43 -04:00
commit 91e8c825c7
3 changed files with 14 additions and 5 deletions

2
package-lock.json generated
View File

@ -1,6 +1,6 @@
{ {
"name": "yjs", "name": "yjs",
"version": "13.0.0-62", "version": "13.0.0-63",
"lockfileVersion": 1, "lockfileVersion": 1,
"requires": true, "requires": true,
"dependencies": { "dependencies": {

View File

@ -1,6 +1,6 @@
{ {
"name": "yjs", "name": "yjs",
"version": "13.0.0-62", "version": "13.0.0-63",
"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",

View File

@ -87,7 +87,7 @@ export default class Item {
* If the parent refers to this item with some kind of key (e.g. YMap, the * If the parent refers to this item with some kind of key (e.g. YMap, the
* key is specified here. The key is then used to refer to the list in which * key is specified here. The key is then used to refer to the list in which
* to insert this item. If `parentSub = null` type._start is the list in * to insert this item. If `parentSub = null` type._start is the list in
* which to insert to. Otherwise it is `parent._start`. * which to insert to. Otherwise it is `parent._map`.
* @type {String} * @type {String}
*/ */
this._parentSub = null this._parentSub = null
@ -125,8 +125,17 @@ export default class Item {
return this._redone return this._redone
} }
let struct = this._copy() let struct = this._copy()
let left = this._left let left, right
let right = this if (this._parentSub === null) {
// Is an array item. Insert at the old position
left = this._left
right = this
} else {
// Is a map item. Insert at the start
left = null
right = this._parent._map.get(this._parentSub)
right._delete(y)
}
let parent = this._parent let parent = this._parent
// make sure that parent is redone // make sure that parent is redone
if (parent._deleted === true && parent._redone === null) { if (parent._deleted === true && parent._redone === null) {