mirror of
https://github.com/BoostIo/Boostnote
synced 2025-12-15 18:56:22 +00:00
Key入力追加
This commit is contained in:
@@ -4,7 +4,7 @@ import _ from 'lodash'
|
||||
import ModeIcon from 'boost/components/ModeIcon'
|
||||
import MarkdownPreview from 'boost/components/MarkdownPreview'
|
||||
import CodeEditor from 'boost/components/CodeEditor'
|
||||
import { IDLE_MODE, CREATE_MODE, EDIT_MODE, switchMode, updateArticle, destroyArticle } from 'boost/actions'
|
||||
import { IDLE_MODE, CREATE_MODE, EDIT_MODE, switchMode, switchArticle, switchFolder, updateArticle, destroyArticle } from 'boost/actions'
|
||||
import aceModes from 'boost/ace-modes'
|
||||
import Select from 'react-select'
|
||||
import linkState from 'boost/linkState'
|
||||
@@ -38,6 +38,11 @@ export default class ArticleDetail extends React.Component {
|
||||
console.log('receive props')
|
||||
})
|
||||
}
|
||||
|
||||
let isEdit = nextProps.status.mode === EDIT_MODE || nextProps.status.mode === CREATE_MODE
|
||||
if (isEdit && this.state.openDeleteConfirmMenu) {
|
||||
this.setState({openDeleteConfirmMenu: false})
|
||||
}
|
||||
}
|
||||
|
||||
renderEmpty () {
|
||||
@@ -135,7 +140,7 @@ export default class ArticleDetail extends React.Component {
|
||||
}
|
||||
|
||||
handleSaveButtonClick (e) {
|
||||
let { dispatch, folders } = this.props
|
||||
let { dispatch, folders, filters } = this.props
|
||||
let article = this.state.article
|
||||
let newArticle = Object.assign({}, article)
|
||||
|
||||
@@ -147,6 +152,8 @@ export default class ArticleDetail extends React.Component {
|
||||
|
||||
dispatch(updateArticle(newArticle))
|
||||
dispatch(switchMode(IDLE_MODE))
|
||||
if (filters.folder.length !== 0) dispatch(switchFolder(folder.name))
|
||||
dispatch(switchArticle(newArticle.key))
|
||||
}
|
||||
|
||||
handleFolderKeyChange (e) {
|
||||
|
||||
@@ -15,6 +15,26 @@ export default class ArticleList extends React.Component {
|
||||
clearInterval(this.refreshTimer)
|
||||
}
|
||||
|
||||
selectPriorArticle () {
|
||||
let { articles, activeArticle, dispatch } = this.props
|
||||
let targetIndex = articles.indexOf(activeArticle) - 1
|
||||
let targetArticle = articles[targetIndex]
|
||||
|
||||
if (targetArticle != null) {
|
||||
dispatch(switchArticle(targetArticle.key))
|
||||
}
|
||||
}
|
||||
|
||||
selectNextArticle () {
|
||||
let { articles, activeArticle, dispatch } = this.props
|
||||
let targetIndex = articles.indexOf(activeArticle) + 1
|
||||
let targetArticle = articles[targetIndex]
|
||||
|
||||
if (targetArticle != null) {
|
||||
dispatch(switchArticle(targetArticle.key))
|
||||
}
|
||||
}
|
||||
|
||||
handleArticleClick (article) {
|
||||
let { dispatch } = this.props
|
||||
return function (e) {
|
||||
|
||||
@@ -7,6 +7,7 @@ import Preferences from 'boost/components/modal/Preferences'
|
||||
import CreateNewFolder from 'boost/components/modal/CreateNewFolder'
|
||||
|
||||
import remote from 'remote'
|
||||
let userName = remote.getGlobal('process').env.USER
|
||||
|
||||
export default class ArticleNavigator extends React.Component {
|
||||
handlePreferencesButtonClick (e) {
|
||||
@@ -51,8 +52,6 @@ export default class ArticleNavigator extends React.Component {
|
||||
)
|
||||
})
|
||||
|
||||
let userName = remote.getGlobal('process').env.USER
|
||||
|
||||
return (
|
||||
<div className='ArticleNavigator'>
|
||||
<div className='userInfo'>
|
||||
|
||||
@@ -4,16 +4,29 @@ import ExternalLink from 'boost/components/ExternalLink'
|
||||
import { setSearchFilter } from 'boost/actions'
|
||||
|
||||
export default class ArticleTopBar extends React.Component {
|
||||
isInputFocused () {
|
||||
return document.activeElement === ReactDOM.findDOMNode(this.refs.searchInput)
|
||||
}
|
||||
|
||||
focusInput () {
|
||||
ReactDOM.findDOMNode(this.refs.searchInput).focus()
|
||||
}
|
||||
|
||||
blurInput () {
|
||||
ReactDOM.findDOMNode(this.refs.searchInput).blur()
|
||||
}
|
||||
|
||||
handleSearchChange (e) {
|
||||
let { dispatch } = this.props
|
||||
|
||||
dispatch(setSearchFilter(e.target.value))
|
||||
}
|
||||
|
||||
handleSearchClearButton (e) {
|
||||
let { dispatch } = this.props
|
||||
|
||||
dispatch(setSearchFilter(''))
|
||||
ReactDOM.findDOMNode(this.refs.searchInput).focus()
|
||||
this.focusInput()
|
||||
}
|
||||
|
||||
render () {
|
||||
|
||||
Reference in New Issue
Block a user