Fix: should't edit the style object directly returned from getStyles cache

This commit is contained in:
eight 2017-09-14 09:09:40 +08:00
parent 97fd2aa083
commit b7b5888431

View File

@ -6,6 +6,9 @@
'use strict'; 'use strict';
function createSourceEditor(style) { function createSourceEditor(style) {
// style might be an object reference to background page
style = deepCopy(style);
// draw HTML // draw HTML
$('#sections').innerHTML = ''; $('#sections').innerHTML = '';
$('#name').disabled = true; $('#name').disabled = true;
@ -271,7 +274,7 @@ function createSourceEditor(style) {
} }
function replaceStyle(newStyle) { function replaceStyle(newStyle) {
style = newStyle; style = deepCopy(newStyle);
updateMetas(); updateMetas();
if (style.source !== cm.getValue()) { if (style.source !== cm.getValue()) {
const cursor = cm.getCursor(); const cursor = cm.getCursor();