Skip to content

Commit

Permalink
added condition to check if widget manager already exists
Browse files Browse the repository at this point in the history
  • Loading branch information
nlujjawal committed Nov 14, 2024
1 parent 7d2a56c commit 5ab34ee
Showing 1 changed file with 9 additions and 8 deletions.
17 changes: 9 additions & 8 deletions src/edit_session.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

/**
Expand Down

0 comments on commit 5ab34ee

Please sign in to comment.