mirror of
https://github.com/BoostIo/Boostnote
synced 2025-12-13 01:36:22 +00:00
Add isEqual and changing haveToSaveNotif method
This commit is contained in:
@@ -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({
|
||||
|
||||
@@ -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({
|
||||
|
||||
@@ -98,9 +98,9 @@ class Preferences extends React.Component {
|
||||
return node.getBoundingClientRect()
|
||||
}
|
||||
|
||||
haveToSaveNotif (tab) {
|
||||
haveToSaveNotif (type, message) {
|
||||
return (
|
||||
<p styleName={`saving--${tab[tab.label].type}`}>{tab[tab.label].message}</p>
|
||||
<p styleName={`saving--${type}`}>{message}</p>
|
||||
)
|
||||
}
|
||||
|
||||
@@ -129,7 +129,7 @@ class Preferences extends React.Component {
|
||||
<span styleName='nav-button-label'>
|
||||
{tab.label}
|
||||
</span>
|
||||
{isUiHotkeyTab ? this.haveToSaveNotif(tab) : null}
|
||||
{isUiHotkeyTab ? this.haveToSaveNotif(tab[tab.label].type, tab[tab.label].message) : null}
|
||||
</button>
|
||||
)
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user