Fix: drop dummy Promise.resolve
This commit is contained in:
parent
02c61b9276
commit
e7eb38bba9
22
edit/edit.js
22
edit/edit.js
|
@ -1302,12 +1302,21 @@ onDOMready().then(init);
|
|||
function init() {
|
||||
initCodeMirror();
|
||||
const params = getParams();
|
||||
return Promise.resolve().then(() => {
|
||||
getStyle().then(style => {
|
||||
styleId = style.id;
|
||||
sessionStorage.justEditedStyleId = styleId;
|
||||
|
||||
return windowLoaded().then(() => {
|
||||
initWithStyle({style});
|
||||
});
|
||||
});
|
||||
|
||||
function getStyle() {
|
||||
if (!params.id) {
|
||||
// match should be 2 - one for the whole thing, one for the parentheses
|
||||
// This is an add
|
||||
$('#heading').textContent = t('addStyleTitle');
|
||||
return createEmptyStyle();
|
||||
return Promise.resolve(createEmptyStyle());
|
||||
}
|
||||
$('#heading').textContent = t('editStyleHeading');
|
||||
// This is an edit
|
||||
|
@ -1319,14 +1328,7 @@ function init() {
|
|||
}
|
||||
return style;
|
||||
});
|
||||
}).then(style => {
|
||||
styleId = style.id;
|
||||
sessionStorage.justEditedStyleId = styleId;
|
||||
|
||||
return windowLoaded().then(() => {
|
||||
initWithStyle({style});
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
function createEmptyStyle() {
|
||||
const params = getParams();
|
||||
|
|
Loading…
Reference in New Issue
Block a user