From: Aleksander Ɓukasz Date: Mon, 1 Jul 2013 13:36:05 +0000 (+0200) Subject: metaWidget wip: integrating X-Git-Url: https://git.mdrn.pl/fnpeditor.git/commitdiff_plain/039f0edb73590283bc38ef5421e670fa40ff2480?ds=sidebyside;hp=f07cd8d76ad2bc0fbfada50ad35bad4f4b307267 metaWidget wip: integrating --- diff --git a/modules/documentCanvas/documentCanvas.js b/modules/documentCanvas/documentCanvas.js index deebfca..c47b8bb 100644 --- a/modules/documentCanvas/documentCanvas.js +++ b/modules/documentCanvas/documentCanvas.js @@ -29,7 +29,12 @@ return function(sandbox) { }, modifyCurrentNode: function(attr, value) { if(manager.currentNode) { - manager.getNodeElement(manager.currentNode).attr('wlxml-'+attr, value); + if(_.contains(['tag', 'class'], attr)) { + manager.getNodeElement(manager.currentNode).attr('wlxml-'+attr, value); + } else { + // changing node meta attr + manager.currentNode.setMetaAttr(attr, value); + } sandbox.publish('contentChanged'); } }, diff --git a/modules/nodePane/nodePane.js b/modules/nodePane/nodePane.js index 57f5c17..39afbea 100644 --- a/modules/nodePane/nodePane.js +++ b/modules/nodePane/nodePane.js @@ -2,8 +2,8 @@ define([ 'libs/text!./template.html', 'libs/jquery-1.9.1.min', 'libs/underscore-min', - -], function(templateSrc, $, _) { +'modules/nodePane/metaWidget/metaWidget' +], function(templateSrc, $, _, metaWidget) { 'use strict'; @@ -27,6 +27,12 @@ return function(sandbox) { setNode: function(canvasNode) { view.find('.rng-module-nodePane-tagSelect').val(canvasNode.getTag()); view.find('.rng-module-nodePane-classSelect').val(canvasNode.getClass()); + + var widget = metaWidget.create({attrs:canvasNode.getMetaAttrs()}); + widget.on('valueChanged', function(key, value) { + sandbox.publish('nodeChanged', key, value); + }); + view.find('.metaFields').empty().append(widget.el); } }; diff --git a/modules/nodePane/template.html b/modules/nodePane/template.html index d1e8ab2..a40e711 100644 --- a/modules/nodePane/template.html +++ b/modules/nodePane/template.html @@ -19,5 +19,7 @@ <% }); %> +
+
\ No newline at end of file