diff --git a/src/widgettoolbarrepository.js b/src/widgettoolbarrepository.js index 7d6757b9..49f6d761 100644 --- a/src/widgettoolbarrepository.js +++ b/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.