From 795fe8ae1da7debfecd9e47cace59abfc189edf2 Mon Sep 17 00:00:00 2001 From: Paul Rosset Date: Thu, 14 Dec 2017 12:26:05 +0000 Subject: [PATCH] Add isEqual and changing haveToSaveNotif method --- browser/main/modals/PreferencesModal/HotkeyTab.js | 2 +- browser/main/modals/PreferencesModal/UiTab.js | 2 +- browser/main/modals/PreferencesModal/index.js | 6 +++--- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/browser/main/modals/PreferencesModal/HotkeyTab.js b/browser/main/modals/PreferencesModal/HotkeyTab.js index 93d2993c..4b4a3060 100644 --- a/browser/main/modals/PreferencesModal/HotkeyTab.js +++ b/browser/main/modals/PreferencesModal/HotkeyTab.js @@ -72,7 +72,7 @@ class HotkeyTab extends React.Component { this.setState({ config }) - if (JSON.stringify(this.oldHotkey) === JSON.stringify(config.hotkey)) { + if (_.isEqual(this.oldHotkey, config.hotkey)) { this.props.haveToSave() } else { this.props.haveToSave({ diff --git a/browser/main/modals/PreferencesModal/UiTab.js b/browser/main/modals/PreferencesModal/UiTab.js index 9f9ee73f..d5d54b75 100644 --- a/browser/main/modals/PreferencesModal/UiTab.js +++ b/browser/main/modals/PreferencesModal/UiTab.js @@ -93,7 +93,7 @@ class UiTab extends React.Component { this.setState({ config: newConfig, codemirrorTheme: newCodemirrorTheme }, () => { const {ui, editor, preview} = this.props.config this.currentConfig = {ui, editor, preview} - if (JSON.stringify(this.currentConfig) === JSON.stringify(this.state.config)) { + if (_.isEqual(this.currentConfig, this.state.config)) { this.props.haveToSave() } else { this.props.haveToSave({ diff --git a/browser/main/modals/PreferencesModal/index.js b/browser/main/modals/PreferencesModal/index.js index 882428b5..09885e1c 100644 --- a/browser/main/modals/PreferencesModal/index.js +++ b/browser/main/modals/PreferencesModal/index.js @@ -98,9 +98,9 @@ class Preferences extends React.Component { return node.getBoundingClientRect() } - haveToSaveNotif (tab) { + haveToSaveNotif (type, message) { return ( -

{tab[tab.label].message}

+

{message}

) } @@ -129,7 +129,7 @@ class Preferences extends React.Component { {tab.label} - {isUiHotkeyTab ? this.haveToSaveNotif(tab) : null} + {isUiHotkeyTab ? this.haveToSaveNotif(tab[tab.label].type, tab[tab.label].message) : null} ) })