Skip to content
This repository has been archived by the owner on Jun 26, 2020. It is now read-only.

Commit

Permalink
Changed: Removed consumable parameter from `conversion.DowncastDisp…
Browse files Browse the repository at this point in the history
…atcher#_testAndFire`.
  • Loading branch information
scofalik committed Feb 20, 2018
1 parent f9f2cc4 commit 0010863
Showing 1 changed file with 7 additions and 10 deletions.
17 changes: 7 additions & 10 deletions src/conversion/downcastdispatcher.js
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ export default class DowncastDispatcher {
this.conversionApi.writer = writer;

// Create a list of things that can be consumed, consisting of nodes and their attributes.
const consumable = this._createInsertConsumable( range );
this.conversionApi.consumable = this._createInsertConsumable( range );

// Fire a separate insert event for each node and text fragment contained in the range.
for ( const value of range ) {
Expand All @@ -167,7 +167,7 @@ export default class DowncastDispatcher {
range: itemRange
};

this._testAndFire( 'insert', data, consumable );
this._testAndFire( 'insert', data );

// Fire a separate addAttribute event for each attribute that was set on inserted items.
// This is important because most attributes converters will listen only to add/change/removeAttribute events.
Expand All @@ -177,7 +177,7 @@ export default class DowncastDispatcher {
data.attributeOldValue = null;
data.attributeNewValue = item.getAttribute( key );

this._testAndFire( `attribute:${ key }`, data, consumable );
this._testAndFire( `attribute:${ key }`, data );
}
}

Expand Down Expand Up @@ -216,7 +216,7 @@ export default class DowncastDispatcher {
this.conversionApi.writer = writer;

// Create a list with attributes to consume.
const consumable = this._createConsumableForRange( range, `attribute:${ key }` );
this.conversionApi.consumable = this._createConsumableForRange( range, `attribute:${ key }` );

// Create a separate attribute event for each node in the range.
for ( const value of range ) {
Expand All @@ -230,7 +230,7 @@ export default class DowncastDispatcher {
attributeNewValue: newValue
};

this._testAndFire( `attribute:${ key }`, data, consumable );
this._testAndFire( `attribute:${ key }`, data );
}

this._clearConversionApi();
Expand Down Expand Up @@ -441,18 +441,15 @@ export default class DowncastDispatcher {
* @fires attribute
* @param {String} type Event type.
* @param {Object} data Event data.
* @param {module:engine/conversion/modelconsumable~ModelConsumable} consumable Values to consume.
*/
_testAndFire( type, data, consumable ) {
if ( !consumable.test( data.item, type ) ) {
_testAndFire( type, data ) {
if ( !this.conversionApi.consumable.test( data.item, type ) ) {
// Do not fire event if the item was consumed.
return;
}

const name = data.item.name || '$text';

this.conversionApi.consumable = consumable;

this.fire( type + ':' + name, data, this.conversionApi );
}

Expand Down

0 comments on commit 0010863

Please sign in to comment.