Browse Source

Add toolbars destroy in WidgetToolbarRepository plugin.

Maciej Gołaszewski 7 years ago
parent
commit
6307323290
1 changed files with 8 additions and 0 deletions
  1. 8 0
      packages/ckeditor5-widget/src/widgettoolbarrepository.js

+ 8 - 0
packages/ckeditor5-widget/src/widgettoolbarrepository.js

@@ -93,6 +93,14 @@ export default class WidgetToolbarRepository extends Plugin {
 		}, { priority: 'low' } );
 	}
 
+	destroy() {
+		super.destroy();
+
+		for ( const toolbarConfig of this._toolbarDefinitions.values() ) {
+			toolbarConfig.view.destroy();
+		}
+	}
+
 	/**
 	 * Registers toolbar in the WidgetToolbarRepository. It renders it in the `ContextualBalloon` based on the value of the invoked
 	 * `getRelatedElement` function. Toolbar items are gathered from `items` array.