fixed #11322: Code Editor Broken
This commit is contained in:
parent
531a2f62b0
commit
d31be40a59
1 changed files with 11 additions and 5 deletions
|
|
@ -212,7 +212,7 @@
|
||||||
this._getSelection().getRangeAt(0).insertNode(this._getDoc().createTextNode(this.cc));
|
this._getSelection().getRangeAt(0).insertNode(this._getDoc().createTextNode(this.cc));
|
||||||
} else if (this.browser.webkit || this.browser.ie || this.browser.opera) {
|
} else if (this.browser.webkit || this.browser.ie || this.browser.opera) {
|
||||||
try {
|
try {
|
||||||
this.execCommand('inserthtml', '<span class="cursor_here"></span>');
|
this.execCommand('inserthtml', this.cc);
|
||||||
}
|
}
|
||||||
catch (e) {}
|
catch (e) {}
|
||||||
}
|
}
|
||||||
|
|
@ -228,7 +228,7 @@
|
||||||
html = html.replace(/<br><div>/ig, '<br>');
|
html = html.replace(/<br><div>/ig, '<br>');
|
||||||
html = html.replace(/<div>/ig, '<br>');
|
html = html.replace(/<div>/ig, '<br>');
|
||||||
html = html.replace(/<br>/ig,'\n');
|
html = html.replace(/<br>/ig,'\n');
|
||||||
html = html.replace(/<.*?>/g,'');
|
html = html.replace(/<[^>]*>/g,'');
|
||||||
html = html.replace(/\r?\n/g,'<br>');
|
html = html.replace(/\r?\n/g,'<br>');
|
||||||
//YAHOO.log('2: ' + html);
|
//YAHOO.log('2: ' + html);
|
||||||
} else {
|
} else {
|
||||||
|
|
@ -237,18 +237,24 @@
|
||||||
}
|
}
|
||||||
YAHOO.log(html);
|
YAHOO.log(html);
|
||||||
// before <br> for IE7
|
// before <br> for IE7
|
||||||
html = html.replace(/( |<span class="cursor_here"><\/span>)?<br[^>]*>/gi,'$1\n');
|
html = html.replace(/( )?<br[^>]*>/gi,'$1\n');
|
||||||
|
html = html.replace(/<\/div>/ig, '');
|
||||||
|
html = html.replace(/<br><div>/ig, '<br>');
|
||||||
|
html = html.replace(/<div>/ig, '<br>');
|
||||||
|
html = html.replace(/<br>/ig,'\n');
|
||||||
html = html.replace(/<[^>]*>/g,'');
|
html = html.replace(/<[^>]*>/g,'');
|
||||||
html = html.replace(/\r?\n/g,'<br>');
|
html = html.replace(/\r?\n/g,'<br>');
|
||||||
// between <br> for IE6
|
// between <br> for IE6
|
||||||
html = html.replace(/<br[^>]*>(<span class="cursor_here"><\/span>)?<br[^>]*>/gi, '<br>$1 <br>');
|
html = html.replace(/<br[^>]*><br[^>]*>/gi, '<br>$1 <br>');
|
||||||
YAHOO.log(html);
|
YAHOO.log(html);
|
||||||
}
|
}
|
||||||
for (var i = 0; i < this.keywords.length; i++) {
|
for (var i = 0; i < this.keywords.length; i++) {
|
||||||
html = html.replace(this.keywords[i].code, this.keywords[i].tag);
|
html = html.replace(this.keywords[i].code, this.keywords[i].tag);
|
||||||
}
|
}
|
||||||
YAHOO.log("AFTER HIGHLIGHT:" + html);
|
YAHOO.log("AFTER HIGHLIGHT:" + html);
|
||||||
html = html.replace('<span class="cursor_here"></span>', '<span id="cur">|</span>');
|
if ( !this.browser.gecko ) {
|
||||||
|
html = html.replace(this.cc, '<span id="cur">|</span>');
|
||||||
|
}
|
||||||
|
|
||||||
this._getDoc().body.innerHTML = html;
|
this._getDoc().body.innerHTML = html;
|
||||||
if (!focus) {
|
if (!focus) {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue