From 05f6c7c5f79b56ec6ad6a7e5fbf3133bfd720daa Mon Sep 17 00:00:00 2001 From: taggon Date: Thu, 9 Dec 2010 13:00:27 +0000 Subject: [PATCH] =?UTF-8?q?=EA=B8=80=20=EB=A7=B5=EC=8B=9C=20=EC=A0=9C?= =?UTF-8?q?=EA=B1=B0=20=EA=B8=B0=EB=8A=A5=EC=9D=B4=20=EC=A0=95=EC=83=81?= =?UTF-8?q?=EC=A0=81=EC=9C=BC=EB=A1=9C=20=EB=8F=99=EC=9E=91=ED=95=98?= =?UTF-8?q?=EC=A7=80=20=EC=95=8A=EB=8D=98=20=EB=B2=84=EA=B7=B8=20=EC=88=98?= =?UTF-8?q?=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@7968 201d5d3c-b55e-5fd7-737f-ddc643e51545 --- modules/editor/skins/xeed/js/xeed.js | 64 +++++++++++++--------------- 1 file changed, 29 insertions(+), 35 deletions(-) diff --git a/modules/editor/skins/xeed/js/xeed.js b/modules/editor/skins/xeed/js/xeed.js index abc8eeedd..8b9aa3e34 100644 --- a/modules/editor/skins/xeed/js/xeed.js +++ b/modules/editor/skins/xeed/js/xeed.js @@ -3176,37 +3176,38 @@ Clear = xe.createPlugin('Clear', { } }, API_EXEC_CLEAR : function() { - var sel = this.oApp.getSelection(), node, par, content, after; + var self = this, sel = this.oApp.getSelection(), sc, ec, so, eo, bl, nd, nodes, i, c, next, $pn; if (!sel || sel.collapsed) return; - // get content - content = sel.extractContents(); - sel.select(); + // split text nodes + nodes = sel.getTextNodes(true); + + // get current position + sc = sel[_sc_]; so = sel[_so_]; + ec = sel[_ec_]; eo = sel[_eo_]; + + // start + for(i=0,c=nodes.length;i').appendTo(document).append(content).remove().text(); - - sel.setEndAfter(par.lastChild); - after = sel.extractContents(); - - content = document.createTextNode(content); - par.appendChild(content); - par.appendChild(after); + sel.setStart(sc, so); + sel.setEnd(ec, eo); + sel.select(); // save undo point this.cast('SAVE_UNDO_POINT'); - //this.fireChangeNode(sel); + setTimeout(function(){ if (sel && sel[_sc_]) self.cast('ON_CHANGE_NODE', [sel[_sc_]]) }, 0); } }); /** @@ -4328,21 +4329,14 @@ $.extend(HuskyRange.prototype, W3CDOMRange.prototype, { return oNewParent; }, - isRangeInRange : function(oAnoterRange, bIncludePartlySelected){ - var startToStart = this.compareBoundaryPoints(this.START_TO_START, oAnoterRange); - var startToEnd = this.compareBoundaryPoints(this.START_TO_END, oAnoterRange); - var endToStart = this.compareBoundaryPoints(this.END_TO_START, oAnoterRange); - var endToEnd = this.compareBoundaryPoints(this.END_TO_END, oAnoterRange); + isRangeInRange : function(oAnotherRange, bIncludePartlySelected){ + var startToStart = this.compareBoundaryPoints(this.START_TO_START, oAnotherRange); + var startToEnd = this.compareBoundaryPoints(this.START_TO_END, oAnotherRange); + var endToStart = this.compareBoundaryPoints(this.END_TO_START, oAnotherRange); + var endToEnd = this.compareBoundaryPoints(this.END_TO_END, oAnotherRange); if(startToStart <= 0 && endToEnd >= 0) return true; - - if(bIncludePartlySelected){ - if(startToEnd == 1) return false; - if(endToStart == -1) return false; - return true; - } - - return false; + return bIncludePartlySelected && (startToEnd != 1 && endToStart != -1); }, isNodeInRange : function(oNode, bIncludePartlySelected, bContentOnly){ @@ -5051,7 +5045,7 @@ function get_valid_parent(par, childName) { return par; }; -// collect all sibling +// collect all inline sibling function siblings(node, prev) { var s, ret = [];