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;
|
|
|
|
|
2018-11-08 19:23:39 +05:30
|
|
|
const { endpoint } = viewer.dataset;
|
2017-09-10 17:25:29 +05:30
|
|
|
|
|
|
|
const balsamiqViewer = new BalsamiqViewer(viewer);
|
|
|
|
balsamiqViewer.loadFile(endpoint).catch(onError);
|
|
|
|
}
|