From: Aleksander Ɓukasz Date: Thu, 27 Jun 2013 13:10:49 +0000 (+0200) Subject: Fixing returning from source to visual editor after edit X-Git-Url: https://git.mdrn.pl/fnpeditor.git/commitdiff_plain/0b89e99ee683a4104d07b0756e090becaa52ad9c?hp=cca351c564d1bc9eabf6aca2bc13d41218443703 Fixing returning from source to visual editor after edit --- diff --git a/modules/documentCanvas/canvasManager.js b/modules/documentCanvas/canvasManager.js index 7e34e29..b6a316e 100644 --- a/modules/documentCanvas/canvasManager.js +++ b/modules/documentCanvas/canvasManager.js @@ -159,6 +159,8 @@ Manager.prototype.selectFirstNode = function() { }; Manager.prototype.movecaretToNode = function(nodeElement, where) { + if(!nodeElement.length) + return; var range = document.createRange(); range.selectNodeContents(nodeElement[0]); diff --git a/modules/documentCanvas/documentCanvas.js b/modules/documentCanvas/documentCanvas.js index a4dcf37..4ca0a4d 100644 --- a/modules/documentCanvas/documentCanvas.js +++ b/modules/documentCanvas/documentCanvas.js @@ -25,7 +25,7 @@ return function(sandbox) { sandbox.publish('documentSet'); }, getDocument: function() { - return canvas.toXML(); + return transformations.toXML.getXML(canvas.getContent()) }, modifyCurrentNode: function(attr, value) { if(manager.currentNode) {