remove some unnecessary deepCopy calls
This commit is contained in:
parent
45219a88c1
commit
bced23052c
|
@ -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 &&
|
||||
|
|
|
@ -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)))
|
||||
);
|
||||
};
|
||||
|
|
|
@ -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);
|
||||
});
|
||||
});
|
||||
|
|
Loading…
Reference in New Issue
Block a user