Browse Source

Merge pull request #1598 from ckeditor/t/1597

Fix: Renamed the event during selection attributes conversion. `attribute:key` becomes to `attribute:key:$text`. Closes #1597.
Szymon Cofalik 7 years ago
parent
commit
cc2f4e9cc4

+ 1 - 1
packages/ckeditor5-engine/src/conversion/downcastdispatcher.js

@@ -294,7 +294,7 @@ export default class DowncastDispatcher {
 
 			// Do not fire event if the attribute has been consumed.
 			if ( this.conversionApi.consumable.test( selection, 'attribute:' + data.attributeKey ) ) {
-				this.fire( 'attribute:' + data.attributeKey, data, this.conversionApi );
+				this.fire( 'attribute:' + data.attributeKey + ':$text', data, this.conversionApi );
 			}
 		}
 

+ 1 - 1
packages/ckeditor5-engine/tests/conversion/downcastdispatcher.js

@@ -319,7 +319,7 @@ describe( 'DowncastDispatcher', () => {
 
 			dispatcher.convertSelection( doc.selection, model.markers, [] );
 
-			expect( dispatcher.fire.calledWith( 'attribute:bold' ) ).to.be.true;
+			expect( dispatcher.fire.calledWith( 'attribute:bold:$text' ) ).to.be.true;
 		} );
 
 		it( 'should not fire attributes events if attribute has been consumed', () => {