X-Git-Url: https://git.mdrn.pl/fnpeditor.git/blobdiff_plain/0214643f72c6aaa8e85eaba2ad27f2ca03ca6401..2bb0e6a7d19dc695f82373e568e6959c6b995eca:/modules/documentCanvas/documentCanvas.js diff --git a/modules/documentCanvas/documentCanvas.js b/modules/documentCanvas/documentCanvas.js index 7e7fdf0..ea44955 100644 --- a/modules/documentCanvas/documentCanvas.js +++ b/modules/documentCanvas/documentCanvas.js @@ -92,7 +92,7 @@ return function(sandbox) { anchor.before(newNode) else anchor.after(newNode); - mediator.nodeCreated(newNode); + this.selectNode(newNode); //isDirty = true; sandbox.publish('contentChanged'); }, @@ -115,7 +115,8 @@ return function(sandbox) { $(node).replaceWith(newNode); newNode.before(prefix); newNode.after(suffix); - mediator.nodeCreated(newNode); + + this.selectNode(newNode); //isDirty = true; sandbox.publish('contentChanged'); } @@ -141,7 +142,8 @@ return function(sandbox) { node.replaceWith(newNode); newNode.before(prefixNode); newNode.after(suffixNode); - mediator.nodeCreated(newNode); + + this.selectNode(newNode); //isDirty = true; sandbox.publish('contentChanged'); } @@ -155,9 +157,9 @@ return function(sandbox) { _markSelected: function(node) { this.dimNode(node); - this.node.find('.rng-current').removeClass('rng-current'); + this.node.find('.rng-module-documentCanvas-currentNode').removeClass('rng-module-documentCanvas-currentNode'); - node.addClass('rng-current'); + node.addClass('rng-module-documentCanvas-currentNode'); this.currentNode = node; sandbox.publish('nodeSelected', node); @@ -180,18 +182,18 @@ return function(sandbox) { }, highlightNode: function(node) { if(!this.gridToggled) { - node.addClass('rng-hover'); + node.addClass('rng-common-hoveredNode'); var label = node.attr('wlxml-tag'); if(node.attr('wlxml-class')) label += ' / ' + node.attr('wlxml-class'); - var tag = $('
').addClass('rng-visualEditor-nodeHoverTag').text(label); + var tag = $('
').addClass('rng-module-documentCanvas-hoveredNodeTag').text(label); node.append(tag); } }, dimNode: function(node) { if(!this.gridToggled) { - node.removeClass('rng-hover'); - node.find('.rng-visualEditor-nodeHoverTag').remove(); + node.removeClass('rng-common-hoveredNode'); + node.find('.rng-module-documentCanvas-hoveredNodeTag').remove(); } }, highlightNodeById: function(id) { @@ -217,7 +219,7 @@ return function(sandbox) { this.selectNode(node); }, toggleGrid: function(toggle) { - this.node.find('[wlxml-tag]').toggleClass('rng-hover', toggle); + this.node.find('[wlxml-tag]').toggleClass('rng-common-hoveredNode', toggle); this.gridToggled = toggle; } }; @@ -246,8 +248,16 @@ return function(sandbox) { }, selectNode: function(id) { view.selectNodeById(id); + }, + toggleGrid: function(toggle) { + view.toggleGrid(toggle); + }, + insertNewNode: function(wlxmlTag, wlxmlClass) { + view.insertNewNode(wlxmlTag, wlxmlClass); + }, + wrapSelectionWithNewNode: function(wlxmlTag, wlxmlClass) { + view.wrapSelectionWithNewNode(wlxmlTag, wlxmlClass); } - } };