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.
31 lines
837 B
31 lines
837 B
import ComponentView from './ComponentView';
|
|
import { createEl, find, attrUp } from 'utils/dom';
|
|
|
|
export default class ComponentFrameView extends ComponentView.extend {
|
|
tagName = 'div';
|
|
|
|
initialize(...args) {
|
|
ComponentView.prototype.initialize.apply(this, args);
|
|
this.listenTo(this.model, 'change:attributes:src', this.updateSrc);
|
|
}
|
|
|
|
updateSrc() {
|
|
const frame = find(this.el, 'iframe')[0];
|
|
frame && attrUp(frame, { src: this.__getSrc() });
|
|
}
|
|
|
|
render(...args) {
|
|
ComponentView.prototype.render.apply(this, args);
|
|
const frame = createEl('iframe', {
|
|
class: `${this.ppfx}no-pointer`,
|
|
style: 'width: 100%; height: 100%; border: none',
|
|
src: this.__getSrc(),
|
|
});
|
|
this.el.appendChild(frame);
|
|
return this;
|
|
}
|
|
|
|
__getSrc() {
|
|
return this.model.getAttributes().src || '';
|
|
}
|
|
}
|
|
|