diff --git a/browser/components/CodeEditor.js b/browser/components/CodeEditor.js index d721d614..759cd507 100644 --- a/browser/components/CodeEditor.js +++ b/browser/components/CodeEditor.js @@ -98,8 +98,8 @@ export default class CodeEditor extends React.Component { } handleChange (e) { + this.value = this.editor.getValue() if (this.props.onChange) { - this.value = this.editor.getValue() this.props.onChange(e) } } @@ -121,6 +121,7 @@ export default class CodeEditor extends React.Component { reload () { // Change event shouldn't be fired when switch note this.editor.off('change', this.changeHandler) + this.value = this.props.value this.editor.setValue(this.props.value) this.editor.clearHistory() this.editor.on('change', this.changeHandler) diff --git a/browser/finder/StorageSection.js b/browser/finder/StorageSection.js index b11531a7..3dfe072a 100644 --- a/browser/finder/StorageSection.js +++ b/browser/finder/StorageSection.js @@ -16,6 +16,7 @@ class StorageSection extends React.Component { isOpen: !this.state.isOpen }) } + handleHeaderClick (e) { let { storage } = this.props this.props.handleStorageButtonClick(e, storage.key) diff --git a/browser/main/NoteList/NoteList.styl b/browser/main/NoteList/NoteList.styl index 9d9cb0a2..d32187b8 100644 --- a/browser/main/NoteList/NoteList.styl +++ b/browser/main/NoteList/NoteList.styl @@ -74,13 +74,10 @@ background-color alpha($ui-active-color, 100%) color white .item-title - color white + .item-title-empty .item-title-icon - color white .item-bottom-tagIcon - color white .item-bottom-tagList-empty - color white .item-bottom-time color white .item-bottom-tagList-item diff --git a/browser/main/store.js b/browser/main/store.js index 1ebe77d1..b38cd114 100644 --- a/browser/main/store.js +++ b/browser/main/store.js @@ -330,31 +330,34 @@ function data (state = defaultDataMap(), action) { let storageNoteSet = state.storageNoteMap.get(action.storage.key) storageNoteSet = new Set(storageNoteSet) state.storageNoteMap.set(action.storage.key, storageNoteSet) - noteSet.forEach(function handleNoteKey (noteKey) { - // Get note from noteMap - let note = state.noteMap.get(noteKey) - if (note != null) { - state.noteMap.delete(noteKey) - // From storageSet - storageNoteSet.delete(noteKey) + if (noteSet != null) { + noteSet.forEach(function handleNoteKey (noteKey) { + // Get note from noteMap + let note = state.noteMap.get(noteKey) + if (note != null) { + state.noteMap.delete(noteKey) - // From starredSet - if (note.isStarred) { - state.starredSet = new Set(state.starredSet) - state.starredSet.delete(noteKey) + // From storageSet + storageNoteSet.delete(noteKey) + + // From starredSet + if (note.isStarred) { + state.starredSet = new Set(state.starredSet) + state.starredSet.delete(noteKey) + } + + // Delete key from tag map + state.tagNoteMap = new Map(state.tagNoteMap) + note.tags.forEach((tag) => { + let tagNoteSet = state.tagNoteMap.get(tag) + tagNoteSet = new Set(tagNoteSet) + state.tagNoteMap.set(tag, tagNoteSet) + tagNoteSet.delete(noteKey) + }) } - - // Delete key from tag map - state.tagNoteMap = new Map(state.tagNoteMap) - note.tags.forEach((tag) => { - let tagNoteSet = state.tagNoteMap.get(tag) - tagNoteSet = new Set(tagNoteSet) - state.tagNoteMap.set(tag, tagNoteSet) - tagNoteSet.delete(noteKey) - }) - } - }) + }) + } } return state case 'ADD_STORAGE':