Ticket #3591: 3591_2.patch
File 3591_2.patch, 1.6 KB (added by , 15 years ago) |
---|
-
plugins/htmldataprocessor/plugin.js
7 7 { 8 8 var defaultDataFilterRules = 9 9 { 10 elementNames :11 [12 // Elements that cause problems in wysiwyg mode.13 [ ( /^(object|embed|param)$/ ), 'cke:$1' ]14 ],15 16 10 attributeNames : 17 11 [ 18 12 // Event attributes (onXYZ) must not be directly set. They can become … … 105 99 } 106 100 107 101 var protectAttributeRegex = /<(?:a|area|img|input).*?\s((?:href|src|name)\s*=\s*(?:(?:"[^"]*")|(?:'[^']*')|(?:[^ "'>]+)))/gi; 108 102 var protectElementNamesRegex = /(<[/]?)(object|embed|param)(.*?>)/gi; 109 103 function protectAttributes( html ) 110 104 { 111 105 return html.replace( protectAttributeRegex, '$& _cke_saved_$1' ); 112 106 } 107 function protectElementsNames( html ) 108 { 109 return html.replace( protectElementNamesRegex, '$1cke:$2$3'); 110 } 113 111 114 112 CKEDITOR.plugins.add( 'htmldataprocessor', 115 113 { … … 145 143 // the code. 146 144 data = protectAttributes( data ); 147 145 146 // Certain elements has problem during native DOM operation, we transform them into 147 // their 'agent' intead, prefixing with 'cke:' to become a custom element. 148 data = protectElementsNames( data ); 149 148 150 // Call the browser to help us fixing a possibly invalid HTML 149 151 // structure. 150 var div = document.createElement( ' div' );152 var div = document.createElement( 'body' ); 151 153 div.innerHTML = data; 152 154 153 155 // Now use our parser to make further fixes to the structure, as