Ticket #4048: 4048_3.patch
File 4048_3.patch, 7.7 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, replace ) 102 { 103 for ( var id in styleNodes ) 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 // Truncate manually. 108 for ( var i = 0 ; i < styleNodes[ id ].$.sheet.rules.length ; i++ ) 109 styleNodes[ id ].$.sheet.removeRule( i ); 110 111 for ( var i in styleContent ) 106 112 { 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 ); 113 var content = styleContent[ i ][ 1 ]; 114 for ( var r in replace ) 115 content = content.replace( replace[ r ][ 0 ], replace[ r ][ 1 ] ); 115 116 116 if ( CKEDITOR.env.ie ) 117 uiStyle.$.styleSheet.cssText = css; 118 else 119 uiStyle.setHtml( css ); 117 styleNodes[ id ].$.sheet.addRule( styleContent[ i ][ 0 ], content ); 120 118 } 121 })( color ); 119 } 120 else 121 { 122 var content = styleContent; 123 for ( var r in replace ) 124 content = content.replace( replace[ r ][ 0 ], replace[ r ][ 1 ] ); 125 126 if ( CKEDITOR.env.ie ) 127 styleNodes[ id ].$.styleSheet.cssText = content; 128 else 129 styleNodes[ id ].setHtml( content ); 130 } 131 } 122 132 } 123 133 134 var uiColorRegexp = /\$color/g; 135 124 136 CKEDITOR.tools.extend( editor, 125 137 { 126 138 uiColor: null, … … 132 144 133 145 setUiColor : function( color ) 134 146 { 135 var uiStyle = CKEDITOR.document.getHead().append('style'),147 var uiStyle = addStylesheet( CKEDITOR.document ), 136 148 cssId = '#cke_' + editor.name.replace('.', '\\.'); 137 149 138 150 var cssSelectors = … … 144 156 ].join( ',' ); 145 157 var cssProperties = "background-color: $color !important;"; 146 158 147 uiStyle.setAttribute("type", "text/css"); 159 if ( CKEDITOR.env.webkit ) 160 var cssContent = [ [ cssSelectors, cssProperties ] ]; 161 else 162 var cssContent = cssSelectors + '{' + cssProperties + '}'; 148 163 149 164 return ( this.setUiColor = 150 165 function( color ) 151 166 { 152 var css = cssProperties.replace( '$color', color );167 var replace = [ [ uiColorRegexp, color ] ]; 153 168 editor.uiColor = color; 154 169 155 if ( CKEDITOR.env.ie ) 156 uiStyle.$.styleSheet.cssText = cssSelectors + '{' + css + '}'; 157 else if ( CKEDITOR.env.webkit ) 158 uiStyle.$.sheet.addRule( cssSelectors, css ); 159 else 160 uiStyle.setHtml( cssSelectors + '{' + css + '}' ); 170 // Update general style. 171 updateStylesheets( [ uiStyle ], cssContent, replace ); 161 172 162 menuSetUiColor( color ); 173 // Update menu styles. 174 updateStylesheets( uiColorMenus, uiColorMenuCss, replace ); 163 175 })( color ); 164 176 } 165 177 }); 166 178 167 // If the "menu" plugin is loaded, register the listeners. 168 if ( CKEDITOR.menu ) 179 editor.on( 'menuShow', function( event ) 169 180 { 170 var old = CKEDITOR.menu.prototype.show; 181 var panel = event.data[ 0 ]; 182 var iframe = panel.element.getElementsByTag( 'iframe' ).getItem( 0 ).getFrameDocument(); 171 183 172 CKEDITOR.menu.prototype.show = function() 184 // Add stylesheet if missing. 185 if ( !iframe.getById( 'cke_ui_color' ) ) 173 186 { 174 old.apply( this, arguments ); 187 var node = addStylesheet( iframe ); 188 uiColorMenus.push( node ); 175 189 176 if ( !menuHead && editor == this.editor ) 177 { 178 // Save reference. 179 menuHead = this._.element.getDocument().getHead(); 180 menuSetUiColor( editor.getUiColor() ); 181 } 182 }; 183 } 190 var color = editor.getUiColor(); 191 // Set uiColor for new menu. 192 if ( color ) 193 updateStylesheets( [ node ], uiColorMenuCss, [ [ uiColorRegexp, color ] ] ); 194 } 195 }); 184 196 185 197 // Apply UI color if specified in config. 186 198 if ( editor.config.uiColor ) 187 199 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 200 } 218 201 }; 219 202 })() ); -
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>