From 4848a2a6512ec0ee284559607742656c27942c9e Mon Sep 17 00:00:00 2001 From: snowsunny Date: Sat, 28 Oct 2017 22:30:15 +0900 Subject: [PATCH] fix dictionary manager for none ruby dictionary with force flag --- narou-reader/background.js | 8 ++++++-- narou-reader/options.js | 8 ++++++-- src/js/DictionariesManager.js | 8 ++++++-- 3 files changed, 18 insertions(+), 6 deletions(-) diff --git a/narou-reader/background.js b/narou-reader/background.js index afde796..f7ef20c 100644 --- a/narou-reader/background.js +++ b/narou-reader/background.js @@ -5370,8 +5370,12 @@ var DictionariesManager = function () { if (newDictionary.raw) { newDictionary.rubies = this.getRubies(newDictionary.raw); } else { - delete newDictionary.raw; - newDictionary.rubies = this.getRubies(storageDictionary.raw); + if (forceFlag) { + newDictionary.rubies = []; + } else { + newDictionary.rubies = this.getRubies(storageDictionary.raw); + delete newDictionary.raw; + } } } else { newDictionary.raw = newDictionary.raw || ''; diff --git a/narou-reader/options.js b/narou-reader/options.js index 86e1594..0c8f8b5 100644 --- a/narou-reader/options.js +++ b/narou-reader/options.js @@ -15706,8 +15706,12 @@ var DictionariesManager = function () { if (newDictionary.raw) { newDictionary.rubies = this.getRubies(newDictionary.raw); } else { - delete newDictionary.raw; - newDictionary.rubies = this.getRubies(storageDictionary.raw); + if (forceFlag) { + newDictionary.rubies = []; + } else { + newDictionary.rubies = this.getRubies(storageDictionary.raw); + delete newDictionary.raw; + } } } else { newDictionary.raw = newDictionary.raw || ''; diff --git a/src/js/DictionariesManager.js b/src/js/DictionariesManager.js index 56e7f66..d8a5ab7 100644 --- a/src/js/DictionariesManager.js +++ b/src/js/DictionariesManager.js @@ -18,8 +18,12 @@ export default class DictionariesManager { if(newDictionary.raw) { newDictionary.rubies = this.getRubies(newDictionary.raw) } else { - delete newDictionary.raw - newDictionary.rubies = this.getRubies(storageDictionary.raw) + if(forceFlag) { + newDictionary.rubies = [] + } else { + newDictionary.rubies = this.getRubies(storageDictionary.raw) + delete newDictionary.raw + } } } else { newDictionary.raw = newDictionary.raw || ''