Browse Source

Hide text nodes inside navigator

pull/36/head
Artur Arseniev 10 years ago
parent
commit
673c82c647
  1. 6
      src/dom_components/view/ComponentTextView.js
  2. 15
      src/navigator/config/config.js
  3. 4
      src/navigator/view/ItemsView.js

6
src/dom_components/view/ComponentTextView.js

@ -22,12 +22,16 @@ define(['backbone', './ComponentView'],
parseRender: function(){ parseRender: function(){
var comps = this.model.get('components'); var comps = this.model.get('components');
var opts = {silent: true}; var opts = {silent: true};
// Avoid re-render on reset with silent option // Avoid re-render on reset with silent option
comps.reset(null, opts); comps.reset(null, opts);
comps.add(this.$el.html(), opts); comps.add(this.$el.html(), opts);
this.model.set('content', ''); this.model.set('content', '');
comps.trigger('resetNavigator');
this.render(); this.render();
// As the reset was in silent mode I need to notify
// the navigator about the change
comps.trigger('resetNavigator');
}, },
/** /**

15
src/navigator/config/config.js

@ -1,10 +1,11 @@
define(function () { define(function () {
return { return {
stylePrefix : 'nv-', stylePrefix: 'nv-',
sortable : true, sortable: 1,
hidable : true, hidable: 1,
containerId : 'navigator', hideTextnode: 1,
itemClass : 'item', containerId: 'navigator',
itemsClass : 'items', itemClass: 'item',
itemsClass: 'items',
}; };
}); });

4
src/navigator/view/ItemsView.js

@ -78,8 +78,10 @@ define(['backbone','./ItemView'],
this.$el.empty(); this.$el.empty();
this.collection.each(function(model){ this.collection.each(function(model){
if(model.get('type') == 'textnode' && this.config.hideTextnode)
return;
this.addToCollection(model, fragment); this.addToCollection(model, fragment);
},this); }, this);
this.$el.append(fragment); this.$el.append(fragment);
this.$el.attr('class', _.result(this, 'className')); this.$el.attr('class', _.result(this, 'className'));

Loading…
Cancel
Save