diff --git a/src/utils/YEvent.js b/src/utils/YEvent.js index ac877bc5..8aafd94f 100644 --- a/src/utils/YEvent.js +++ b/src/utils/YEvent.js @@ -44,6 +44,10 @@ export class YEvent { * @type {null | Array<{ insert?: string | Array | object | AbstractType, retain?: number, delete?: number, attributes?: Object }>} */ this._delta = null + /** + * @type {Array|null} + */ + this._path = null } /** @@ -60,8 +64,7 @@ export class YEvent { * type === event.target // => true */ get path () { - // @ts-ignore _item is defined because target is integrated - return getPathTo(this.currentTarget, this.target) + return this._path || (this._path = getPathTo(this.currentTarget, this.target)) } /**