From 7d2a56cf18cfd6fb856f1e004ab73bb8ed57325b Mon Sep 17 00:00:00 2001 From: nlujjawal Date: Thu, 14 Nov 2024 11:13:16 +0100 Subject: [PATCH] Feat: exposing getter setter for widget manager from edit_session created using line widgets --- src/edit_session.js | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/src/edit_session.js b/src/edit_session.js index b32056d747..f9717aa477 100644 --- a/src/edit_session.js +++ b/src/edit_session.js @@ -49,7 +49,6 @@ class EditSession { this.$undoSelect = true; this.$editor = null; this.prevOp = {}; - this.$widgetManager = null; /** @type {FoldLine[]} */ this.$foldData = []; @@ -197,13 +196,14 @@ class EditSession { * @returns {LineWidgets} object */ get widgetManager() { - if(!this.$widgetManager) { - this.$widgetManager = new LineWidgets(this); + const widgetManager = new LineWidgets(this); + // todo remove the widgetManger assignement from lineWidgets constructor when introducing breaking changes + this.widgetManager = widgetManager; + + if (this.$editor) + widgetManager.attach(this.$editor); - if (this.$editor) - this.$widgetManager.attach(this.$editor); - } - return this.$widgetManager; + return widgetManager; } /** @@ -218,7 +218,6 @@ class EditSession { configurable: true, value: value, }); - this.$widgetManager = value; } /** * @param {Number} docRow The row to work with