debian-mirror-gitlab/app/assets/javascripts/blob/balsamiq_viewer.js
2021-09-30 23:02:18 +05:30

22 lines
558 B
JavaScript

import createFlash from '~/flash';
import { __ } from '~/locale';
import BalsamiqViewer from './balsamiq/balsamiq_viewer';
function onError() {
const flash = createFlash({
message: __('Balsamiq file could not be loaded.'),
});
return flash;
}
export default function loadBalsamiqFile() {
const viewer = document.getElementById('js-balsamiq-viewer');
if (!(viewer instanceof Element)) return;
const { endpoint } = viewer.dataset;
const balsamiqViewer = new BalsamiqViewer(viewer);
balsamiqViewer.loadFile(endpoint).catch(onError);
}