Skip to content

Commit

Permalink
refs #1438
Browse files Browse the repository at this point in the history
 * 저장시 correctContent 작동
 * toggle 및 저장시 correctContent 순서 다시 조정
  • Loading branch information
yupmin committed Feb 11, 2010
1 parent e2d2c66 commit bb6672e
Showing 1 changed file with 11 additions and 6 deletions.
17 changes: 11 additions & 6 deletions plugins/FM_Modern/editor.js
Original file line number Diff line number Diff line change
Expand Up @@ -279,8 +279,8 @@ TTModernEditor.prototype.finalize = function() {
}

TTModernEditor.prototype.syncTextarea = function() {
this.correctContent();
if (this.editMode == "WYSIWYG") {
this.correctContent();
this.textarea.value = this.html2ttml();
}
}
Expand Down Expand Up @@ -1646,17 +1646,21 @@ TTModernEditor.prototype.eventHandler = function(event) {
if(event.keyCode == 13) {
if(this.newLineToParagraph) {
if(STD.isFirefox && !event.shiftKey) {
// TODO : put a p tag
} else {
// TODO : test<br /> -> <p>test</p>
} else if(STD.isWebkit && !event.shiftKey) {
// TODO : test or <div>test</div> -> <p>test</p>
}
} else {
if(STD.isIE && range.parentElement && range.parentElement().tagName != "LI") {
// TODO : <p>test</p> -> <br />
event.returnValue = false;
event.cancelBubble = true;
range.pasteHTML("<br />");
range.collapse(false);
range.select();
return false;
} else if(STD.isWebkit && !event.shiftKey) {
// TODO : test or <div>test</div> -> test<br />
}
}
}
Expand Down Expand Up @@ -1705,6 +1709,7 @@ TTModernEditor.prototype.correctContent = function() {
html = html.replaceAll('class="webkit-block-placeholder"','');
html = html.replaceAll('br class="webkit-block-placeholder"','br /');
html = html.replaceAll('<div><br /></div>','<br />');
html = html.replaceAll('<br>', '<br />');
var dmodeExprs = new Array("font-weight: bold;",
"font-style: italic;",
"text-decoration: underline;",
Expand Down Expand Up @@ -1999,8 +2004,8 @@ TTModernEditor.prototype.toggleMode = function() {
this.iframe.style.display = "none";
this.textarea.style.display = "block";
this.editMode = "TEXTAREA";
this.textarea.value = this.html2ttml();
this.correctContent();
this.textarea.value = this.html2ttml();
this.textarea.focus();
this.resizer.target = this.textarea;
}
Expand All @@ -2014,16 +2019,16 @@ TTModernEditor.prototype.toggleMode = function() {
return;
}
this.editMode = "WYSIWYG";
this.contentDocument.body.innerHTML = this.ttml2html();
this.correctContent();
this.contentDocument.body.innerHTML = this.ttml2html();
try { this.contentDocument.body.focus(); } catch(e) { }
this.resizer.target = this.iframe;
}
}

// 위지윅 모드에서의 selection을 리턴한다
TTModernEditor.prototype.getSelectionRange = function() {
if (!STD.isIE) this.contentWindow.focus();
if (STD.isWebkit) this.contentWindow.focus();
return STD.isIE ? this.contentDocument.selection.createRange() : this.contentWindow.getSelection().getRangeAt(0);
}

Expand Down

0 comments on commit bb6672e

Please sign in to comment.