diff --git a/background/style-manager.js b/background/style-manager.js index 3e9a00da..e473b079 100644 --- a/background/style-manager.js +++ b/background/style-manager.js @@ -107,7 +107,7 @@ const styleMan = (() => { if (ready.then) await ready; style = mergeWithMapped(style); style.updateDate = Date.now(); - return handleSave(await saveStyle(style), 'editSave'); + return handleSave(await saveStyle(style), {reason: 'editSave'}); }, /** @returns {Promise} */ @@ -223,7 +223,7 @@ const styleMan = (() => { const events = await db.exec('putMany', items); return Promise.all(items.map((item, i) => { afterSave(item, events[i]); - return handleSave(item, 'import'); + return handleSave(item, {reason: 'import'}); })); }, @@ -240,7 +240,7 @@ const styleMan = (() => { if (url) style.url = style.installationUrl = url; style.originalDigest = await calcStyleDigest(style); // FIXME: update updateDate? what about usercss config? - return handleSave(await saveStyle(style), reason); + return handleSave(await saveStyle(style), {reason}); }, /** @returns {Promise} */ @@ -264,7 +264,7 @@ const styleMan = (() => { if (diff < 0) { doc.id = await db.exec('put', doc); uuidIndex.set(doc._id, doc.id); - return handleSave(doc, 'sync'); + return handleSave(doc, {reason: 'sync'}); } }, @@ -272,7 +272,7 @@ const styleMan = (() => { async toggle(id, enabled) { if (ready.then) await ready; const style = Object.assign({}, id2style(id), {enabled}); - handleSave(await saveStyle(style), 'toggle', false); + handleSave(await saveStyle(style), {reason: 'toggle', codeIsUpdated: false}); return id; }, @@ -369,7 +369,7 @@ const styleMan = (() => { case 'revoke': await tokenMan.revokeToken('userstylesworld', style.id); style._usw = {}; - handleSave(await saveStyle(style), 'success-revoke', true); + handleSave(await saveStyle(style), {reason: 'success-revoke', codeIsUpdated: true}); break; case 'publish': @@ -392,7 +392,7 @@ const styleMan = (() => { delete someStyle.tmpSourceCode; delete someStyle.metadata; } - handleSave(await saveStyle(someStyle), null, null, false); + handleSave(await saveStyle(someStyle), {broadcast: false}); } style._usw = { token: await tokenMan.getToken('userstylesworld', true, style.id), @@ -404,7 +404,7 @@ const styleMan = (() => { for (const [k, v] of Object.entries(await retrieveStyleInformation(style._usw.token))) { style._usw[k] = v; } - handleSave(await saveStyle(style), 'success-publishing', true); + handleSave(await saveStyle(style), {reason: 'success-publishing', codeIsUpdated: true}); } uploadStyle(style); break; @@ -420,7 +420,7 @@ const styleMan = (() => { throw new Error('The rule already exists'); } style[type] = list.concat([rule]); - return handleSave(await saveStyle(style), 'styleSettings'); + return handleSave(await saveStyle(style), {reason: 'styleSettings'}); } async function removeIncludeExclude(type, id, rule) { @@ -431,7 +431,7 @@ const styleMan = (() => { return; } style[type] = list.filter(r => r !== rule); - return handleSave(await saveStyle(style), 'styleSettings'); + return handleSave(await saveStyle(style), {reason: 'styleSettings'}); } function broadcastStyleUpdated(style, reason, method = 'styleUpdated', codeIsUpdated = true) { @@ -497,7 +497,7 @@ const styleMan = (() => { return style; } - function handleSave(style, reason, codeIsUpdated, broadcast = true) { + function handleSave(style, {reason, codeIsUpdated, broadcast = true}) { const data = id2data(style.id); const method = data ? 'styleUpdated' : 'styleAdded'; if (!data) { diff --git a/edit.html b/edit.html index a48f96f9..f37e083f 100644 --- a/edit.html +++ b/edit.html @@ -392,7 +392,7 @@ -
+

diff --git a/js/prefs.js b/js/prefs.js index 3d7b93fa..5a5011d3 100644 --- a/js/prefs.js +++ b/js/prefs.js @@ -61,6 +61,7 @@ 'editor.toc.expanded': true, // UI element state: expanded/collapsed 'editor.options.expanded': true, // UI element state: expanded/collapsed 'editor.lint.expanded': true, // UI element state: expanded/collapsed + 'editor.integration.expanded': true, // UI element state expanded/collapsed 'editor.lineWrapping': true, // word wrap 'editor.smartIndent': true, // 'smart' indent 'editor.indentWithTabs': false, // smart indent with tabs