X-Git-Url: https://jasonwoof.com/gitweb/?a=blobdiff_plain;f=_source%2Fplugins%2Fcolorbutton%2Fplugin.js;h=7cc0604d78df61501cc0bc7f8159165087437683;hb=fb481ba0a7d298e3e7b9034fcb9f2afdc6e8e796;hp=77c002ad2acdf1d82401349e016c8615c325d423;hpb=4e90e78dc97789709ee7404359a5517540c27553;p=ckeditor.git diff --git a/_source/plugins/colorbutton/plugin.js b/_source/plugins/colorbutton/plugin.js index 77c002a..7cc0604 100644 --- a/_source/plugins/colorbutton/plugin.js +++ b/_source/plugins/colorbutton/plugin.js @@ -1,8 +1,13 @@ /* -Copyright (c) 2003-2011, CKSource - Frederico Knabben. All rights reserved. +Copyright (c) 2003-2012, CKSource - Frederico Knabben. All rights reserved. For licensing, see LICENSE.html or http://ckeditor.com/license */ +/** + * @fileOverview The "colorbutton" plugin that makes it possible to assign + * text and background colors to editor contents. + * + */ CKEDITOR.plugins.add( 'colorbutton', { requires : [ 'panelbutton', 'floatpanel', 'styles' ], @@ -88,8 +93,7 @@ CKEDITOR.plugins.add( 'colorbutton', function renderColors( panel, type, colorBoxId ) { var output = [], - colors = config.colorButton_colors.split( ',' ), - total = colors.length + ( config.colorButton_enableMore ? 2 : 1 ); + colors = config.colorButton_colors.split( ',' ); var clickFn = CKEDITOR.tools.addFunction( function( color, type ) { @@ -115,8 +119,7 @@ CKEDITOR.plugins.add( 'colorbutton', editor.focus(); - panel.hide(); - + panel.hide( false ); editor.fire( 'saveSnapshot' ); @@ -137,8 +140,8 @@ CKEDITOR.plugins.add( 'colorbutton', : function( element ) { - // Fore color style must be applied inside links instead of around it. - return element.getName() != 'a' || isUnstylable( element ); + // Fore color style must be applied inside links instead of around it. (#4772,#6908) + return !( element.is( 'a' ) || element.getElementsByTag( 'a' ).count() ) || isUnstylable( element ); }; new CKEDITOR.style( colorStyle, { color : color } ).apply( editor.document ); @@ -153,7 +156,7 @@ CKEDITOR.plugins.add( 'colorbutton', ' title="', lang.auto, '"' + ' onclick="CKEDITOR.tools.callFunction(', clickFn, ',null,\'', type, '\');return false;"' + ' href="javascript:void(\'', lang.auto, '\')"' + - ' role="option" aria-posinset="1" aria-setsize="', total, '">' + + ' role="option">' + '
' + @@ -190,7 +193,7 @@ CKEDITOR.plugins.add( 'colorbutton', ' title="', colorLabel, '"' + ' onclick="CKEDITOR.tools.callFunction(', clickFn, ',\'', colorName, '\',\'', type, '\'); return false;"' + ' href="javascript:void(\'', colorLabel, '\')"' + - ' role="option" aria-posinset="', ( i + 2 ), '" aria-setsize="', total, '">' + + ' role="option">' + '' + '' + ' | ' ); @@ -207,7 +210,7 @@ CKEDITOR.plugins.add( 'colorbutton', ' title="', lang.more, '"' + ' onclick="CKEDITOR.tools.callFunction(', clickFn, ',\'?\',\'', type, '\');return false;"' + ' href="javascript:void(\'', lang.more, '\')"', - ' role="option" aria-posinset="', total, '" aria-setsize="', total, '">', + ' role="option">', lang.more, '' + '' ); // tr is later in the code. @@ -226,22 +229,24 @@ CKEDITOR.plugins.add( 'colorbutton', }); /** - * Whether to enable the "More Colors..." button in the color selectors. - * @default true + * Whether to enable the More Colors button in the color selectors. + * @name CKEDITOR.config.colorButton_enableMore + * @default