|
|
|
@ -28,6 +28,8 @@ |
|
|
|
* } |
|
|
|
* ... |
|
|
|
*/ |
|
|
|
import { isElement } from 'underscore'; |
|
|
|
|
|
|
|
module.exports = () => { |
|
|
|
var c = {}, |
|
|
|
defaults = require('./config/config'), |
|
|
|
@ -108,6 +110,15 @@ module.exports = () => { |
|
|
|
!blocks.length && blocks.reset(c.blocks); |
|
|
|
}, |
|
|
|
|
|
|
|
postRender() { |
|
|
|
const elTo = this.getConfig().appendTo; |
|
|
|
|
|
|
|
if (elTo) { |
|
|
|
const el = isElement(elTo) ? elTo : document.querySelector(elTo); |
|
|
|
el.appendChild(this.render()); |
|
|
|
} |
|
|
|
}, |
|
|
|
|
|
|
|
/** |
|
|
|
* Add new block to the collection. |
|
|
|
* @param {string} id Block id |
|
|
|
@ -199,6 +210,7 @@ module.exports = () => { |
|
|
|
* Render blocks |
|
|
|
* @param {Array} blocks Blocks to render, without the argument will render |
|
|
|
* all global blocks |
|
|
|
* @return {HTMLElement} Rendered element |
|
|
|
* @example |
|
|
|
* // Render all blocks (inside the global collection)
|
|
|
|
* blockManager.render(); |
|
|
|
@ -225,6 +237,7 @@ module.exports = () => { |
|
|
|
} |
|
|
|
|
|
|
|
blocksView.collection.reset(toRender); |
|
|
|
return this.getContainer(); |
|
|
|
} |
|
|
|
}; |
|
|
|
}; |
|
|
|
|