Inject base target to '_blank' on preview iframe. Closes #172

This commit is contained in:
Cássio Zen 2016-11-29 15:18:25 -02:00
parent fa03ce29bf
commit 43c93dff26

View File

@ -55,6 +55,11 @@ export default class PreviewPane extends React.Component {
linkEl.setAttribute('href', style);
ref.contentDocument.head.appendChild(linkEl);
});
const base = document.createElement('base');
base.setAttribute('target', '_blank');
ref.contentDocument.head.appendChild(base);
this.previewEl = document.createElement('div');
this.iframeBody = ref.contentDocument.body;
this.iframeBody.appendChild(this.previewEl);