Ticket #6665: 6665_3.patch
File 6665_3.patch, 3.5 KB (added by , 13 years ago) |
---|
-
_source/plugins/htmldataprocessor/plugin.js
92 92 delete blockLikeTags.pre; 93 93 var defaultDataFilterRules = 94 94 { 95 elements : {}, 95 elements : { 96 a : function( element ) 97 { 98 var attrs = element.attributes; 99 if ( attrs && attrs[ 'data-cke-saved-name' ] ) 100 attrs[ 'class' ] = ( attrs[ 'class' ] ? attrs[ 'class' ] + ' ' : '' ) + 'cke_anchor'; 101 } 102 }, 96 103 attributeNames : 97 104 [ 98 105 // Event attributes (onXYZ) must not be directly set. They can become … … 288 295 defaultHtmlFilterRules.elements[ i ] = unprotectReadyOnly; 289 296 } 290 297 291 var protect AttributeRegex = /<((?:a|area|img|input)\b[\s\S]*?\s)((href|src|name)\s*=\s*(?:(?:"[^"]*")|(?:'[^']*')|(?:[^ "'>]+)))([^>]*)>/gi,292 findSavedSrcRegex = /\sdata-cke-saved-src\s*=/;298 var protectElementRegex = /<(a|area|img|input)\b([^>]*)>/gi, 299 protectAttributeRegex = /\b(href|src|name)\s*=\s*(?:(?:"[^"]*")|(?:'[^']*')|(?:[^ "'>]+))/gi; 293 300 294 301 var protectElementsRegex = /(?:<style(?=[ >])[^>]*>[\s\S]*<\/style>)|(?:<(:?link|meta|base)[^>]*>)/gi, 295 302 encodedElementsRegex = /<cke:encoded>([^<]*)<\/cke:encoded>/gi; … … 301 308 302 309 function protectAttributes( html ) 303 310 { 304 return html.replace( protectAttributeRegex, function( tag, beginning, fullAttr, attrName, end ) 305 { 306 // We should not rewrite the _cke_saved_src attribute (#5218) 307 if ( attrName == 'src' && findSavedSrcRegex.test( tag ) ) 308 return tag; 309 else 310 return '<' + beginning + fullAttr + ' data-cke-saved-' + fullAttr + end + '>'; 311 }); 311 return html.replace( protectElementRegex, function( element, tag, attributes ) 312 { 313 return '<' + tag + attributes.replace( protectAttributeRegex, function( fullAttr, attrName ) 314 { 315 // We should not rewrite the existed protected attributes, e.g. clipboard content from editor. (#5218) 316 if ( attributes.indexOf( 'data-cke-saved-' + attrName ) == -1 ) 317 return ' data-cke-saved-' + fullAttr + ' ' + fullAttr; 318 319 return fullAttr; 320 }) + '>'; 321 }); 312 322 } 313 323 314 324 function protectElements( html ) -
_source/plugins/link/dialogs/link.js
225 225 advAttr( 'advId', 'id' ); 226 226 advAttr( 'advLangDir', 'dir' ); 227 227 advAttr( 'advAccessKey', 'accessKey' ); 228 advAttr( 'advName', 'name' ); 228 229 retval.adv.advName = 230 element.data( 'cke-saved-name' ) 231 || element.getAttribute( 'name' ) 232 || ''; 229 233 advAttr( 'advLangCode', 'lang' ); 230 234 advAttr( 'advTabIndex', 'tabindex' ); 231 235 advAttr( 'advTitle', 'title' ); … … 1286 1290 advAttr( 'advId', 'id' ); 1287 1291 advAttr( 'advLangDir', 'dir' ); 1288 1292 advAttr( 'advAccessKey', 'accessKey' ); 1289 advAttr( 'advName', 'name' ); 1293 1294 if ( data.adv[ 'advName' ] ) 1295 { 1296 attributes[ 'name' ] = attributes[ 'data-cke-saved-name' ] = data.adv[ 'advName' ]; 1297 attributes[ 'class' ] = ( attributes[ 'class' ] ? attributes[ 'class' ] + ' ' : '' ) + 'cke_anchor'; 1298 } 1299 else 1300 removeAttributes = removeAttributes.concat( [ 'data-cke-saved-name', 'name' ] ); 1301 1290 1302 advAttr( 'advLangCode', 'lang' ); 1291 1303 advAttr( 'advTabIndex', 'tabindex' ); 1292 1304 advAttr( 'advTitle', 'title' );