Fix: drop dummy Promise.resolve

This commit is contained in:
eight 2017-09-12 19:47:32 +08:00
parent 02c61b9276
commit e7eb38bba9

View File

@ -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();