Visual editor - status bar with breadcrumbs
[fnpeditor.git] / modules / visualEditor.js
index a607d86..17e7f73 100644 (file)
@@ -326,9 +326,42 @@ rng.modules.visualEditor = function(sandbox) {
         }\r
     }\r
     \r
+    var statusBarView = {\r
+        node: view.node.find('#rng-visualEditor-statusbar'),\r
+        setup: function() {\r
+            var view = this;\r
+            view.node.on('mouseenter', 'a', function(e) {\r
+                var target = $(e.target);\r
+                mediator.nodeHighlightedById(target.attr('data-id')); \r
+            });\r
+            view.node.on('mouseleave', 'a', function(e) {\r
+                var target = $(e.target);\r
+                mediator.nodeDimmedById(target.attr('data-id')); \r
+            });\r
+            view.node.on('click', 'a', function(e) {\r
+                e.preventDefault();\r
+                mediator.nodeSelectedById($(e.target).attr('data-id'));\r
+            });\r
+        },\r
+        \r
+        showNode: function(node) {\r
+            this.node.empty();\r
+            this.node.html(sandbox.getTemplate('statusBarNodeDisplay')({node: node, parents: node.parents('[wlxml-tag]')}));\r
+            //node.parents('[wlxml-tag]')\r
+        },\r
+        \r
+        highlightNode: function(id) {\r
+            this.node.find('a[data-id="'+id+'"]').addClass('rng-hover');\r
+        },\r
+        dimNode: function(id) {\r
+            this.node.find('a[data-id="' +id+'"]').removeClass('rng-hover');\r
+        }\r
+    }\r
+    \r
     view.setup();\r
     sideBarView.setup();\r
     toolbarView.setup();\r
+    statusBarView.setup();\r
     \r
     var mediator = {\r
         getCurrentNode: function() {\r
@@ -339,6 +372,7 @@ rng.modules.visualEditor = function(sandbox) {
         },\r
         nodeSelected: function(node) {\r
             sideBarView.updateEditPane(node);\r
+            statusBarView.showNode(node);\r
         },\r
         nodeSelectedById: function(id) {\r
             view.selectNodeById(id);\r
@@ -369,10 +403,12 @@ rng.modules.visualEditor = function(sandbox) {
         nodeHovered: function(node) {\r
             view.highlightNode(node);\r
             sideBarView.highlightNode(node.attr('id'));\r
+            statusBarView.highlightNode(node.attr('id'));\r
         },\r
         nodeBlured: function(node) {\r
             view.dimNode(node);\r
             sideBarView.dimNode(node.attr('id'));\r
+            statusBarView.dimNode(node.attr('id'));\r
         },\r
         wrapWithNodeRequest: function(wlxmlTag, wlxmlClass) {\r
             view.wrapSelectionWithNewNode(wlxmlTag, wlxmlClass);\r