|
|
@@ -22,7 +22,6 @@ import {
|
|
|
clearFakeSelection
|
|
|
} from '../conversion/model-selection-to-view-converters';
|
|
|
|
|
|
-import EmitterMixin from '@ckeditor/ckeditor5-utils/src/emittermixin';
|
|
|
import ObservableMixin from '@ckeditor/ckeditor5-utils/src/observablemixin';
|
|
|
import mix from '@ckeditor/ckeditor5-utils/src/mix';
|
|
|
|
|
|
@@ -84,22 +83,13 @@ export default class EditingController {
|
|
|
viewSelection: this.view.selection
|
|
|
} );
|
|
|
|
|
|
- /**
|
|
|
- * Property keeping all listenters attached by controller on other objects, so it can
|
|
|
- * stop listening on {@link #destroy}.
|
|
|
- *
|
|
|
- * @private
|
|
|
- * @member {utils.EmitterMixin} #_listener
|
|
|
- */
|
|
|
- this._listener = Object.create( EmitterMixin );
|
|
|
-
|
|
|
// Convert changes in model to view.
|
|
|
- this._listener.listenTo( this.model, 'change', ( evt, type, changes ) => {
|
|
|
+ this.listenTo( this.model, 'change', ( evt, type, changes ) => {
|
|
|
this.modelToView.convertChange( type, changes );
|
|
|
}, { priority: 'low' } );
|
|
|
|
|
|
// Convert model selection to view.
|
|
|
- this._listener.listenTo( this.model, 'changesDone', () => {
|
|
|
+ this.listenTo( this.model, 'changesDone', () => {
|
|
|
const selection = this.model.selection;
|
|
|
|
|
|
this.modelToView.convertSelection( selection );
|
|
|
@@ -107,16 +97,16 @@ export default class EditingController {
|
|
|
}, { priority: 'low' } );
|
|
|
|
|
|
// Convert model markers changes.
|
|
|
- this._listener.listenTo( this.model.markers, 'add', ( evt, marker ) => {
|
|
|
+ this.listenTo( this.model.markers, 'add', ( evt, marker ) => {
|
|
|
this.modelToView.convertMarker( 'addMarker', marker.name, marker.getRange() );
|
|
|
} );
|
|
|
|
|
|
- this._listener.listenTo( this.model.markers, 'remove', ( evt, marker ) => {
|
|
|
+ this.listenTo( this.model.markers, 'remove', ( evt, marker ) => {
|
|
|
this.modelToView.convertMarker( 'removeMarker', marker.name, marker.getRange() );
|
|
|
} );
|
|
|
|
|
|
// Convert view selection to model.
|
|
|
- this._listener.listenTo( this.view, 'selectionChange', convertSelectionChange( this.model, this.mapper ) );
|
|
|
+ this.listenTo( this.view, 'selectionChange', convertSelectionChange( this.model, this.mapper ) );
|
|
|
|
|
|
// Attach default content converters.
|
|
|
this.modelToView.on( 'insert:$text', insertText(), { priority: 'lowest' } );
|
|
|
@@ -162,7 +152,7 @@ export default class EditingController {
|
|
|
*/
|
|
|
destroy() {
|
|
|
this.view.destroy();
|
|
|
- this._listener.stopListening();
|
|
|
+ this.stopListening();
|
|
|
}
|
|
|
}
|
|
|
|