@@ -8,6 +8,7 @@ import parseDatURL from 'parse-dat-url'
88import * as zoom from './pages/zoom'
99import * as navbar from './ui/navbar'
1010import * as prompt from './ui/prompt'
11+ import * as modal from './ui/modal'
1112import * as statusBar from './ui/statusbar'
1213import * as toast from './ui/toast.js'
1314import { SiteInfoNavbarBtn } from './ui/navbar/site-info'
@@ -109,7 +110,8 @@ export function create (opts) {
109110 wcID : null , // the id of the webcontents
110111 webviewEl : createWebviewEl ( id , url ) ,
111112 navbarEl : navbar . createEl ( id ) ,
112- promptEl : prompt . createEl ( id ) ,
113+ promptEl : prompt . createContainer ( id ) ,
114+ modalEl : modal . createContainer ( id ) ,
113115 siteInfoNavbarBtn : null , // set after object is created
114116
115117 // page state
@@ -151,8 +153,9 @@ export function create (opts) {
151153 _canGoBack : false , // cached to avoid sync calls to the main process
152154 _canGoForward : false , // cached to avoid sync calls to the main process
153155
154- // prompts
156+ // UI elements
155157 prompts : [ ] , // list of active prompts (used with perms)
158+ modals : [ ] , // list of active modals
156159
157160 // tab state
158161 isPinned : opts . isPinned , // is this page pinned?
@@ -377,7 +380,8 @@ export async function remove (page) {
377380 pages . splice ( i , 1 )
378381 webviewsDiv . removeChild ( page . webviewEl )
379382 navbar . destroyEl ( page . id )
380- prompt . destroyEl ( page . id )
383+ prompt . destroyContainer ( page . id )
384+ modal . destroyContainer ( page . id )
381385
382386 // persist pins w/o this one, if that was
383387 if ( page . isPinned ) { savePinnedToDB ( ) }
@@ -418,6 +422,7 @@ export function setActive (page) {
418422 navbar . closeMenus ( )
419423 navbar . update ( )
420424 prompt . update ( )
425+ modal . update ( )
421426
422427 events . emit ( 'set-active' , page )
423428 ipcRenderer . send ( 'shell-window:set-current-location' , page . getIntendedURL ( ) )
@@ -626,8 +631,9 @@ function onLoadCommit (e) {
626631 zoom . setZoomFromSitedata ( page , parseURL ( page . getIntendedURL ( ) ) . origin )
627632 // stop autocompleting
628633 navbar . clearAutocomplete ( )
629- // close any prompts
634+ // close any prompts and modals
630635 prompt . forceRemoveAll ( page )
636+ modal . forceRemoveAll ( page )
631637 // set title in tabs
632638 page . title = e . target . getTitle ( ) // NOTE sync operation
633639 navbar . update ( page )
@@ -1026,13 +1032,15 @@ function show (page) {
10261032 page . webviewEl . classList . remove ( 'hidden' )
10271033 page . navbarEl . classList . remove ( 'hidden' )
10281034 page . promptEl . classList . remove ( 'hidden' )
1035+ page . modalEl . classList . remove ( 'hidden' )
10291036 events . emit ( 'show' , page )
10301037}
10311038
10321039function hide ( page ) {
10331040 page . webviewEl . classList . add ( 'hidden' )
10341041 page . navbarEl . classList . add ( 'hidden' )
10351042 page . promptEl . classList . add ( 'hidden' )
1043+ page . modalEl . classList . add ( 'hidden' )
10361044 events . emit ( 'hide' , page )
10371045}
10381046
0 commit comments