switch to shared paperdialoghelper

This commit is contained in:
Luke Pulverenti 2016-01-30 15:59:09 -05:00
parent 88bd9c7abb
commit b5292ca178
24 changed files with 152 additions and 296 deletions

View file

@ -5,6 +5,7 @@
var self = this;
self.originalUrl = window.location.href;
var activeElement = document.activeElement;
var removeScrollLockOnClose = false;
function onHashChange(e) {
@ -22,9 +23,8 @@
function onDialogClosed() {
if (lockDocumentScroll !== false) {
// TODO
//Dashboard.onPopupClose();
if (removeScrollLockOnClose) {
document.body.classList.remove('noScroll');
}
window.removeEventListener('popstate', onHashChange);
@ -55,9 +55,9 @@
dlg.addEventListener('iron-overlay-closed', onDialogClosed);
dlg.open();
if (lockDocumentScroll !== false) {
// TODO
//Dashboard.onPopupOpen();
if (lockDocumentScroll !== false && !document.body.classList.contains('noScroll')) {
document.body.classList.add('noScroll');
removeScrollLockOnClose = true;
}
historyManager.pushState({ dialogId: hash }, "Dialog", hash);
@ -135,7 +135,14 @@
dlg.setAttribute('data-removeonclose', 'true');
}
dlg.addEventListener('iron-overlay-opened', onDialogOpened);
if (options.size) {
dlg.classList.add('fixedSize');
dlg.classList.add(options.size);
}
if (options.autoFocus !== false) {
dlg.addEventListener('iron-overlay-opened', onDialogOpened);
}
return dlg;
}