8
0
Quellcode durchsuchen

Feature: Enabled the tooltip for the 'headings' component in editor.ui#componentFactory.

Aleksander Nowodzinski vor 8 Jahren
Ursprung
Commit
00805561e1

+ 3 - 1
packages/ckeditor5-heading/src/heading.js

@@ -38,6 +38,7 @@ export default class Heading extends Plugin {
 		const dropdownItems = new Collection();
 		const options = this._getLocalizedOptions();
 		const commands = [];
+		const t = editor.t;
 		let defaultOption;
 
 		for ( let option of options ) {
@@ -63,7 +64,8 @@ export default class Heading extends Plugin {
 		// Create dropdown model.
 		const dropdownModel = new Model( {
 			withText: true,
-			items: dropdownItems
+			items: dropdownItems,
+			tooltip: t( 'Heading' )
 		} );
 
 		dropdownModel.bind( 'isEnabled' ).to(

+ 1 - 0
packages/ckeditor5-heading/tests/heading.js

@@ -57,6 +57,7 @@ describe( 'Heading', () => {
 			expect( dropdown.buttonView.isEnabled ).to.be.true;
 			expect( dropdown.buttonView.isOn ).to.be.undefined;
 			expect( dropdown.buttonView.label ).to.equal( 'Paragraph' );
+			expect( dropdown.buttonView.tooltip ).to.equal( 'Heading' );
 		} );
 
 		it( 'should execute format command on model execute event', () => {