Procházet zdrojové kódy

Add toolbars destroy in WidgetToolbarRepository plugin.

Maciej Gołaszewski před 7 roky
rodič
revize
6307323290

+ 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.