Change: use messageBoxProxy

This commit is contained in:
eight04 2021-12-30 16:22:25 +08:00
parent 4bb6738632
commit e2c0a4eca4
3 changed files with 33 additions and 14 deletions

View File

@ -2,16 +2,11 @@ html, body {
margin: 0; margin: 0;
padding: 0; padding: 0;
} }
#main {
display: grid;
grid-template-columns: min-content minmax(0, 1fr);
height: 100vh;
}
#main.ready { #main.ready {
animation: slidein .25s ease-in-out; animation: slidein .25s ease-in-out;
} }
.closer { .closer {
max-height: 100vh; display: none;
} }
.closer::after { .closer::after {
content: "\bb"; content: "\bb";
@ -28,7 +23,6 @@ li {
position: relative; position: relative;
user-select: none; user-select: none;
border: 1px solid silver; border: 1px solid silver;
border-left: 0;
padding: 0.3em 0; padding: 0.3em 0;
background: white; background: white;
white-space: nowrap; white-space: nowrap;

View File

@ -980,14 +980,13 @@ a:hover {
animation: fadeout .25s ease-in-out; animation: fadeout .25s ease-in-out;
} }
.execution-order-dialog > div {
height: 100%;
}
#stylus-execution-order { #stylus-execution-order {
position: fixed; display: block;
height: 100vh;
border: 0; border: 0;
top: 0; height: 100%;
right: 0;
max-width: 400px;
width: 90%;
} }
#stylus-execution-order.fadeout { #stylus-execution-order.fadeout {
animation: slideout .25s ease-in-out; animation: slideout .25s ease-in-out;

View File

@ -14,6 +14,7 @@
setupLivePrefs setupLivePrefs
waitForSelector waitForSelector
waitForSheet waitForSheet
messageBoxProxy
*/// dom.js */// dom.js
'use strict'; 'use strict';
@ -110,7 +111,7 @@ router.watch(
); );
router.watch( router.watch(
{hash: '#stylus-execution-order'}, {hash: '#stylus-execution-order'},
Embed(() => $create('iframe', { EmbedDialog(() => $create('iframe', {
id: 'stylus-execution-order', id: 'stylus-execution-order',
src: '/execution-order/execution-order.html', src: '/execution-order/execution-order.html',
})) }))
@ -137,6 +138,31 @@ function onRuntimeMessage(msg) {
setTimeout(sorter.updateStripes, 0, {onlyWhenColumnsChanged: true}); setTimeout(sorter.updateStripes, 0, {onlyWhenColumnsChanged: true});
} }
function EmbedDialog(El) {
let shown = false;
return toggle;
function toggle(state) {
if (state && !shown) {
messageBoxProxy.show({
title: t('manageExecutionOrder'),
contents: El(),
className: 'execution-order-dialog center-dialog',
blockScroll: true,
})
.then(() => {
shown = false;
router.updateHash('');
});
shown = true;
} else if (!state && shown) {
// FIXME: close the dialog
// messageBoxProxy.close();
shown = false;
}
}
}
function Embed(El) { function Embed(El) {
let el; let el;
return toggle; return toggle;