Browse Source

Fix blocks view rendering

pull/202/head
Artur Arseniev 9 years ago
parent
commit
4738fd83de
  1. 4
      dist/grapes.min.js
  2. 18
      index.html
  3. 2
      package.json
  4. 10
      src/block_manager/view/BlocksView.js

4
dist/grapes.min.js

File diff suppressed because one or more lines are too long

18
index.html

@ -1155,6 +1155,24 @@
attributes: { title: 'Empty canvas' }
}]);
var bm = editor.BlockManager;
bm.add('link-block', {
label: 'Link Block',
attributes: {class:'fa fa-link'},
category: 'Basic',
content: {
type:'link',
editable: false,
droppable: true,
style:{
display: 'inline-block',
padding: '5px',
'min-height': '50px',
'min-width': '50px'
}
},
});
editor.render();
</script>
</body>

2
package.json

@ -1,7 +1,7 @@
{
"name": "grapesjs",
"description": "Free and Open Source Web Builder Framework",
"version": "0.8.1",
"version": "0.8.4",
"author": "Artur Arseniev",
"license": "BSD-3-Clause",
"homepage": "http://grapesjs.com",

10
src/block_manager/view/BlocksView.js

@ -116,17 +116,18 @@ module.exports = Backbone.View.extend({
var catModel = this.categories.add(category);
var catId = catModel.get('id');
var catView = this.renderedCategories[catId];
var categories = this.getCategoriesEl();
model.set('category', catModel);
if (!catView) {
if (!catView && categories) {
catView = new CategoryView({
model: catModel
}, this.config).render();
this.renderedCategories[catId] = catView;
this.getCategoriesEl().appendChild(catView.el);
categories.appendChild(catView.el);
}
catView.append(rendered);
catView && catView.append(rendered);
return;
}
@ -153,7 +154,8 @@ module.exports = Backbone.View.extend({
},
append(el) {
this.getBlocksEl().appendChild(el);
let blocks = this.getBlocksEl();
blocks && blocks.appendChild(el);
},
render() {

Loading…
Cancel
Save