Changeset 620
- Timestamp:
- 12/22/06 20:18:54 (6 years ago)
- Files:
-
- 1 modified
-
trunk/htmlarea.js (modified) (7 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/htmlarea.js
r617 r620 363 363 this.showLoading = false; 364 364 365 // set to false if you want to allow JavaScript in the content, otherwise <script> tags are stripped out 366 this.stripScripts = true; 367 365 368 // size of color picker cells 366 369 this.colorPickerCellSize = '6px'; … … 5140 5143 html = html.replace(/<script[\s]*src[\s]*=[\s]*['"]chrome:\/\/.*?["']>[\s]*<\/script>/ig, ''); 5141 5144 } 5145 //prevent execution of JavaScript (Ticket #685) 5146 html = html.replace(/(<script[^>]*)(freezescript)/gi,"$1javascript"); 5142 5147 5143 5148 return html; … … 5161 5166 5162 5167 html = this.inwardSpecialReplacements(html); 5168 5169 html = html.replace(/(<script[^>]*)(javascript)/gi,"$1freezescript"); 5163 5170 5164 5171 // For IE's sake, make any URLs that are semi-absolute (="/....") to be … … 5698 5705 HTMLArea._blockTags = " body form textarea fieldset ul ol dl li div " + 5699 5706 "p h1 h2 h3 h4 h5 h6 quote pre table thead " + 5700 "tbody tfoot tr td th iframe address blockquote ";5707 "tbody tfoot tr td th iframe address blockquote "; 5701 5708 HTMLArea.isBlockElement = function(el) 5702 5709 { … … 5800 5807 var i; 5801 5808 var root_tag = (root.nodeType == 1) ? root.tagName.toLowerCase() : ''; 5809 if ( ( root_tag == "script" || root_tag == "noscript" ) && editor.config.stripScripts ) 5810 { 5811 break; 5812 } 5802 5813 if ( outputRoot ) 5803 5814 { … … 5821 5832 } 5822 5833 break; 5823 } else if ( outputRoot ) 5834 } 5835 else if ( outputRoot ) 5824 5836 { 5825 5837 closed = (!(root.hasChildNodes() || HTMLArea.needsClosingTag(root))); … … 5924 5936 } 5925 5937 var containsBlock = false; 5926 for ( i = root.firstChild; i; i = i.nextSibling ) 5927 { 5928 if ( !containsBlock && i.nodeType == 1 && HTMLArea.isBlockElement(i) ) 5929 { 5930 containsBlock = true; 5931 } 5932 html += HTMLArea.getHTMLWrapper(i, true, editor, indent + ' '); 5933 } 5934 if ( outputRoot && !closed ) 5935 { 5936 html += (HTMLArea.is_ie && HTMLArea.isBlockElement(root) && containsBlock ? ('\n' + indent) : '') + "</" + root.tagName.toLowerCase() + ">"; 5938 if ( root_tag == "script" || root_tag == "noscript" ) 5939 { 5940 if ( !editor.config.stripScripts ) 5941 { 5942 var innerText = (HTMLArea.is_ie) ? "\n" + root.innerHTML.replace(/^[\n\r]*/,'').replace(/\s+$/,'') + '\n' + indent : root.firstChild.nodeValue; 5943 html += innerText + '</'+root_tag+'>' + ((HTMLArea.is_ie) ? '\n' : ''); 5944 } 5945 } 5946 else 5947 { 5948 for ( i = root.firstChild; i; i = i.nextSibling ) 5949 { 5950 if ( !containsBlock && i.nodeType == 1 && HTMLArea.isBlockElement(i) ) 5951 { 5952 containsBlock = true; 5953 } 5954 html += HTMLArea.getHTMLWrapper(i, true, editor, indent + ' '); 5955 } 5956 if ( outputRoot && !closed ) 5957 { 5958 html += (HTMLArea.is_ie && HTMLArea.isBlockElement(root) && containsBlock ? ('\n' + indent) : '') + "</" + root.tagName.toLowerCase() + ">"; 5959 } 5937 5960 } 5938 5961 break;
