diff --git a/edit/source-editor.js b/edit/source-editor.js index 36043916..3224acb8 100644 --- a/edit/source-editor.js +++ b/edit/source-editor.js @@ -23,12 +23,7 @@ function createSourceEditor(style) { }); // normalize style - if (!style.id) { - setupNewStyle(style); - } else { - // style might be an object reference to background page - style = deepCopy(style); - } + if (!style.id) setupNewStyle(style); const cm = CodeMirror($('.single-editor'), {value: style.sourceCode}); editors.push(cm); @@ -195,7 +190,7 @@ function createSourceEditor(style) { history.replaceState({}, '', `?id=${newStyle.id}`); } sessionStorage.justEditedStyleId = newStyle.id; - style = deepCopy(newStyle); + style = newStyle; updateMeta(); } } @@ -222,7 +217,6 @@ function createSourceEditor(style) { sourceCode: code, })) .then(replaceStyle) - .then(() => cm.setOption('mode', cm.doc.mode)) .catch(err => { if (err.message === t('styleMissingMeta', 'name')) { messageBox.confirm(t('usercssReplaceTemplateConfirmation')).then(ok => ok && diff --git a/install-usercss/install-usercss.js b/install-usercss/install-usercss.js index c889b2d7..072db856 100644 --- a/install-usercss/install-usercss.js +++ b/install-usercss/install-usercss.js @@ -283,7 +283,7 @@ ])) ).then(ok => ok && API.saveUsercss(Object.assign(style, dup && {reason: 'update'})) - .then(r => install(r instanceof Object ? r : deepCopy(r))) + .then(install) .catch(err => messageBox.alert(t('styleInstallFailed', err))) ); }; diff --git a/popup/popup.js b/popup/popup.js index cecedc75..7e45de2f 100644 --- a/popup/popup.js +++ b/popup/popup.js @@ -366,7 +366,7 @@ Object.assign(handleEvent, { if (styleIsUsercss) { API.getStyles({id: styleId}).then(([style]) => { hotkeys.setState(false); - configDialog(deepCopy(style)).then(() => { + configDialog(style).then(() => { hotkeys.setState(true); }); });