mirror of
https://github.com/apache/superset.git
synced 2026-04-22 17:45:21 +00:00
* Do not call slice.xxx * remove iframe id * remove old code * use import instead of require * update iframe.js
21 lines
536 B
JavaScript
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);
|
|
}
|