Visual editor - node hover tag
[fnpeditor.git] / modules / visualEditor.js
index 82ee13e..77ed078 100644 (file)
@@ -121,6 +121,7 @@ rng.modules.visualEditor = function(sandbox) {
             return this.node.find('#rng-visualEditor-content').html();\r
         }, \r
         _markSelected: function(node) {\r
+            this.dimNode(node);\r
             this.node.find('.rng-current').removeClass('rng-current');\r
             node.addClass('rng-current');\r
             this.currentNode = node;\r
@@ -142,12 +143,20 @@ rng.modules.visualEditor = function(sandbox) {
                 this.selectNode(node);\r
         },\r
         highlightNode: function(node) {\r
-            if(!this.gridToggled)\r
+            if(!this.gridToggled) {\r
                 node.addClass('rng-hover');\r
+                var label = node.attr('wlxml-tag');\r
+                if(node.attr('wlxml-class'))\r
+                    label += ' / ' + node.attr('wlxml-class');\r
+                var tag = $('<div>').addClass('rng-visualEditor-nodeHoverTag').text(label);\r
+                node.append(tag);\r
+            }\r
         },\r
         dimNode: function(node) {\r
-            if(!this.gridToggled)\r
+            if(!this.gridToggled) {\r
                 node.removeClass('rng-hover');\r
+                node.find('.rng-visualEditor-nodeHoverTag').remove();\r
+            }\r
         },\r
         highlightNodeById: function(id) {\r
             var node = this.node.find('#'+id);\r