fixed #11012: Code editor corrupts JS

This commit is contained in:
Doug Bell 2009-09-22 17:29:41 -05:00
parent 47390c5d6e
commit 73f17571b2
2 changed files with 15 additions and 0 deletions

View file

@ -97,8 +97,22 @@
_defaultCSS: 'html { height: 95%; } body { background-color: #fff; font:13px/1.22 arial,helvetica,clean,sans-serif;*font-size:small;*font:x-small; } a, a:visited, a:hover { color: blue !important; text-decoration: underline !important; cursor: text !important; } .warning-localfile { border-bottom: 1px dashed red !important; } .yui-busy { cursor: wait !important; } img.selected { border: 2px dotted #808080; } img { cursor: pointer !important; border: none; } body.ptags.webkit div { margin: 11px 0; }'
});
YAHOO.lang.substitute = function ( original ) {
return function( s, o, f ) {
s.replace(/{/g, 'RIGHT_BRACKET');
s.replace(/}/g, 'LEFT_BRACKET');
s = original( s, o, f );
s.replace(/RIGHT_BRACKET/g, '{');
s.replace(/LEFT_BRACKET/g, '}');
return s;
};
}(YAHOO.lang.substitute);
YAHOO.widget.CodeEditor.prototype._cleanIncomingHTML = function(str) {
// Workaround for bug in Lang.substitute
str = str.replace(/{/gi, 'RIGHT_BRACKET');
str = str.replace(/}/gi, 'LEFT_BRACKET');
// &nbsp; before <br> for IE7 so lines show up correctly
if ( this.browser.ie && this.browser.ie <= 7 ) {
str = str.replace(/\r?\n/g, "&nbsp;<br>");