Files
superset2/superset/assets/src/visualizations/iframe.js
Krist Wongsuphasawat 9fb28b5f4e Revise markup.js and iframe.js (#5672)
* Do not call slice.xxx

* remove iframe id

* remove old code

* use import instead of require

* update iframe.js
2018-08-23 15:45:45 -07:00

21 lines
536 B
JavaScript

import Mustache from 'mustache';
export default function iframeWidget(slice) {
const { selector, formData } = slice;
const { url } = formData;
const width = slice.width();
const height = slice.height();
const container = document.querySelector(selector);
const completedUrl = Mustache.render(url, {
width,
height,
});
const iframe = document.createElement('iframe');
iframe.style.width = '100%';
iframe.style.height = height;
iframe.setAttribute('src', completedUrl);
container.appendChild(iframe);
}