@ -1328,6 +1328,10 @@
//console.log('Style of ', model.get('property'), 'Target: ', targetValue, 'Computed:', computedValue, 'Default:', defaultValue);
})
editor.on('block:drag:stop', function(model) {
editor.select(model);
});
editor.render();
</script>
</body>
@ -329,15 +329,32 @@ module.exports = config => {
}
},
/**
* Select a component
* @param {Component|HTMLElement} el Component to select
* @return {this}
* @example
* // Select dropped block
* editor.on('block:drag:stop', function(model) {
* editor.select(model);
* });
*/
select(el) {
em.setSelected(el);
return this;
* Set device to the editor. If the device exists it will
* change the canvas to the proper width
* @param {string} name Name of the device
* editor.setDevice('Tablet');
setDevice(name) {
return em.set('device', name);
em.set('device', name);
@ -333,6 +333,21 @@ module.exports = Backbone.Model.extend({
return this.get('selectedComponent');
* @private
setSelected(el) {
let model = el;
if (el instanceof HTMLElement) {
model = $(el).data('model');
this.set('selectedComponent', model);
* Set components inside editor's canvas. This method overrides actual components
* @param {Object|string} components HTML string or components model