Componentnize NewNoteButton#800
Conversation
|
Please make sure to be pasted screenshots of all your changes. |
|
|
||
| // Find first storage | ||
| if (storage == null) { | ||
| for (let kv of data.storageMap) { |
There was a problem hiding this comment.
I want to seek better way: for
There was a problem hiding this comment.
I know this if condition is not good, but I don't know what exactly it is. So I choose a way not to change them.
| break | ||
| } | ||
| } | ||
| if (storage == null) window.alert('No storage to create a note') |
There was a problem hiding this comment.
I want to seek better way: window.alert
|
|
||
| createNote (noteType) { | ||
| let { dispatch, location } = this.props | ||
| if (noteType !== 'MARKDOWN_NOTE' && noteType !== 'SNIPPET_NOTE') throw new Error('Invalid note type.') |
There was a problem hiding this comment.
Is this really needed?
|
|
||
| let { storage, folder } = this.resolveTargetFolder() | ||
|
|
||
| let newNote = noteType === 'MARKDOWN_NOTE' |
There was a problem hiding this comment.
I want to seek better way
| }) | ||
| } | ||
|
|
||
| setDefaultNote (defaultNote) { |
There was a problem hiding this comment.
Is this really used?
There was a problem hiding this comment.
It was used in the old version, but not used now.
| height $topBar-height - 1 | ||
| margin-left: auto; | ||
| width: 64px; | ||
| margin-right: -15px; |
There was a problem hiding this comment.
I added these three lines for this change.
| return | ||
| } | ||
|
|
||
| switch (config.ui.defaultNote) { |
There was a problem hiding this comment.
Deleted because defaultNote is not configurable in Preferences now.
| } | ||
| } | ||
|
|
||
| createNote (noteType) { |
There was a problem hiding this comment.
Deleted accompanied with handleNewPostButtonClick()
| }) | ||
| } | ||
|
|
||
| setDefaultNote (defaultNote) { |
There was a problem hiding this comment.
Deleted because it's no longer used.
| @@ -1,51 +0,0 @@ | |||
| import React, { PropTypes } from 'react' | |||
There was a problem hiding this comment.
Deleted because this file is no longer used.
|
|
||
| render () { | ||
| const { config, style, data, location } = this.props | ||
| if (location.pathname === '/trashed') { |
There was a problem hiding this comment.
I changed a specification.
before
NewNoteButton was shown in Trash but a warning appeared when a user clicked this.
after
NewNoteButton is no longer shown in Trash.

context
Separation
NewNoteButtonfromTopBar.before
before(Trash)
after
I hope the layout isn't changed.

after(Trash)
for tests
note
I just move the code, so I'll have to refactor them.
memo: delete DeleteArticleModal
Make sure whether all props are passed properly.