X-Git-Url: https://git.mdrn.pl/fnpeditor.git/blobdiff_plain/f7c97ef38dc00ec9b5358ae0bf959a5e6f99271c..69be72cddc103e106ad80640a85f6a03def3f960:/modules/documentCanvas/canvasManager.js?ds=inline diff --git a/modules/documentCanvas/canvasManager.js b/modules/documentCanvas/canvasManager.js index 71c9342..a42eee6 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]); @@ -184,7 +186,7 @@ Manager.prototype.onEnterKey = function(e) { if(pos.isAtEnd) { newNode = canvasNode.create({tag: pos.parentNode.attr('wlxml-tag'), klass: pos.parentNode.attr('wlxml-class')}); - this.canvas.nodeInsertAfter({node: newNode, after: canvas.getNodeById(pos.parentNode.attr('id'))}); + this.canvas.nodeInsertAfter({node: newNode, after: this.canvas.getNodeById(pos.parentNode.attr('id'))}); } else { newNode = this.canvas.nodeSplit({node: contextNode, textNodeIdx: pos.textNodeIndex, offset: pos.textNodeOffset}); } @@ -221,11 +223,11 @@ Manager.prototype.command = function(command, meta) { this.sandbox.publish('contentChanged'); } else { - if(!this.canvas.nodeInsideList({node: node})) { - this.canvas.listCreate({start: node, end: canvasNode.create(pos.focusNode)}); + //if(!this.canvas.nodeInsideList({node: node})) { + this.canvas.listCreate({start: node, end: canvasNode.create(pos.focusNode), type: meta}); this.selectNode(node, {movecaret: 'end'}); this.sandbox.publish('contentChanged'); - } + //} } }