Files
superset2/superset/assets/visualizations/markup.js
Jay Lindquist b4bdc45a6b Add support for IE 11 for markup slices (#3702)
* Add srcdoc-polyfill tosupport Internet Explorer iframes in markup slices. Add allow-top-navigation and allow-popups to support links within iframes

* Remove jquery from markup.js
2017-10-23 15:35:15 -07:00

35 lines
830 B
JavaScript

const srcdoc = require('srcdoc-polyfill');
require('./markup.css');
function markupWidget(slice, payload) {
$('#code').attr('rows', '15');
const jqdiv = slice.container;
jqdiv.css({
overflow: 'auto',
});
const iframeId = `if__${slice.containerId}`;
const html = `
<html>
<head>
<link rel="stylesheet" type="text/css" href="${payload.data.theme_css}" />
</head>
<body style="background-color: transparent;">
${payload.data.html}
</body>
</html>`;
jqdiv.html(`
<iframe id="${iframeId}"
frameborder="0"
height="${slice.height()}"
sandbox="allow-same-origin allow-scripts allow-top-navigation allow-popups">
</iframe>
`);
const iframe = document.getElementById(iframeId);
srcdoc.set(iframe, html);
}
module.exports = markupWidget;