JasonWoof Got questions, comments, patches, etc.? Contact Jason Woofenden
vanilla ckeditor-3.5.4
[ckeditor.git] / _source / plugins / styles / plugin.js
index 9a4f13d..4d75b2d 100644 (file)
@@ -815,7 +815,7 @@ CKEDITOR.STYLE_OBJECT = 3;
        {\r
                var root = range.getCommonAncestor( true, true ),\r
                        element = root.getAscendant( this.element, true );\r
-               element && setupElement( element, this );\r
+               element && !element.isReadOnly() && setupElement( element, this );\r
        }\r
 \r
        function removeObjectStyle( range )\r
@@ -872,8 +872,11 @@ CKEDITOR.STYLE_OBJECT = 3;
 \r
                while ( ( block = iterator.getNextParagraph() ) )               // Only one =\r
                {\r
-                       var newBlock = getElement( this, doc, block );\r
-                       replaceBlock( block, newBlock );\r
+                       if ( !block.isReadOnly() )\r
+                       {\r
+                               var newBlock = getElement( this, doc, block );\r
+                               replaceBlock( block, newBlock );\r
+                       }\r
                }\r
 \r
                range.moveToBookmark( bookmark );\r
@@ -1446,6 +1449,16 @@ CKEDITOR.STYLE_OBJECT = 3;
                else\r
                        styleText = unparsedCssText;\r
 \r
+               // Normalize font-family property, ignore quotes and being case insensitive. (#7322)\r
+               // http://www.w3.org/TR/css3-fonts/#font-family-the-font-family-property\r
+               styleText = styleText.replace( /(font-family:)(.*?)(?=;|$)/, function ( match, prop, val )\r
+               {\r
+                       var names = val.split( ',' );\r
+                       for ( var i = 0; i < names.length; i++ )\r
+                               names[ i ] = CKEDITOR.tools.trim( names[ i ].replace( /["']/g, '' ) );\r
+                       return prop + names.join( ',' );\r
+               });\r
+\r
                // Shrinking white-spaces around colon and semi-colon (#4147).\r
                // Compensate tail semi-colon.\r
                return styleText.replace( /\s*([;:])\s*/, '$1' )\r