From 5ab34ee7b1278a035a36f7e82ae525a92dfa41e7 Mon Sep 17 00:00:00 2001 From: nlujjawal Date: Thu, 14 Nov 2024 11:52:34 +0100 Subject: [PATCH] added condition to check if widget manager already exists --- src/edit_session.js | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/src/edit_session.js b/src/edit_session.js index f9717aa477..8fdf88c89d 100644 --- a/src/edit_session.js +++ b/src/edit_session.js @@ -196,14 +196,15 @@ class EditSession { * @returns {LineWidgets} object */ get widgetManager() { - 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); - - return widgetManager; + if (!this.widgetManager) { + 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); + } + return this.widgetManager; } /**