X-Git-Url: https://jasonwoof.com/gitweb/?p=ckeditor.git;a=blobdiff_plain;f=samples%2Fsample.js;h=5a486ded0768354a7ed5d18cbf9e01d8e0269960;hp=267998c196c8ed02556ebe5446f2c526f0f01e87;hb=57bde48ab8a99810fe524a8b511b2f501bf7f318;hpb=10cdc4f5281828f2edcee3782050b80af5183f50 diff --git a/samples/sample.js b/samples/sample.js index 267998c..5a486de 100644 --- a/samples/sample.js +++ b/samples/sample.js @@ -7,15 +7,16 @@ // This file can be ignored and is not required to make use of CKEditor. (function() { - // Check for sample compliance. CKEDITOR.on( 'instanceReady', function( ev ) { + // Check for sample compliance. var editor = ev.editor, meta = CKEDITOR.document.$.getElementsByName( 'ckeditor-sample-required-plugins' ), requires = meta.length ? CKEDITOR.dom.element.get( meta[ 0 ] ).getAttribute( 'content' ).split( ',' ) : [], - missing = []; + missing = [], + i; if ( requires.length ) { - for ( var i = 0; i < requires.length; i++ ) { + for ( i = 0; i < requires.length; i++ ) { if ( !editor.plugins[ requires[ i ] ] ) missing.push( '' + requires[ i ] + '' ); } @@ -29,5 +30,21 @@ warn.insertBefore( editor.container ); } } - }); + + // Set icons. + var doc = new CKEDITOR.dom.document( document ), + icons = doc.find( '.button_icon' ); + + for ( i = 0; i < icons.count(); i++ ) { + var icon = icons.getItem( i ), + name = icon.getAttribute( 'data-icon' ), + style = CKEDITOR.skin.getIconStyle( name, ( CKEDITOR.lang.dir == 'rtl' ) ); + + icon.addClass( 'cke_button_icon' ); + icon.addClass( 'cke_button__' + name + '_icon' ); + icon.setAttribute( 'style', style ); + icon.setStyle( 'float', 'none' ); + + } + } ); })();