Fix: move createEmptyStyle, windowLoaded into init
This commit is contained in:
parent
27f8bc2f85
commit
7612cd3614
56
edit/edit.js
56
edit/edit.js
|
@ -1299,34 +1299,6 @@ function beautify(event) {
|
||||||
|
|
||||||
onDOMready().then(init);
|
onDOMready().then(init);
|
||||||
|
|
||||||
function createEmptyStyle() {
|
|
||||||
const params = getParams();
|
|
||||||
const style = {
|
|
||||||
id: null,
|
|
||||||
name: '',
|
|
||||||
enabled: true,
|
|
||||||
sections: [{code: ''}]
|
|
||||||
};
|
|
||||||
for (const i in CssToProperty) {
|
|
||||||
if (params[i]) {
|
|
||||||
style.sections[0][CssToProperty[i]] = [params[i]];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return style;
|
|
||||||
}
|
|
||||||
|
|
||||||
function windowLoaded() {
|
|
||||||
if (document.readyState !== 'loading') {
|
|
||||||
return Promise.resolve();
|
|
||||||
}
|
|
||||||
return new Promise(resolve => {
|
|
||||||
window.addEventListener('load', function self() {
|
|
||||||
window.removeEventListener('load', self);
|
|
||||||
resolve();
|
|
||||||
});
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
function init() {
|
function init() {
|
||||||
initCodeMirror();
|
initCodeMirror();
|
||||||
const params = getParams();
|
const params = getParams();
|
||||||
|
@ -1355,6 +1327,34 @@ function init() {
|
||||||
initWithStyle({style});
|
initWithStyle({style});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
function createEmptyStyle() {
|
||||||
|
const params = getParams();
|
||||||
|
const style = {
|
||||||
|
id: null,
|
||||||
|
name: '',
|
||||||
|
enabled: true,
|
||||||
|
sections: [{code: ''}]
|
||||||
|
};
|
||||||
|
for (const i in CssToProperty) {
|
||||||
|
if (params[i]) {
|
||||||
|
style.sections[0][CssToProperty[i]] = [params[i]];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return style;
|
||||||
|
}
|
||||||
|
|
||||||
|
function windowLoaded() {
|
||||||
|
if (document.readyState !== 'loading') {
|
||||||
|
return Promise.resolve();
|
||||||
|
}
|
||||||
|
return new Promise(resolve => {
|
||||||
|
window.addEventListener('load', function self() {
|
||||||
|
window.removeEventListener('load', self);
|
||||||
|
resolve();
|
||||||
|
});
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function setStyleMeta(style) {
|
function setStyleMeta(style) {
|
||||||
|
|
Loading…
Reference in New Issue
Block a user