Ticket #5292: 5292_2.patch
File 5292_2.patch, 3.5 KB (added by , 14 years ago) |
---|
-
_source/plugins/font/plugin.js
29 29 vars[ styleType ] = values[ i ] = parts[ 1 ] || name; 30 30 31 31 styles[ name ] = new CKEDITOR.style( styleDefinition, vars ); 32 styles[ name ]._.definition.name = name; 32 33 } 33 34 else 34 35 names.splice( i--, 1 ); … … 55 56 var name = names[ i ]; 56 57 57 58 // Add the tag entry to the panel list. 58 this.add( name, '<span style="font-' + styleType + ':' + values[ i ] + '">' + name + '</span>', name );59 this.add( name, styles[ name ].buildPreview(), name ); 59 60 } 60 61 }, 61 62 -
_source/plugins/styles/plugin.js
298 298 } 299 299 } 300 300 return false; 301 }, 302 303 // Builds the preview HTML based on the styles definition. 304 buildPreview : function() 305 { 306 var styleDefinition = this._.definition, 307 html = [], 308 elementName = styleDefinition.element; 309 310 // Avoid <bdo> in the preview. 311 if ( elementName == 'bdo' ) 312 elementName = 'span'; 313 314 html = [ '<', elementName ]; 315 316 // Assign all defined attributes. 317 var attribs = styleDefinition.attributes; 318 if ( attribs ) 319 { 320 for ( var att in attribs ) 321 { 322 html.push( ' ', att, '="', attribs[ att ], '"' ); 323 } 324 } 325 326 // Assign the style attribute. 327 var cssStyle = CKEDITOR.style.getStyleText( styleDefinition ); 328 if ( cssStyle ) 329 html.push( ' style="', cssStyle, '"' ); 330 331 html.push( '>', styleDefinition.name, '</', elementName, '>' ); 332 333 return html.join( '' ); 301 334 } 302 335 }; 303 336 … … 1234 1267 temp [ isStyle ? 'setStyle' : 'setAttribute' ]( name, value ); 1235 1268 return temp[ isStyle ? 'getStyle' : 'getAttribute' ]( name ); 1236 1269 } 1237 1270 1238 1271 function normalizeCssText( unparsedCssText, nativeNormalize ) 1239 1272 { 1240 1273 var styleText; -
_source/plugins/stylescombo/plugin.js
85 85 86 86 combo.add( 87 87 styleName, 88 style.type == CKEDITOR.STYLE_OBJECT ? styleName : buildPreview( style._.definition),88 style.type == CKEDITOR.STYLE_OBJECT ? styleName : style.buildPreview(), 89 89 styleName ); 90 90 } 91 91 … … 190 190 } 191 191 }); 192 192 193 function buildPreview( styleDefinition )194 {195 var html = [];196 197 var elementName = styleDefinition.element;198 199 // Avoid <bdo> in the preview.200 if ( elementName == 'bdo' )201 elementName = 'span';202 203 html = [ '<', elementName ];204 205 // Assign all defined attributes.206 var attribs = styleDefinition.attributes;207 if ( attribs )208 {209 for ( var att in attribs )210 {211 html.push( ' ', att, '="', attribs[ att ], '"' );212 }213 }214 215 // Assign the style attribute.216 var cssStyle = CKEDITOR.style.getStyleText( styleDefinition );217 if ( cssStyle )218 html.push( ' style="', cssStyle, '"' );219 220 html.push( '>', styleDefinition.name, '</', elementName, '>' );221 222 return html.join( '' );223 }224 225 193 function sortStyles( styleA, styleB ) 226 194 { 227 195 var typeA = styleA.type,