just add the modal to body if not already present

pull/1/head
yann300 7 years ago
parent 1366f359c9
commit bda92411a9
  1. 12
      src/app/modaldialog.js

@ -63,21 +63,11 @@ var css = csjs`
` `
module.exports = (title, content, ok, cancel) => { module.exports = (title, content, ok, cancel) => {
var containerOrig = document.querySelector('.modal') var container = document.querySelector(`.${css.modal}`)
var container
if (!containerOrig) {
container = document.querySelector(`.${css.modal}`)
if (!container) { if (!container) {
document.querySelector('body').appendChild(html()) document.querySelector('body').appendChild(html())
container = document.querySelector(`.${css.modal}`) container = document.querySelector(`.${css.modal}`)
} }
} else {
var parent = document.querySelector('body')
var child = document.getElementById('modaldialog')
parent.removeChild(child)
document.querySelector('body').appendChild(html())
container = document.querySelector(`.${css.modal}`)
}
var okDiv = document.getElementById('modal-footer-ok') var okDiv = document.getElementById('modal-footer-ok')
okDiv.innerHTML = (ok && ok.label !== undefined) ? ok.label : 'OK' okDiv.innerHTML = (ok && ok.label !== undefined) ? ok.label : 'OK'

Loading…
Cancel
Save