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(){
var comps = this.model.get('components');
var opts = {silent: true};
// Avoid re-render on reset with silent option
comps.reset(null, opts);
comps.add(this.$el.html(), opts);
this.model.set('content', '');
comps.trigger('resetNavigator');
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 () {
return {
stylePrefix : 'nv-',
sortable : true,
hidable : true,
containerId : 'navigator',
itemClass : 'item',
itemsClass : 'items',
stylePrefix: 'nv-',
sortable: 1,
hidable: 1,
hideTextnode: 1,
containerId: 'navigator',
itemClass: 'item',
itemsClass: 'items',
};
});
});

4
src/navigator/view/ItemsView.js

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

Loading…
Cancel
Save