Skip to content
Permalink
Browse files

Merge branch 't/10166' into major

  • Loading branch information...
Reinmar committed Mar 19, 2013
2 parents 0948a5b + dee464e commit 528fc75d42e25544ed4fc567badb6fcc47f08d48
Showing with 41 additions and 6 deletions.
  1. +38 −4 core/filter.js
  2. +3 −2 plugins/image/plugin.js
@@ -905,9 +905,10 @@
for ( i = 0; i < transformations.length; ++i )
applyTransformationsGroup( that, element, transformations[ i ] );

// Update style and class attrs, because that won't be done after applying rules.
if ( !optimizedRules )
updateAttributes( element );
// Do not count on updateElement(), because it:
// * may not be called,
// * may skip some properties when all are marked as valid.
updateAttributes( element );
}

if ( optimizedRules ) {
@@ -1245,7 +1246,6 @@
delete attrs[ 'class' ];

if ( !status.allAttributes ) {
// We can safely remove class and styles attributes because they will be serialized later.
for ( name in attrs ) {
// If not valid and not internal attribute delete it.
if ( !validAttrs[ name ] ) {
@@ -1710,6 +1710,40 @@
delete element.styles[ styleName ];
},

/**
* Converts the `align` attribute to the `float` style if not set. Attribute
* is always removed.
*
* @param {CKEDITOR.htmlParser.element} element
*/
alignmentToStyle: function( element ) {
if ( !( 'float' in element.styles ) ) {
var value = element.attributes.align;

if ( value == 'left' || value == 'right' )
element.styles.float = value;
}

delete element.attributes.align;
},

/**
* Converts the `float` style to the `align` attribute if not set.
* Style is always removed.
*
* @param {CKEDITOR.htmlParser.element} element
*/
alignmentToAttribute: function( element ) {
if ( !( 'align' in element.attributes ) ) {
var value = element.styles.float;

if ( value == 'left' || value == 'right' )
element.attributes.align = value;
}

delete element.styles.float;
},

/**
* Checks whether an element matches a given {@link CKEDITOR.style}.
* The element can be a "superset" of a style, e.g. it may have
@@ -19,7 +19,7 @@
// Register the dialog.
CKEDITOR.dialog.add( pluginName, this.path + 'dialogs/image.js' );

var allowed = 'img[alt,!src]{border-style,border-width,height,margin,margin-bottom,margin-left,margin-right,margin-top,width}',
var allowed = 'img[alt,!src]{border-style,border-width,float,height,margin,margin-bottom,margin-left,margin-right,margin-top,width}',
required = 'img[alt,src]';

if ( CKEDITOR.dialog.isTabEnabled( editor, pluginName, 'advanced' ) )
@@ -30,7 +30,8 @@
allowedContent: allowed,
requiredContent: required,
contentTransformations: [
[ 'img{width}: sizeToStyle', 'img[width]: sizeToAttribute' ]
[ 'img{width}: sizeToStyle', 'img[width]: sizeToAttribute' ],
[ 'img{float}: alignmentToStyle', 'img[align]: alignmentToAttribute' ]
]
} ) );

0 comments on commit 528fc75

Please sign in to comment.
You can’t perform that action at this time.