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.
44 lines
897 B
44 lines
897 B
define(['backbone'],
|
|
function(Backbone) {
|
|
/**
|
|
* @class CanvasView
|
|
* */
|
|
return Backbone.View.extend({
|
|
|
|
tagName: 'iframe',
|
|
|
|
attributes: {
|
|
src: 'about:blank'
|
|
},
|
|
|
|
initialize: function(o) {
|
|
this.config = o.config || {};
|
|
this.ppfx = this.config.pStylePrefix || '';
|
|
this.em = this.config.em;
|
|
this.listenTo(this.em, 'change:device', this.updateWidth);
|
|
},
|
|
|
|
/**
|
|
* Update width of the frame
|
|
* @private
|
|
*/
|
|
updateWidth: function(model){
|
|
var device = this.em.getDeviceModel();
|
|
this.el.style.width = device ? device.get('width') : '';
|
|
},
|
|
|
|
getBody: function(){
|
|
this.$el.contents().find('body');
|
|
},
|
|
|
|
getWrapper: function(){
|
|
return this.$el.contents().find('body > div');
|
|
},
|
|
|
|
render: function() {
|
|
this.$el.attr({class: this.ppfx + 'frame'});
|
|
return this;
|
|
},
|
|
|
|
});
|
|
});
|