debian-mirror-gitlab/app/assets/javascripts/blob/balsamiq_viewer.js

21 lines
560 B
JavaScript
Raw Normal View History

2020-10-24 23:57:45 +05:30
import { deprecatedCreateFlash as Flash } from '../flash';
2017-08-17 22:00:37 +05:30
import BalsamiqViewer from './balsamiq/balsamiq_viewer';
2019-07-31 22:56:46 +05:30
import { __ } from '~/locale';
2017-08-17 22:00:37 +05:30
2017-09-10 17:25:29 +05:30
function onError() {
2019-07-31 22:56:46 +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);
}