X-Git-Url: https://jasonwoof.com/gitweb/?a=blobdiff_plain;f=_source%2Fplugins%2Fcolordialog%2Fdialogs%2Fcolordialog.js;h=71a23a6686d1088dac2937d2e64063881d11fc15;hb=614511639979907ceb0da3614122a4d8eb963ad4;hp=4454d196dc14a3a0c46203ae3ae66b4974c8df55;hpb=e371ddf8abcb89013e20e6d0dd746adec344d0e5;p=ckeditor.git diff --git a/_source/plugins/colordialog/dialogs/colordialog.js b/_source/plugins/colordialog/dialogs/colordialog.js index 4454d19..71a23a6 100644 --- a/_source/plugins/colordialog/dialogs/colordialog.js +++ b/_source/plugins/colordialog/dialogs/colordialog.js @@ -14,13 +14,11 @@ CKEDITOR.dialog.add( 'colordialog', function( editor ) // Reference the dialog. var dialog; - function spacer() + var spacer = { - return { - type : 'html', - html : ' ' - }; - } + type : 'html', + html : ' ' + }; function clearSelected() { @@ -30,11 +28,11 @@ CKEDITOR.dialog.add( 'colordialog', function( editor ) function updateSelected( evt ) { - if ( ! (evt instanceof CKEDITOR.dom.event ) ) + if ( ! ( evt instanceof CKEDITOR.dom.event ) ) evt = new CKEDITOR.dom.event( evt ); var target = evt.getTarget(), - color; + color; if ( target.getName() == 'a' && ( color = target.getChild( 0 ).getHtml() ) ) dialog.getContentElement( 'picker', 'selectedColor' ).setValue( color ); @@ -42,7 +40,7 @@ CKEDITOR.dialog.add( 'colordialog', function( editor ) function updateHighlight( event ) { - if ( ! (event instanceof CKEDITOR.dom.event ) ) + if ( ! ( event instanceof CKEDITOR.dom.event ) ) event = event.data; var target = event.getTarget(), @@ -61,21 +59,19 @@ CKEDITOR.dialog.add( 'colordialog', function( editor ) $doc.getById( hicolorTextId ).setHtml( ' ' ); } - var onMouseout = $tools.addFunction( clearHighlight ); - - var onClick = updateSelected, - onClickHandler = CKEDITOR.tools.addFunction( onClick ); - - var onFocus = updateHighlight, - onBlur = clearHighlight; + var onMouseout = $tools.addFunction( clearHighlight ), + onClick = updateSelected, + onClickHandler = CKEDITOR.tools.addFunction( onClick ), + onFocus = updateHighlight, + onBlur = clearHighlight; var onKeydownHandler = CKEDITOR.tools.addFunction( function( ev ) { ev = new CKEDITOR.dom.event( ev ); var element = ev.getTarget(); var relative, nodeToMove; - var keystroke = ev.getKeystroke(); - var rtl = editor.lang.dir == 'rtl'; + var keystroke = ev.getKeystroke(), + rtl = editor.lang.dir == 'rtl'; switch ( keystroke ) { @@ -177,14 +173,14 @@ CKEDITOR.dialog.add( 'colordialog', function( editor ) function createColorTable() { // Create the base colors array. - var aColors = ['00','33','66','99','cc','ff']; + var aColors = [ '00', '33', '66', '99', 'cc', 'ff' ]; // This function combines two ranges of three values from the color array into a row. function appendColorRow( rangeA, rangeB ) { for ( var i = rangeA ; i < rangeA + 3 ; i++ ) { - var row = table.$.insertRow(-1); + var row = table.$.insertRow( -1 ); for ( var j = rangeB ; j < rangeB + 3 ; j++ ) { @@ -240,6 +236,7 @@ CKEDITOR.dialog.add( 'colordialog', function( editor ) var table = new $el( 'table' ); createColorTable(); + var html = table.getHtml(); var numbering = function( id ) { @@ -274,12 +271,15 @@ CKEDITOR.dialog.add( 'colordialog', function( editor ) [ { type : 'html', - html : '' + table.getHtml() + '
' + - '' + lang.options +'', + html : '' + + ( !CKEDITOR.env.webkit ? html : '' ) + + '
' + lang.options +'', onLoad : function() { var table = CKEDITOR.document.getById( this.domId ); table.on( 'mouseover', updateHighlight ); + // In WebKit, the table content must be inserted after this event call (#6150) + CKEDITOR.env.webkit && table.setHtml( html ); }, focus: function() { @@ -287,7 +287,7 @@ CKEDITOR.dialog.add( 'colordialog', function( editor ) firstColor.focus(); } }, - spacer(), + spacer, { type : 'vbox', padding : 0, @@ -320,7 +320,7 @@ CKEDITOR.dialog.add( 'colordialog', function( editor ) } } }, - spacer(), + spacer, { type : 'button', id : 'clear',