Ticket #6010: 6010_2.patch
File 6010_2.patch, 2.5 KB (added by , 14 years ago) |
---|
-
_source/plugins/colorbutton/plugin.js
22 22 23 23 function addButton( name, type, title ) 24 24 { 25 var colorBoxId = CKEDITOR.tools.getNextId() + '_colorBox'; 25 26 editor.ui.add( name, CKEDITOR.UI_PANELBUTTON, 26 27 { 27 28 label : title, … … 39 40 { 40 41 block.autoSize = true; 41 42 block.element.addClass( 'cke_colorblock' ); 42 block.element.setHtml( renderColors( panel, type ) );43 block.element.setHtml( renderColors( panel, type, colorBoxId ) ); 43 44 // The block should not have scrollbars (#5933, #6056) 44 45 block.element.getDocument().getBody().setStyle( 'overflow', 'hidden' ); 45 46 … … 52 53 keys[ 38 ] = 'prev'; // ARROW-UP 53 54 keys[ CKEDITOR.SHIFT + 9 ] = 'prev'; // SHIFT + TAB 54 55 keys[ 32 ] = 'click'; // SPACE 56 }, 57 58 // The automatic colorbox should represent the real color (#6010) 59 onOpen : function() 60 { 61 var selection = editor.getSelection(), 62 block = selection && selection.getStartElement(), 63 path = new CKEDITOR.dom.elementPath( block ), 64 color; 65 66 // Find the closest block element. 67 block = path.block || path.blockLimit; 68 69 // The background color might be transparent. In that case, look up the color in the DOM tree. 70 do 71 { 72 color = block && block.getComputedStyle( type == 'back' ? 'background-color' : 'color' ) || 'transparent'; 73 } 74 while ( type == 'back' && color == 'transparent' && ( block = block.getParent() ) ); 75 76 // The box should never be transparent. 77 if ( !color || color == 'transparent' ) 78 color = '#ffffff'; 79 80 this._.panel._.iframe.getFrameDocument().getById( colorBoxId ).setStyle( 'background-color', color ); 55 81 } 56 82 }); 57 83 } 58 84 59 85 60 function renderColors( panel, type )86 function renderColors( panel, type, colorBoxId ) 61 87 { 62 88 var output = [], 63 89 colors = config.colorButton_colors.split( ',' ), … … 121 147 '<table role="presentation" cellspacing=0 cellpadding=0 width="100%">' + 122 148 '<tr>' + 123 149 '<td>' + 124 '<span class="cke_colorbox" style="background-color:#000"></span>' +150 '<span class="cke_colorbox" id="', colorBoxId, '"></span>' + 125 151 '</td>' + 126 152 '<td colspan=7 align=center>', 127 153 lang.auto,