1
0
mirror of https://github.com/BoostIo/Boostnote synced 2025-12-16 11:15:12 +00:00

Merge pull request #1363 from BoostIO/fix-note-disppaer-bug

fix bug when add tag, disappear note.
This commit is contained in:
Kazz Yokomizo
2018-01-04 19:57:40 +09:00
committed by GitHub

View File

@@ -79,17 +79,22 @@ class MarkdownNoteDetail extends React.Component {
ee.off('topbar:togglelockbutton', this.toggleLockButton) ee.off('topbar:togglelockbutton', this.toggleLockButton)
} }
handleChange (e) { handleUpdateTag () {
const { note } = this.state const { note } = this.state
note.content = this.refs.content.value
if (this.refs.tags) note.tags = this.refs.tags.value if (this.refs.tags) note.tags = this.refs.tags.value
note.title = markdown.strip(striptags(findNoteTitle(note.content))) this.updateNote(note)
note.updatedAt = new Date() }
this.setState({ handleUpdateContent () {
note const { note } = this.state
}, () => { note.content = this.refs.content.value
note.title = markdown.strip(striptags(findNoteTitle(note.content)))
this.updateNote(note)
}
updateNote (note) {
note.updatedAt = new Date()
this.setState({note}, () => {
this.save() this.save()
}) })
} }
@@ -289,7 +294,7 @@ class MarkdownNoteDetail extends React.Component {
config={config} config={config}
value={note.content} value={note.content}
storageKey={note.storage} storageKey={note.storage}
onChange={(e) => this.handleChange(e)} onChange={this.handleUpdateContent.bind(this)}
ignorePreviewPointerEvents={ignorePreviewPointerEvents} ignorePreviewPointerEvents={ignorePreviewPointerEvents}
/> />
} else { } else {
@@ -298,7 +303,7 @@ class MarkdownNoteDetail extends React.Component {
config={config} config={config}
value={note.content} value={note.content}
storageKey={note.storage} storageKey={note.storage}
onChange={(e) => this.handleChange(e)} onChange={this.handleUpdateContent.bind(this)}
ignorePreviewPointerEvents={ignorePreviewPointerEvents} ignorePreviewPointerEvents={ignorePreviewPointerEvents}
/> />
} }
@@ -359,7 +364,7 @@ class MarkdownNoteDetail extends React.Component {
<TagSelect <TagSelect
ref='tags' ref='tags'
value={this.state.note.tags} value={this.state.note.tags}
onChange={(e) => this.handleChange(e)} onChange={this.handleUpdateTag.bind(this)}
/> />
<ToggleModeButton onClick={(e) => this.handleSwitchMode(e)} editorType={editorType} /> <ToggleModeButton onClick={(e) => this.handleSwitchMode(e)} editorType={editorType} />