Avoid flickering of editor header on load, also for manage<=>edit nav
This commit is contained in:
parent
8c7f7b81f8
commit
7a7c679811
11
edit.html
11
edit.html
|
@ -41,16 +41,16 @@
|
|||
|
||||
body {
|
||||
margin: 0;
|
||||
font: 9pt arial,sans-serif;
|
||||
font: 12px arial,sans-serif;
|
||||
}
|
||||
/************ header ************/
|
||||
#header {
|
||||
height: calc(100vh - 30px);
|
||||
overflow: auto;
|
||||
width: 15rem;
|
||||
width: 250px;
|
||||
position: fixed;
|
||||
top: 0;
|
||||
padding: 0.95rem;
|
||||
padding: 15px;
|
||||
border-right: 1px dashed #AAA;
|
||||
-webkit-box-shadow: 0 0 3rem -1.2rem black;
|
||||
}
|
||||
|
@ -58,10 +58,11 @@
|
|||
margin-top: 0;
|
||||
}
|
||||
#sections {
|
||||
padding-left: 18rem;
|
||||
padding-left: 280px;
|
||||
}
|
||||
#sections h2 {
|
||||
margin-top: 0.5rem;
|
||||
margin-top: 1rem;
|
||||
margin-left: 1.7rem;
|
||||
}
|
||||
.aligned {
|
||||
display: table-row;
|
||||
|
|
20
edit.js
20
edit.js
|
@ -1066,23 +1066,26 @@ function beautify(event) {
|
|||
}
|
||||
}
|
||||
|
||||
window.addEventListener("load", init, false);
|
||||
document.addEventListener("DOMContentLoaded", init);
|
||||
|
||||
function init() {
|
||||
var params = getParams();
|
||||
if (!params.id) { // match should be 2 - one for the whole thing, one for the parentheses
|
||||
// This is an add
|
||||
tE("heading", "addStyleTitle");
|
||||
var section = {code: ""}
|
||||
for (var i in CssToProperty) {
|
||||
if (params[i]) {
|
||||
section[CssToProperty[i]] = [params[i]];
|
||||
}
|
||||
}
|
||||
onload = () => {
|
||||
onload = null;
|
||||
addSection(null, section);
|
||||
// default to enabled
|
||||
document.getElementById("enabled").checked = true
|
||||
tE("heading", "addStyleTitle");
|
||||
initHooks();
|
||||
};
|
||||
return;
|
||||
}
|
||||
// This is an edit
|
||||
|
@ -1090,14 +1093,25 @@ function init() {
|
|||
getStylesSafe({id: params.id}).then(styles => {
|
||||
const style = styles[0];
|
||||
styleId = style.id;
|
||||
setStyleMeta(style);
|
||||
onload = () => {
|
||||
onload = null;
|
||||
initWithStyle({style});
|
||||
};
|
||||
if (document.readyState != 'loading') {
|
||||
onload();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function initWithStyle({style, codeIsUpdated}) {
|
||||
function setStyleMeta(style) {
|
||||
document.getElementById("name").value = style.name;
|
||||
document.getElementById("enabled").checked = style.enabled;
|
||||
document.getElementById("url").href = style.url;
|
||||
}
|
||||
|
||||
function initWithStyle({style, codeIsUpdated}) {
|
||||
setStyleMeta(style);
|
||||
|
||||
if (codeIsUpdated === false) {
|
||||
setCleanGlobal();
|
||||
|
|
Loading…
Reference in New Issue
Block a user