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

Commit a5eebdb

Browse files
authored
Merge pull request #185 from ckeditor/t/ckeditor5-image/187
Other: Used .ck-button_save and _cancel CSS classes to make the link form view buttons colorful (see ckeditor/ckeditor5-image#187).
2 parents 45292f1 + 4e78489 commit a5eebdb

File tree

2 files changed

+13
-3
lines changed

2 files changed

+13
-3
lines changed

src/ui/linkformview.js

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -67,15 +67,15 @@ export default class LinkFormView extends View {
6767
*
6868
* @member {module:ui/button/buttonview~ButtonView}
6969
*/
70-
this.saveButtonView = this._createButton( t( 'Save' ), checkIcon );
70+
this.saveButtonView = this._createButton( t( 'Save' ), checkIcon, 'ck-button-save' );
7171
this.saveButtonView.type = 'submit';
7272

7373
/**
7474
* The Cancel button view.
7575
*
7676
* @member {module:ui/button/buttonview~ButtonView}
7777
*/
78-
this.cancelButtonView = this._createButton( t( 'Cancel' ), cancelIcon, 'cancel' );
78+
this.cancelButtonView = this._createButton( t( 'Cancel' ), cancelIcon, 'ck-button-cancel', 'cancel' );
7979

8080
/**
8181
* A collection of views which can be focused in the form.
@@ -184,10 +184,11 @@ export default class LinkFormView extends View {
184184
* @private
185185
* @param {String} label The button label.
186186
* @param {String} icon The button's icon.
187+
* @param {String} className The additional button CSS class name.
187188
* @param {String} [eventName] An event name that the `ButtonView#execute` event will be delegated to.
188189
* @returns {module:ui/button/buttonview~ButtonView} The button view instance.
189190
*/
190-
_createButton( label, icon, eventName ) {
191+
_createButton( label, icon, className, eventName ) {
191192
const button = new ButtonView( this.locale );
192193

193194
button.set( {
@@ -196,6 +197,12 @@ export default class LinkFormView extends View {
196197
tooltip: true
197198
} );
198199

200+
button.extendTemplate( {
201+
attributes: {
202+
class: className
203+
}
204+
} );
205+
199206
if ( eventName ) {
200207
button.delegate( 'execute' ).to( this, eventName );
201208
}

tests/ui/linkformview.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,9 @@ describe( 'LinkFormView', () => {
3535
expect( view.saveButtonView ).to.be.instanceOf( View );
3636
expect( view.cancelButtonView ).to.be.instanceOf( View );
3737

38+
expect( view.saveButtonView.element.classList.contains( 'ck-button-save' ) ).to.be.true;
39+
expect( view.cancelButtonView.element.classList.contains( 'ck-button-cancel' ) ).to.be.true;
40+
3841
expect( view._unboundChildren.get( 0 ) ).to.equal( view.urlInputView );
3942
expect( view._unboundChildren.get( 1 ) ).to.equal( view.saveButtonView );
4043
expect( view._unboundChildren.get( 2 ) ).to.equal( view.cancelButtonView );

0 commit comments

Comments
 (0)