X-Git-Url: https://git.mdrn.pl/fnpeditor.git/blobdiff_plain/c9ec6d3adaf0d2119ed2ef7eecc2e5b525f2f86d..73bf2a4f0496bb60e08c0d37fdf33170e9e536cf:/modules/visualEditor.js?ds=sidebyside
diff --git a/modules/visualEditor.js b/modules/visualEditor.js
index 39859a8..77ed078 100644
--- a/modules/visualEditor.js
+++ b/modules/visualEditor.js
@@ -121,6 +121,7 @@ rng.modules.visualEditor = function(sandbox) {
return this.node.find('#rng-visualEditor-content').html();
},
_markSelected: function(node) {
+ this.dimNode(node);
this.node.find('.rng-current').removeClass('rng-current');
node.addClass('rng-current');
this.currentNode = node;
@@ -142,12 +143,20 @@ rng.modules.visualEditor = function(sandbox) {
this.selectNode(node);
},
highlightNode: function(node) {
- if(!this.gridToggled)
+ if(!this.gridToggled) {
node.addClass('rng-hover');
+ var label = node.attr('wlxml-tag');
+ if(node.attr('wlxml-class'))
+ label += ' / ' + node.attr('wlxml-class');
+ var tag = $('
').addClass('rng-visualEditor-nodeHoverTag').text(label);
+ node.append(tag);
+ }
},
dimNode: function(node) {
- if(!this.gridToggled)
+ if(!this.gridToggled) {
node.removeClass('rng-hover');
+ node.find('.rng-visualEditor-nodeHoverTag').remove();
+ }
},
highlightNodeById: function(id) {
var node = this.node.find('#'+id);
@@ -179,6 +188,9 @@ rng.modules.visualEditor = function(sandbox) {
toggleGrid: function(toggle) {
this.node.find('[wlxml-tag]').toggleClass('rng-hover', toggle);
this.gridToggled = toggle;
+ },
+ toggleTags: function(toggle) {
+
}
};
@@ -258,7 +270,7 @@ rng.modules.visualEditor = function(sandbox) {
id: node.parent().attr('id')
}
var children = [];
- node.children().each(function() {
+ node.children('[wlxml-tag]').each(function() {
var child = $(this);
children.push({repr: child.attr('wlxml-tag') + ' / ' + (child.attr('wlxml-class') || '[[no class]]'), id: child.attr('id')});
});
@@ -317,6 +329,8 @@ rng.modules.visualEditor = function(sandbox) {
toolbarButtonToggled: function(btn, toggle) {
if(btn === 'grid')
view.toggleGrid(toggle);
+ if(btn === 'tags')
+ view.toggleTags(toggle);
},
nodeHovered: function(node) {
view.highlightNode(node);