From b7b58884314e4291495edab6dbd02f4525369a2d Mon Sep 17 00:00:00 2001 From: eight Date: Thu, 14 Sep 2017 09:09:40 +0800 Subject: [PATCH] Fix: should't edit the style object directly returned from getStyles cache --- edit/source-editor.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/edit/source-editor.js b/edit/source-editor.js index e8d14001..b5b6c2af 100644 --- a/edit/source-editor.js +++ b/edit/source-editor.js @@ -6,6 +6,9 @@ 'use strict'; function createSourceEditor(style) { + // style might be an object reference to background page + style = deepCopy(style); + // draw HTML $('#sections').innerHTML = ''; $('#name').disabled = true; @@ -271,7 +274,7 @@ function createSourceEditor(style) { } function replaceStyle(newStyle) { - style = newStyle; + style = deepCopy(newStyle); updateMetas(); if (style.source !== cm.getValue()) { const cursor = cm.getCursor();