浏览代码

Code refactoring in ViewCollection class.

Aleksander Nowodzinski 9 年之前
父节点
当前提交
de2dde600b
共有 1 个文件被更改,包括 2 次插入2 次删除
  1. 2 2
      packages/ckeditor5-ui/src/viewcollection.js

+ 2 - 2
packages/ckeditor5-ui/src/viewcollection.js

@@ -149,12 +149,12 @@ export default class ViewCollection extends Collection {
 				}
 
 				// Synchronize views as new items are added to the collection.
-				collection.on( 'add', ( evt, item, index ) => {
+				this.listenTo( collection, 'add', ( evt, item, index ) => {
 					this.add( createView( item ), index );
 				} );
 
 				// Synchronize views as items are removed from the collection.
-				collection.on( 'remove', ( evt, item ) => {
+				this.listenTo( collection, 'remove', ( evt, item ) => {
 					this.remove( this._boundItemsToViewsMap.get( item ) );
 
 					this._boundItemsToViewsMap.delete( item );