From: Aleksander Ɓukasz Date: Mon, 15 Jul 2013 15:06:28 +0000 (+0200) Subject: Quick fix: Fixing node element selection X-Git-Url: https://git.mdrn.pl/fnpeditor.git/commitdiff_plain/724c4850eb0d7e4001ad1461e027d66339b9e525 Quick fix: Fixing node element selection Cursor now lands in a text element chosen to be selected by canvas algorithm. --- diff --git a/modules/documentCanvas/canvas/canvas.js b/modules/documentCanvas/canvas/canvas.js index 7a1d930..76eddb1 100644 --- a/modules/documentCanvas/canvas/canvas.js +++ b/modules/documentCanvas/canvas/canvas.js @@ -208,11 +208,12 @@ $.extend(Canvas.prototype, { if(currentTextElement && !(currentTextElement.sameNode(textElementToLand))) this.wrapper.find('.current-text-element').removeClass('current-text-element'); - if(textElementToLand && !(textElementToLand.sameNode(currentTextElement))) { + if(textElementToLand) { _markAsCurrent(textElementToLand); - if(params.caretTo) + if(params.caretTo || !textElementToLand.sameNode(this.getCursor().getPosition().element)) this._moveCaretToTextElement(textElementToLand, params.caretTo); // as method on element? - this.publisher('currentTextElementSet', element); + if(!(textElementToLand.sameNode(currentTextElement))) + this.publisher('currentTextElementSet', element); } if(!(currentNodeElement && currentNodeElement.sameNode(nodeElementToLand))) {