debian-mirror-gitlab/app/assets/javascripts/blob/balsamiq_viewer.js
2020-10-24 23:57:45 +05:30

21 lines
560 B
JavaScript

import { deprecatedCreateFlash as Flash } from '../flash';
import BalsamiqViewer from './balsamiq/balsamiq_viewer';
import { __ } from '~/locale';
function onError() {
const flash = new Flash(__('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);
}