mirror of https://github.com/artf/grapesjs.git
nocodeframeworkdrag-and-dropsite-buildersite-generatortemplate-builderui-builderweb-builderweb-builder-frameworkwebsite-builderno-codepage-builder
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
40 lines
905 B
40 lines
905 B
define(['backbone', './InsertCustom'],
|
|
function(Backbone, InsertCustom) {
|
|
/**
|
|
* @class ImageComponent
|
|
* */
|
|
return _.extend({}, InsertCustom, {
|
|
|
|
/**
|
|
* Trigger before insert
|
|
* @param {Object} object
|
|
*
|
|
* */
|
|
beforeInsert: function(object){
|
|
object.type = 'image';
|
|
object.style = {};
|
|
object.attributes = {};
|
|
if (!this.nearToFloat()) {
|
|
object.style.display = 'block';
|
|
}
|
|
// This allow to avoid 'ghosts' on drag
|
|
object.attributes.onmousedown = 'return false';
|
|
if (this.config.firstCentered && (this.$wp.get(0) == this.posTargetEl.get(0)) ) {
|
|
object.style.margin = '0 auto';
|
|
}
|
|
},
|
|
|
|
/**
|
|
* Trigger after insert
|
|
* @param {Object} model Model created after insert
|
|
*
|
|
* */
|
|
afterInsert: function(model){
|
|
model.trigger('dblclick');
|
|
if(this.sender)
|
|
this.sender.set('active', false);
|
|
},
|
|
|
|
|
|
});
|
|
});
|