return ( this.removeFromRange =\r
this.type == CKEDITOR.STYLE_INLINE ?\r
removeInlineStyle\r
+ : this.type == CKEDITOR.STYLE_OBJECT ?\r
+ removeObjectStyle\r
: null ).call( this, range );\r
},\r
\r
var nodeType = currentNode.type;\r
var nodeName = nodeType == CKEDITOR.NODE_ELEMENT ? currentNode.getName() : null;\r
\r
- if ( nodeName && currentNode.getAttribute( '_fck_bookmark' ) )\r
+ if ( nodeName && currentNode.getAttribute( '_cke_bookmark' ) )\r
{\r
currentNode = currentNode.getNextSourceNode( true );\r
continue;\r
element && setupElement( element, this );\r
}\r
\r
+ function removeObjectStyle( range )\r
+ {\r
+ var root = range.getCommonAncestor( true, true ),\r
+ element = root.getAscendant( this.element, true );\r
+\r
+ if ( !element )\r
+ return;\r
+\r
+ var style = this;\r
+ var def = style._.definition;\r
+ var attributes = def.attributes;\r
+ var styles = CKEDITOR.style.getStyleText( def );\r
+\r
+ // Remove all defined attributes.\r
+ if ( attributes )\r
+ {\r
+ for ( var att in attributes )\r
+ {\r
+ element.removeAttribute( att, attributes[ att ] );\r
+ }\r
+ }\r
+\r
+ // Assign all defined styles.\r
+ if ( def.styles )\r
+ {\r
+ for ( var i in def.styles )\r
+ {\r
+ if ( !def.styles.hasOwnProperty( i ) )\r
+ continue;\r
+\r
+ element.removeStyle( i );\r
+ }\r
+ }\r
+ }\r
+\r
function applyBlockStyle( range )\r
{\r
// Serializible bookmarks is needed here since\r
{\r
// Exclude the ones at header OR at tail,\r
// and ignore bookmark content between them.\r
- var duoBrRegex = /(\S\s*)\n(?:\s|(<span[^>]+_fck_bookmark.*?\/span>))*\n(?!$)/gi,\r
+ var duoBrRegex = /(\S\s*)\n(?:\s|(<span[^>]+_cke_bookmark.*?\/span>))*\n(?!$)/gi,\r
blockName = preBlock.getName(),\r
splitedHtml = replace( preBlock.getOuterHtml(),\r
duoBrRegex,\r
var headBookmark = '',\r
tailBookmark = '';\r
\r
- str = str.replace( /(^<span[^>]+_fck_bookmark.*?\/span>)|(<span[^>]+_fck_bookmark.*?\/span>$)/gi,\r
+ str = str.replace( /(^<span[^>]+_cke_bookmark.*?\/span>)|(<span[^>]+_cke_bookmark.*?\/span>$)/gi,\r
function( str, m1, m2 ){\r
m1 && ( headBookmark = m1 );\r
m2 && ( tailBookmark = m2 );\r
}\r
\r
// Assign all defined styles.\r
- if ( styles )\r
- el.setAttribute( 'style', styles );\r
+ if ( def.styles )\r
+ {\r
+ for ( var i in def.styles )\r
+ {\r
+ if ( !def.styles.hasOwnProperty( i ) )\r
+ continue;\r
+\r
+ el.setStyle( i, def.styles[ i ] );\r
+ }\r
+ }\r
\r
return el;\r
}\r