2018-03-17 18:26:18 +05:30
|
|
|
import Flash from '../flash';
|
2017-08-17 22:00:37 +05:30
|
|
|
import BalsamiqViewer from './balsamiq/balsamiq_viewer';
|
|
|
|
|
2017-09-10 17:25:29 +05:30
|
|
|
function onError() {
|
2018-03-17 18:26:18 +05:30
|
|
|
const flash = new Flash('Balsamiq file could not be loaded.');
|
2017-09-10 17:25:29 +05:30
|
|
|
|
|
|
|
return flash;
|
|
|
|
}
|
|
|
|
|
2018-03-27 19:54:05 +05:30
|
|
|
export default function loadBalsamiqFile() {
|
2017-09-10 17:25:29 +05:30
|
|
|
const viewer = document.getElementById('js-balsamiq-viewer');
|
|
|
|
|
|
|
|
if (!(viewer instanceof Element)) return;
|
|
|
|
|
|
|
|
const endpoint = viewer.dataset.endpoint;
|
|
|
|
|
|
|
|
const balsamiqViewer = new BalsamiqViewer(viewer);
|
|
|
|
balsamiqViewer.loadFile(endpoint).catch(onError);
|
|
|
|
}
|