@@ -8,6 +8,7 @@ import parseDatURL from 'parse-dat-url'
8
8
import * as zoom from './pages/zoom'
9
9
import * as navbar from './ui/navbar'
10
10
import * as prompt from './ui/prompt'
11
+ import * as modal from './ui/modal'
11
12
import * as statusBar from './ui/statusbar'
12
13
import * as toast from './ui/toast.js'
13
14
import { SiteInfoNavbarBtn } from './ui/navbar/site-info'
@@ -109,7 +110,8 @@ export function create (opts) {
109
110
wcID : null , // the id of the webcontents
110
111
webviewEl : createWebviewEl ( id , url ) ,
111
112
navbarEl : navbar . createEl ( id ) ,
112
- promptEl : prompt . createEl ( id ) ,
113
+ promptEl : prompt . createContainer ( id ) ,
114
+ modalEl : modal . createContainer ( id ) ,
113
115
siteInfoNavbarBtn : null , // set after object is created
114
116
115
117
// page state
@@ -151,8 +153,9 @@ export function create (opts) {
151
153
_canGoBack : false , // cached to avoid sync calls to the main process
152
154
_canGoForward : false , // cached to avoid sync calls to the main process
153
155
154
- // prompts
156
+ // UI elements
155
157
prompts : [ ] , // list of active prompts (used with perms)
158
+ modals : [ ] , // list of active modals
156
159
157
160
// tab state
158
161
isPinned : opts . isPinned , // is this page pinned?
@@ -377,7 +380,8 @@ export async function remove (page) {
377
380
pages . splice ( i , 1 )
378
381
webviewsDiv . removeChild ( page . webviewEl )
379
382
navbar . destroyEl ( page . id )
380
- prompt . destroyEl ( page . id )
383
+ prompt . destroyContainer ( page . id )
384
+ modal . destroyContainer ( page . id )
381
385
382
386
// persist pins w/o this one, if that was
383
387
if ( page . isPinned ) { savePinnedToDB ( ) }
@@ -418,6 +422,7 @@ export function setActive (page) {
418
422
navbar . closeMenus ( )
419
423
navbar . update ( )
420
424
prompt . update ( )
425
+ modal . update ( )
421
426
422
427
events . emit ( 'set-active' , page )
423
428
ipcRenderer . send ( 'shell-window:set-current-location' , page . getIntendedURL ( ) )
@@ -626,8 +631,9 @@ function onLoadCommit (e) {
626
631
zoom . setZoomFromSitedata ( page , parseURL ( page . getIntendedURL ( ) ) . origin )
627
632
// stop autocompleting
628
633
navbar . clearAutocomplete ( )
629
- // close any prompts
634
+ // close any prompts and modals
630
635
prompt . forceRemoveAll ( page )
636
+ modal . forceRemoveAll ( page )
631
637
// set title in tabs
632
638
page . title = e . target . getTitle ( ) // NOTE sync operation
633
639
navbar . update ( page )
@@ -1026,13 +1032,15 @@ function show (page) {
1026
1032
page . webviewEl . classList . remove ( 'hidden' )
1027
1033
page . navbarEl . classList . remove ( 'hidden' )
1028
1034
page . promptEl . classList . remove ( 'hidden' )
1035
+ page . modalEl . classList . remove ( 'hidden' )
1029
1036
events . emit ( 'show' , page )
1030
1037
}
1031
1038
1032
1039
function hide ( page ) {
1033
1040
page . webviewEl . classList . add ( 'hidden' )
1034
1041
page . navbarEl . classList . add ( 'hidden' )
1035
1042
page . promptEl . classList . add ( 'hidden' )
1043
+ page . modalEl . classList . add ( 'hidden' )
1036
1044
events . emit ( 'hide' , page )
1037
1045
}
1038
1046
0 commit comments