1
0
mirror of https://github.com/BoostIo/Boostnote synced 2025-12-13 17:56:25 +00:00

fix minor bugs

fix codemirror bug
fix style bug of in NoteList
fix Redux store bug: Cruch on deleting empty folder
This commit is contained in:
Dick Choi
2016-10-13 15:47:25 +09:00
parent ed5f3a6202
commit 2fdea6cd61
4 changed files with 29 additions and 27 deletions

View File

@@ -98,8 +98,8 @@ export default class CodeEditor extends React.Component {
} }
handleChange (e) { handleChange (e) {
this.value = this.editor.getValue()
if (this.props.onChange) { if (this.props.onChange) {
this.value = this.editor.getValue()
this.props.onChange(e) this.props.onChange(e)
} }
} }
@@ -121,6 +121,7 @@ export default class CodeEditor extends React.Component {
reload () { reload () {
// Change event shouldn't be fired when switch note // Change event shouldn't be fired when switch note
this.editor.off('change', this.changeHandler) this.editor.off('change', this.changeHandler)
this.value = this.props.value
this.editor.setValue(this.props.value) this.editor.setValue(this.props.value)
this.editor.clearHistory() this.editor.clearHistory()
this.editor.on('change', this.changeHandler) this.editor.on('change', this.changeHandler)

View File

@@ -16,6 +16,7 @@ class StorageSection extends React.Component {
isOpen: !this.state.isOpen isOpen: !this.state.isOpen
}) })
} }
handleHeaderClick (e) { handleHeaderClick (e) {
let { storage } = this.props let { storage } = this.props
this.props.handleStorageButtonClick(e, storage.key) this.props.handleStorageButtonClick(e, storage.key)

View File

@@ -74,13 +74,10 @@
background-color alpha($ui-active-color, 100%) background-color alpha($ui-active-color, 100%)
color white color white
.item-title .item-title
color white .item-title-empty
.item-title-icon .item-title-icon
color white
.item-bottom-tagIcon .item-bottom-tagIcon
color white
.item-bottom-tagList-empty .item-bottom-tagList-empty
color white
.item-bottom-time .item-bottom-time
color white color white
.item-bottom-tagList-item .item-bottom-tagList-item

View File

@@ -330,31 +330,34 @@ function data (state = defaultDataMap(), action) {
let storageNoteSet = state.storageNoteMap.get(action.storage.key) let storageNoteSet = state.storageNoteMap.get(action.storage.key)
storageNoteSet = new Set(storageNoteSet) storageNoteSet = new Set(storageNoteSet)
state.storageNoteMap.set(action.storage.key, 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 if (noteSet != null) {
storageNoteSet.delete(noteKey) noteSet.forEach(function handleNoteKey (noteKey) {
// Get note from noteMap
let note = state.noteMap.get(noteKey)
if (note != null) {
state.noteMap.delete(noteKey)
// From starredSet // From storageSet
if (note.isStarred) { storageNoteSet.delete(noteKey)
state.starredSet = new Set(state.starredSet)
state.starredSet.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 return state
case 'ADD_STORAGE': case 'ADD_STORAGE':