X-Git-Url: https://jasonwoof.com/gitweb/?a=blobdiff_plain;f=samples%2Fsample.js;h=439a521217a08d8fcaf109b902c051a5b1def4db;hb=a0df3d0ab0c5252b5e2e0fd274705ede834c2276;hp=8827e789aef0e07574a0a56c0d9a1c442acb2224;hpb=3ae1f974ffdf269f96455a39d8d6947e4d590b1b;p=ckeditor.git diff --git a/samples/sample.js b/samples/sample.js index 8827e78..439a521 100644 --- a/samples/sample.js +++ b/samples/sample.js @@ -1,21 +1,22 @@ /** - * Copyright (c) 2003-2013, CKSource - Frederico Knabben. All rights reserved. - * For licensing, see LICENSE.html or http://ckeditor.com/license + * Copyright (c) 2003-2015, CKSource - Frederico Knabben. All rights reserved. + * For licensing, see LICENSE.md or http://ckeditor.com/license */ // Tool scripts for the sample pages. // This file can be ignored and is not required to make use of CKEditor. -(function() { - // Check for sample compliance. +( function() { 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' ); + + } + } ); +} )();