Ticket #3710: 3710_2.patch
File 3710_2.patch, 1.9 KB (added by , 15 years ago) |
---|
-
_source/plugins/htmldataprocessor/plugin.js
191 191 return html.replace( protectAttributeRegex, '$& _cke_saved_$1' ); 192 192 } 193 193 194 var protectStyleTagsRegex = /<(style)(?=[ >])[^>]*>[^<]*<\/\1>/gi; 195 var encodedTagsRegex = /<cke:encoded>([^<]*)<\/cke:encoded>/gi; 196 197 function protectStyleTagsMatch( match ) 198 { 199 return '<cke:encoded>' + encodeURIComponent( match ) + '</cke:encoded>'; 200 } 201 202 function protectStyleTags( html ) 203 { 204 return html.replace( protectStyleTagsRegex, protectStyleTagsMatch ); 205 } 206 207 function unprotectEncodedTagsMatch( match, encoded ) 208 { 209 return decodeURIComponent( encoded ); 210 } 211 212 function unprotectEncodedTags( html ) 213 { 214 return html.replace( encodedTagsRegex, unprotectEncodedTagsMatch ); 215 } 216 194 217 CKEDITOR.plugins.add( 'htmldataprocessor', 195 218 { 196 219 requires : [ 'htmlwriter' ], … … 227 250 // the code. 228 251 data = protectAttributes( data ); 229 252 253 // IE remvoes style tags from innerHTML. (#3710). 254 if ( CKEDITOR.env.ie ) 255 data = protectStyleTags( data ); 256 230 257 // Call the browser to help us fixing a possibly invalid HTML 231 258 // structure. 232 259 var div = document.createElement( 'div' ); 233 260 div.innerHTML = data; 261 data = div.innerHTML; 234 262 263 if ( CKEDITOR.env.ie ) 264 data = unprotectEncodedTags( data ); 265 235 266 // Now use our parser to make further fixes to the structure, as 236 267 // well as apply the filter. 237 var fragment = CKEDITOR.htmlParser.fragment.fromHtml( d iv.innerHTML, fixForBody ),268 var fragment = CKEDITOR.htmlParser.fragment.fromHtml( data, fixForBody ), 238 269 writer = new CKEDITOR.htmlParser.basicWriter(); 239 270 240 271 fragment.writeHtml( writer, this.dataFilter );