From da205a8d31ffcbd48db5a6aebdf930c0187ba6fb Mon Sep 17 00:00:00 2001 From: taggon Date: Thu, 9 Dec 2010 13:39:42 +0000 Subject: [PATCH] =?UTF-8?q?#19318752,=20#19318356=20=EC=A4=84=EB=B0=94?= =?UTF-8?q?=EA=BF=88=EC=8B=9C=20=EC=8A=A4=ED=81=AC=EB=A1=A4=20=EC=9C=84?= =?UTF-8?q?=EC=B9=98=20=EB=AC=B8=EC=A0=9C=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit git-svn-id: http://xe-core.googlecode.com/svn/sandbox@7969 201d5d3c-b55e-5fd7-737f-ddc643e51545 --- modules/editor/skins/xeed/js/xeed.js | 33 +++++++++++++++++++++++----- 1 file changed, 28 insertions(+), 5 deletions(-) diff --git a/modules/editor/skins/xeed/js/xeed.js b/modules/editor/skins/xeed/js/xeed.js index 8b9aa3e34..88c06c050 100644 --- a/modules/editor/skins/xeed/js/xeed.js +++ b/modules/editor/skins/xeed/js/xeed.js @@ -122,7 +122,7 @@ Xeed = xe.createApp('Xeed', { this.registerPlugin(new Clear); // set content - if (!content) content = '
'; + if (!$.browser.msie && !content) content = '
'; setTimeout(function(){ self.cast('SET_CONTENT', [content]) }, 0); }, @@ -403,9 +403,13 @@ Xeed = xe.createApp('Xeed', { var self = this, sel = this.getSelection(); if (sel) return; + if (!$.browser.msie && !this.$richedit.html()) this.cast('SET_CONTENT', ['
']); - if (!this.$richedit.html()) this.cast('SET_CONTENT', ['
']); this.$richedit.focus(); + + sel = this.getEmptySelection(); + sel.selectNodeContents(this.$richedit[0]); + sel.select(); }, /** @@ -1393,7 +1397,7 @@ LineBreak = xe.createPlugin('LineBreak', { sel.select(); }, insertBR : function(sel) { - var self = this, $br = $('
'), st, block, child, $par, $p, $prev_br, $clone, $block; + var self = this, $br = $('
'), st, block, child, nd, top, $par, $p, $prev_br, $clone, $block, $a, $rich, $ctn; // insert Node sel.insertNode($br[0]); @@ -1432,8 +1436,10 @@ LineBreak = xe.createPlugin('LineBreak', { //
timer if (!this._in_br) { - try { $br[0].scrollIntoView() } catch(e){}; - + $br.after( $a = $('A') ); + this._scrollIntoView($a[0]); + $a.remove(); + this._in_br = true; this._br_timer = setTimeout(function(){ self._in_br = false; }, 500); return; @@ -1468,6 +1474,23 @@ LineBreak = xe.createPlugin('LineBreak', { this._in_br = false; clearTimeout(this._br_timer); + }, + _scrollIntoView : function(nd) { + var $rich, $ctn, top, sctop; + + top = nd.offsetHeight; + while(!rx_root.test(nd.className||'')) { + top += nd.offsetTop; + nd = nd.offsetParent; + } + + // rich editor and container + $rich = this.oApp.$richedit; + $ctn = $rich.parent(); + + // scrolltop + sctop = top - $ctn.height() + parseInt($rich.css('padding-top')); + if ($ctn[0].scrollTop < sctop) $ctn[0].scrollTop = sctop; } }); /**