Visual Editor: Moving wlxml information to its own attribute
[fnpeditor.git] / modules / visualEditor.js
index 38f3302..132c70f 100644 (file)
@@ -14,9 +14,10 @@ rng.modules.visualEditor = function(sandbox) {
                 isDirty = true;\r
             });\r
 
-            this.node.on('mouseover', '.rng', function(e) { $(e.target).addClass('rng-hover')});\r
-            this.node.on('mouseout', '.rng', function(e) { $(e.target).removeClass('rng-hover')});\r
-            this.node.on('click', '.rng', function(e) {\r
+            this.node.on('mouseover', '[wlxml-tag]', function(e) { $(e.target).addClass('rng-hover')});\r
+            this.node.on('mouseout', '[wlxml-tag]', function(e) { $(e.target).removeClass('rng-hover')});\r
+            this.node.on('click', '[wlxml-tag]', function(e) {\r
+                console.log('clicked node type: '+e.target.nodeType);\r
                 view._markSelected($(e.target));\r
             });\r
 \r
@@ -24,7 +25,7 @@ rng.modules.visualEditor = function(sandbox) {
                 var anchor = $(window.getSelection().anchorNode);\r
                 if(anchor[0].nodeType === Node.TEXT_NODE)\r
                     anchor = anchor.parent();\r
-                if(!anchor.hasClass('rng'))\r
+                if(!anchor.is('[wlxml-tag]'))\r
                     return;\r
                 view._markSelected(anchor);\r
             });
@@ -54,7 +55,7 @@ rng.modules.visualEditor = function(sandbox) {
             return this.node.find('#rng-visualEditor-content').html();\r
         }, \r
         _markSelected: function(node) {\r
-            this.node.find('.rng').removeClass('rng-current');\r
+            this.node.find('.rng-current').removeClass('rng-current');\r
             node.addClass('rng-current');\r
         }\r
     };\r