}); \r
});\r
var config = { attributes: true, childList: true, characterData: true, subtree: true };\r
- observer.observe(this.node.find('#rng-visualEditor-contentWrapper')[0], config);
+ observer.observe(this.node.find('#rng-visualEditor-contentWrapper')[0], config);\r
+ \r
+ this.gridToggled = false;
},\r
getMetaData: function() {\r
var toret = {};\r
this.selectNode(node);\r
},\r
highlightNode: function(node) {\r
- node.addClass('rng-hover');\r
+ if(!this.gridToggled)\r
+ node.addClass('rng-hover');\r
},\r
dimNode: function(node) {\r
- node.removeClass('rng-hover');\r
+ if(!this.gridToggled)\r
+ node.removeClass('rng-hover');\r
},\r
highlightNodeById: function(id) {\r
var node = this.node.find('#'+id);\r
var newRow = $(sandbox.getTemplate('metaItem')({key: key || '', value: value || ''}));\r
newRow.appendTo(this.metaTable);\r
return newRow;\r
+ },\r
+ toggleGrid: function(toggle) {\r
+ this.node.find('[wlxml-tag]').toggleClass('rng-hover', toggle);\r
+ this.gridToggled = toggle;\r
}\r
};\r
\r
}\r
}\r
\r
+ var toolbarView = {\r
+ node: view.node.find('#rng-visualEditor-toolbar'),\r
+ setup: function() {\r
+ var view = this;\r
+ \r
+ view.node.find('button').click(function(e) {\r
+ var btn = $(e.currentTarget);\r
+ if(btn.attr('data-btn-type') === 'toggle') {\r
+ btn.toggleClass('active')\r
+ mediator.toolbarButtonToggled(btn.attr('data-btn'), btn.hasClass('active'));\r
+ }\r
+ });\r
+ }\r
+ }\r
+ \r
view.setup();\r
sideBarView.setup();\r
+ toolbarView.setup();\r
\r
var mediator = {\r
getCurrentNode: function() {\r
nodeDimmedById: function(id) {\r
view.dimNodeById(id);\r
},\r
+ toolbarButtonToggled: function(btn, toggle) {\r
+ if(btn === 'grid')\r
+ view.toggleGrid(toggle);\r
+ },\r
nodeHovered: function(node) {\r
view.highlightNode(node);\r
sideBarView.highlightNode(node.attr('id'));\r
view.dimNode(node);\r
sideBarView.dimNode(node.attr('id'));\r
}\r
+ \r
}\r
\r
var isDirty = false;\r