From 361d4a48e1e96c7823159d6dd143f7e99ccb8e1c Mon Sep 17 00:00:00 2001 From: Kevin Jahns Date: Sat, 17 Jun 2017 14:31:00 +0200 Subject: [PATCH 1/2] implement getPath for any type. types now initialize _parent. fix some cases where observeDeep is not fired --- src/Utils.js | 25 +++++++++++++++++++++---- 1 file changed, 21 insertions(+), 4 deletions(-) diff --git a/src/Utils.js b/src/Utils.js index 18467db8..b1b4d848 100644 --- a/src/Utils.js +++ b/src/Utils.js @@ -31,9 +31,13 @@ module.exports = function (Y /* : any*/) { event.path = [] while (type != null && type._deepEventHandler != null) { type._deepEventHandler.callEventListeners(event) - if (type._parent != null && type._parentSub != null) { - event.path = [type._parentSub].concat(event.path) - type = type.os.getType(type._parent) + var parent = null + if (type._parent != null) { + parent = type.os.getType(type._parent) + } + if (parent != null && parent._getPathToChild != null) { + event.path = [parent._getPathToChild(type._model)].concat(event.path) + type = parent } else { type = null } @@ -478,7 +482,20 @@ module.exports = function (Y /* : any*/) { Default class of custom types! */ class CustomType { - + getPath () { + var parent = null + if (this._parent != null) { + parent = this.os.getType(this._parent) + } + if (parent != null && parent._getPathToChild != null) { + var firstKey = parent._getPathToChild(this._model) + var parentKeys = parent.getPath() + parentKeys.push(firstKey) + return parentKeys + } else { + return [] + } + } } Y.utils.CustomType = CustomType From a5506a5ded0f16782d39785ab9214ee0ce1445d5 Mon Sep 17 00:00:00 2001 From: Kevin Jahns Date: Sat, 17 Jun 2017 14:32:28 +0200 Subject: [PATCH 2/2] Release 12.3.1 --- dist | 2 +- package.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/dist b/dist index 3eafd787..42aa7ec5 160000 --- a/dist +++ b/dist @@ -1 +1 @@ -Subproject commit 3eafd78710a30cd01bf4c6b3553c141e7ac604a5 +Subproject commit 42aa7ec5c9c0b4f2734b5b01eae7f0df63bfd9ff diff --git a/package.json b/package.json index 6ec4d451..a67ea7c4 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "yjs", - "version": "12.3.0", + "version": "12.3.1", "description": "A framework for real-time p2p shared editing on any data", "main": "./src/y.js", "scripts": {