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() {
|
function init() {
|
||||||
initCodeMirror();
|
initCodeMirror();
|
||||||
const params = getParams();
|
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) {
|
if (!params.id) {
|
||||||
// match should be 2 - one for the whole thing, one for the parentheses
|
// match should be 2 - one for the whole thing, one for the parentheses
|
||||||
// This is an add
|
// This is an add
|
||||||
$('#heading').textContent = t('addStyleTitle');
|
$('#heading').textContent = t('addStyleTitle');
|
||||||
return createEmptyStyle();
|
return Promise.resolve(createEmptyStyle());
|
||||||
}
|
}
|
||||||
$('#heading').textContent = t('editStyleHeading');
|
$('#heading').textContent = t('editStyleHeading');
|
||||||
// This is an edit
|
// This is an edit
|
||||||
|
@ -1319,14 +1328,7 @@ function init() {
|
||||||
}
|
}
|
||||||
return style;
|
return style;
|
||||||
});
|
});
|
||||||
}).then(style => {
|
}
|
||||||
styleId = style.id;
|
|
||||||
sessionStorage.justEditedStyleId = styleId;
|
|
||||||
|
|
||||||
return windowLoaded().then(() => {
|
|
||||||
initWithStyle({style});
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
function createEmptyStyle() {
|
function createEmptyStyle() {
|
||||||
const params = getParams();
|
const params = getParams();
|
||||||
|
|
Loading…
Reference in New Issue
Block a user