import {svg} from '../../svg.ts'; import {htmlEscape} from 'escape-goat'; import {createElementFromHTML} from '../../utils/dom.ts'; import {fomanticQuery} from '../../modules/fomantic/base.ts'; const {i18n} = window.config; export function confirmModal({header = '', content = '', confirmButtonColor = 'primary'} = {}) { return new Promise((resolve) => { const headerHtml = header ? `
${htmlEscape(header)}
` : ''; const modal = createElementFromHTML(` `); document.body.append(modal); const $modal = fomanticQuery(modal); $modal.modal({ onApprove() { resolve(true); }, onHidden() { $modal.remove(); resolve(false); }, }).modal('show'); }); }