From 73f17571b29906edb6b9e399919ee41e331c2262 Mon Sep 17 00:00:00 2001 From: Doug Bell Date: Tue, 22 Sep 2009 17:29:41 -0500 Subject: [PATCH] fixed #11012: Code editor corrupts JS --- docs/changelog/7.x.x.txt | 1 + .../yui-webgui/build/code-editor/code-editor.js | 14 ++++++++++++++ 2 files changed, 15 insertions(+) diff --git a/docs/changelog/7.x.x.txt b/docs/changelog/7.x.x.txt index 5120a5803..29c657a20 100644 --- a/docs/changelog/7.x.x.txt +++ b/docs/changelog/7.x.x.txt @@ -59,6 +59,7 @@ - fixed #11011: Inherit URL from parent can generate bad URLs - fixed #11022: Deleting user shows "TRUE" prompt - fixed #10029: Account CSS rule scoping, round #2. + - fixed #11012: Code editor corrupts JS 7.7.19 - fixed #10838: Forwarded forum post email to new CS adds reply to original thread diff --git a/www/extras/yui-webgui/build/code-editor/code-editor.js b/www/extras/yui-webgui/build/code-editor/code-editor.js index b0cb71751..a482f997d 100755 --- a/www/extras/yui-webgui/build/code-editor/code-editor.js +++ b/www/extras/yui-webgui/build/code-editor/code-editor.js @@ -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'); + //   before
for IE7 so lines show up correctly if ( this.browser.ie && this.browser.ie <= 7 ) { str = str.replace(/\r?\n/g, " 
");