Skip to content

Instantly share code, notes, and snippets.

@jshirley
Created October 2, 2009 23:44
Show Gist options
  • Save jshirley/200259 to your computer and use it in GitHub Desktop.
Save jshirley/200259 to your computer and use it in GitHub Desktop.
diff --git a/src/editor/js/simple-editor.js b/src/editor/js/simple-editor.js
index 4660093..c525290 100644
--- a/src/editor/js/simple-editor.js
+++ b/src/editor/js/simple-editor.js
@@ -4609,10 +4609,8 @@ var Dom = YAHOO.util.Dom,
html = html.replace(/\t/gi, '    '); //Repl
}
//Removing Script Tags from the Editor
- html = html.replace(/<script([^>]*)>/gi, '<bad>');
- html = html.replace(/<\/script([^>]*)>/gi, '</bad>');
- html = html.replace(/&lt;script([^>]*)&gt;/gi, '<bad>');
- html = html.replace(/&lt;\/script([^>]*)&gt;/gi, '</bad>');
+ html = html.replace(/<script([^>]*)>/gi, '&lt;script$1&gt;');
+ html = html.replace(/<\/script([^>]*)>/gi, '&lt;/script&gt;');
//Replace the line feeds
html = html.replace(/\r\n/g, '<YUI_LF>').replace(/\n/g, '<YUI_LF>')
@@ -4739,6 +4737,9 @@ var Dom = YAHOO.util.Dom,
html = html.replace(/<YUI_EMBED([^>]*)>/g, '<embed$1>');
html = html.replace(/<\/YUI_EMBED>/g, '<\/embed>');
+ html = html.replace(/&lt;script([^&>]*)&gt;/g, '<script$1>')
+ html = html.replace(/&lt;\/script&gt;/g, '<\/script>');
+
//This should fix &amp;'s in URL's
html = html.replace(/ &amp; /gi, ' YUI_AMP ');
html = html.replace(/ &amp;/gi, ' YUI_AMP_F ');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment