mirror of
https://github.com/BoostIo/Boostnote
synced 2025-12-13 09:46:22 +00:00
articleのタイトルの基本タイトル追加 / 何も書かれていない時にUntitled labelをだす
This commit is contained in:
@@ -267,6 +267,9 @@ export default class ArticleDetail extends React.Component {
|
|||||||
newArticle.updatedAt = new Date()
|
newArticle.updatedAt = new Date()
|
||||||
if (newArticle.createdAt == null) {
|
if (newArticle.createdAt == null) {
|
||||||
newArticle.createdAt = new Date()
|
newArticle.createdAt = new Date()
|
||||||
|
if (newArticle.title.trim().length === 0) {
|
||||||
|
newArticle.title = `Created at ${moment(newArticle.createdAt).format('YYYY/MM/DD HH:mm')}`
|
||||||
|
}
|
||||||
activityRecord.emit('ARTICLE_CREATE')
|
activityRecord.emit('ARTICLE_CREATE')
|
||||||
} else {
|
} else {
|
||||||
activityRecord.emit('ARTICLE_UPDATE')
|
activityRecord.emit('ARTICLE_UPDATE')
|
||||||
@@ -464,7 +467,15 @@ export default class ArticleDetail extends React.Component {
|
|||||||
<div className='detailPanel'>
|
<div className='detailPanel'>
|
||||||
<div className='header'>
|
<div className='header'>
|
||||||
<div className='title'>
|
<div className='title'>
|
||||||
<input onKeyDown={e => this.handleTitleKeyDown(e)} placeholder='Title' ref='title' value={this.state.article.title} onChange={e => this.handleTitleChange(e)}/>
|
<input
|
||||||
|
onKeyDown={e => this.handleTitleKeyDown(e)}
|
||||||
|
placeholder={this.state.article.createdAt == null
|
||||||
|
? `Created at ${moment().format('YYYY/MM/DD HH:mm')}`
|
||||||
|
: 'Title'}
|
||||||
|
ref='title'
|
||||||
|
value={this.state.article.title}
|
||||||
|
onChange={e => this.handleTitleChange(e)}
|
||||||
|
/>
|
||||||
</div>
|
</div>
|
||||||
<ModeSelect
|
<ModeSelect
|
||||||
ref='mode'
|
ref='mode'
|
||||||
|
|||||||
@@ -80,6 +80,12 @@ export default class ArticleList extends React.Component {
|
|||||||
: (<span>Not tagged yet</span>)
|
: (<span>Not tagged yet</span>)
|
||||||
let folder = _.findWhere(folders, {key: article.FolderKey})
|
let folder = _.findWhere(folders, {key: article.FolderKey})
|
||||||
|
|
||||||
|
let title = article.status !== NEW
|
||||||
|
? article.title.trim().length === 0
|
||||||
|
? <small>(Untitled)</small>
|
||||||
|
: article.title
|
||||||
|
: '(New article)'
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div key={'article-' + article.key}>
|
<div key={'article-' + article.key}>
|
||||||
<div onClick={e => this.handleArticleClick(article)(e)} className={'articleItem' + (activeArticle.key === article.key ? ' active' : '')}>
|
<div onClick={e => this.handleArticleClick(article)(e)} className={'articleItem' + (activeArticle.key === article.key ? ' active' : '')}>
|
||||||
@@ -91,7 +97,7 @@ export default class ArticleList extends React.Component {
|
|||||||
<span className='updatedAt'>{article.status != null ? article.status : moment(article.updatedAt).fromNow()}</span>
|
<span className='updatedAt'>{article.status != null ? article.status : moment(article.updatedAt).fromNow()}</span>
|
||||||
</div>
|
</div>
|
||||||
<div className='middle'>
|
<div className='middle'>
|
||||||
<ModeIcon className='mode' mode={article.mode}/> <div className='title'>{article.status !== NEW ? article.title : '(New article)'}</div>
|
<ModeIcon className='mode' mode={article.mode}/> <div className='title'>{title}</div>
|
||||||
</div>
|
</div>
|
||||||
<div className='bottom'>
|
<div className='bottom'>
|
||||||
<div className='tags'><i className='fa fa-fw fa-tags'/>{tagElements}</div>
|
<div className='tags'><i className='fa fa-fw fa-tags'/>{tagElements}</div>
|
||||||
|
|||||||
@@ -48,6 +48,8 @@ articleItemColor = #777
|
|||||||
left 19px
|
left 19px
|
||||||
right 0
|
right 0
|
||||||
overflow ellipsis
|
overflow ellipsis
|
||||||
|
small
|
||||||
|
color #AAA
|
||||||
.bottom
|
.bottom
|
||||||
padding 5px 0
|
padding 5px 0
|
||||||
overflow-x auto
|
overflow-x auto
|
||||||
|
|||||||
Reference in New Issue
Block a user