Ticket #4048: 4048_2.patch
File 4048_2.patch, 7.1 KB (added by , 14 years ago) |
---|
-
_source/plugins/menu/plugin.js
232 232 this.parent._.panel.showAsChild( panel, this.id, offsetParent, corner, offsetX, offsetY ); 233 233 else 234 234 panel.showBlock( this.id, offsetParent, corner, offsetX, offsetY ); 235 236 editor.fire( 'menuShow', [ panel ] ); 235 237 }, 236 238 237 239 hide : function() -
_source/skins/kama/skin.js
25 25 if ( editor.config.width && !isNaN( editor.config.width ) ) 26 26 editor.config.width -= 12; 27 27 28 var menuHead; 29 function menuSetUiColor( color ) 30 { 31 if ( !menuHead ) 32 return null; 33 34 var uiStyle = menuHead.append('style'); 35 36 var cssSrc = "/* UI Color Support */\ 28 var uiColorMenus = []; 29 var uiColorRegex = /\$color/g; 30 var uiColorMenuCss = "/* UI Color Support */\ 37 31 .cke_skin_kama .cke_menuitem .cke_icon_wrapper\ 38 32 {\ 39 33 background-color: $color !important;\ … … 87 81 {\ 88 82 background-color: $color !important;\ 89 83 }"; 84 // We have to split CSS declarations for webkit. 85 if ( CKEDITOR.env.webkit ) 86 { 87 uiColorMenuCss = uiColorMenuCss.split( '}' ).slice( 0, -1 ); 88 for ( var i in uiColorMenuCss ) 89 uiColorMenuCss[ i ] = uiColorMenuCss[ i ].split( '{' ); 90 } 90 91 91 uiStyle.setAttribute( "type", "text/css" ); 92 var regex = /\$color/g; 93 94 // We have to split CSS declarations for webkit. 95 if ( CKEDITOR.env.webkit ) 92 function addStylesheet( document ) 93 { 94 var node = document.getHead().append( 'style' ); 95 node.setAttribute( "id", "cke_ui_color" ); 96 node.setAttribute( "type", "text/css" ); 97 98 return node; 99 } 100 101 function updateStylesheets( styleNodes, styleContent, stringMap ) 102 { 103 for ( var id in uiColorMenus ) 96 104 { 97 cssSrc = cssSrc.split( '}' ).slice( 0, -1 ); 98 for ( var i in cssSrc ) 99 cssSrc[ i ] = cssSrc[ i ].split( '{' ); 100 } 101 102 return ( menuSetUiColor = 103 function( color ) 105 if ( CKEDITOR.env.webkit ) 104 106 { 105 if ( CKEDITOR.env.webkit )107 for ( var i in styleContent ) 106 108 { 107 for ( var i in cssSrc ) 108 uiStyle.$.sheet.addRule( 109 cssSrc[ i ][ 0 ], cssSrc[ i ][ 1 ].replace( regex, color ) 110 ); 111 } 112 else 113 { 114 var css = cssSrc.replace( regex, color ); 109 var content = uiColorMenuCss[ i ][ 1 ]; 115 110 116 if ( CKEDITOR.env.ie ) 117 uiStyle.$.styleSheet.cssText = css; 118 else 119 uiStyle.setHtml( css ); 111 for ( var s in stringMap ) 112 // IE doesn't support global replace in string object. 113 while ( content.indexOf( s ) > -1 ) 114 content = content.replace( s, stringMap[ s ] ); 115 116 uiColorMenus[ id ].$.sheet.addRule( uiColorMenuCss[ i ][ 0 ], content ); 120 117 } 121 })( color ); 118 } 119 else 120 { 121 for ( var s in stringMap ) 122 // IE doesn't support global replace in string object. 123 while ( styleContent.indexOf( s ) > -1 ) 124 styleContent = styleContent.replace( s, stringMap[ s ] ); 125 126 if ( CKEDITOR.env.ie ) 127 uiColorMenus[ id ].$.styleSheet.cssText = styleContent; 128 else 129 uiColorMenus[ id ].setHtml( styleContent ); 130 } 131 } 122 132 } 123 133 124 134 CKEDITOR.tools.extend( editor, … … 132 142 133 143 setUiColor : function( color ) 134 144 { 135 var uiStyle = CKEDITOR.document.getHead().append('style'),145 var uiStyle = addStylesheet( CKEDITOR.document ), 136 146 cssId = '#cke_' + editor.name.replace('.', '\\.'); 137 147 138 148 var cssSelectors = … … 144 154 ].join( ',' ); 145 155 var cssProperties = "background-color: $color !important;"; 146 156 147 uiStyle.setAttribute("type", "text/css");148 149 157 return ( this.setUiColor = 150 158 function( color ) 151 159 { … … 159 167 else 160 168 uiStyle.setHtml( cssSelectors + '{' + css + '}' ); 161 169 162 menuSetUiColor( color ); 170 // Update menu styles. 171 updateStylesheets( uiColorMenus, uiColorMenuCss, { '$color': editor.getUiColor() } ); 163 172 })( color ); 164 173 } 165 174 }); 166 175 167 // If the "menu" plugin is loaded, register the listeners. 168 if ( CKEDITOR.menu ) 176 editor.on( 'menuShow', function( event ) 169 177 { 170 var old = CKEDITOR.menu.prototype.show; 178 var panel = event.data[ 0 ]; 179 var iframe = panel.element.getElementsByTag( 'iframe' ).getItem( 0 ).getFrameDocument(); 171 180 172 CKEDITOR.menu.prototype.show = function() 181 // Add stylesheet if missing. 182 if ( !iframe.getById( 'cke_ui_color' ) ) 173 183 { 174 old.apply( this, arguments ); 184 var node = addStylesheet( iframe ); 185 uiColorMenus.push( node ); 175 186 176 if ( !menuHead && editor == this.editor ) 177 { 178 // Save reference. 179 menuHead = this._.element.getDocument().getHead(); 180 menuSetUiColor( editor.getUiColor() ); 181 } 182 }; 183 } 187 var color = editor.getUiColor(); 188 // Set uiColor for new menu. 189 if ( color ) 190 updateStylesheets( [ node ], uiColorMenuCss, { '$color': color } ); 191 } 192 }); 184 193 185 194 // Apply UI color if specified in config. 186 195 if ( editor.config.uiColor ) 187 196 editor.setUiColor( editor.config.uiColor ); 188 189 // Fix editor's width. HPadding and 100% width iframe issue.190 // if ( CKEDITOR.env.ie && CKEDITOR.env.quirks )191 // {192 // editor.on( 'mode', function( event )193 // {194 // var container = editor.getResizable();195 // editor.resize( container.$.offsetWidth-10, container.$.offsetHeight );196 // event.removeListener();197 // });198 // }199 200 // if ( CKEDITOR.env.ie && ( CKEDITOR.env.quirks || CKEDITOR.env.version < 7 ) )201 // {202 // editor.on( 'themeLoaded', function( event )203 // {204 // var toolbars = editor.container.getChild( [0, 0, 0, 0, 0, 0, 0] ).getChildren();205 // for ( var i = 0 ; i < toolbars.count() ; i++ )206 // {207 // var toolbar = toolbars.getItem( i );208 209 // var last = toolbar.getLast();210 // if ( !last || !last.getPrevious().hasClass( 'cke_rcombo' ) )211 // continue;212 //213 // last.addClass( 'cke_toolbar_end_last' );214 // }215 // });216 // }217 197 } 218 198 }; 219 199 })() ); -
CHANGES.html
47 47 <li><a href="http://dev.fckeditor.net/ticket/3898">#3898</a> : Added validation for URL presentance in Image dialog.</li> 48 48 <li><a href="http://dev.fckeditor.net/ticket/3528">#3528</a> : Fixed Context Menu issue when triggered using Shift+F10.</li> 49 49 <li><a href="http://dev.fckeditor.net/ticket/4028">#4028</a> : Maximize control's tool tip was wrong once it is maximized.</li> 50 <li><a href="http://dev.fckeditor.net/ticket/4048">#4048</a> : Context submenu was lacking uiColor.</li> 50 51 </ul> 51 52 <h3> 52 53 CKEditor 3.0</h3>