Skip to content

Commit a0a1c84

Browse files
committed
message for empty content like placeholder
1 parent 54d563f commit a0a1c84

4 files changed

Lines changed: 15 additions & 2 deletions

File tree

browser/components/MarkdownPreview.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,8 +45,12 @@ export default class MarkdownPreview extends React.Component {
4545
}
4646

4747
render () {
48+
let isEmpty = this.props.content.trim().length === 0
49+
let content = isEmpty
50+
? '(Empty content)'
51+
: this.props.content
4852
return (
49-
<div className={'MarkdownPreview' + (this.props.className != null ? ' ' + this.props.className : '')} dangerouslySetInnerHTML={{__html: ' ' + markdown(this.props.content)}}/>
53+
<div className={'MarkdownPreview' + (this.props.className != null ? ' ' + this.props.className : '') + (isEmpty ? ' empty' : '')} dangerouslySetInnerHTML={{__html: ' ' + markdown(content)}}/>
5054
)
5155
}
5256
}

browser/main/HomePage/ArticleList.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ export default class ArticleList extends React.Component {
118118
<ModeIcon className='mode' mode={article.mode}/> <div className='title' children={title}/>
119119
</div>
120120
<div className='ArticleList-item-middle2'>
121-
<pre><code children={article.content.substring(0, 50)}/></pre>
121+
<pre><code children={article.content.trim().length === 0 ? '(Empty content)' : article.content.substring(0, 50)}/></pre>
122122
</div>
123123
<div className='ArticleList-item-bottom'>
124124
<div className='tags'><i className='fa fa-fw fa-tags'/>{tagElements}</div>

browser/styles/finder/index.styl

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@ button, input
5050
width 250px
5151
overflow-y auto
5252
z-index 0
53+
user-select none
5354
&>ul>li
5455
.articleItem
5556
padding 10px
@@ -119,5 +120,9 @@ button, input
119120
overflow-y auto
120121
.MarkdownPreview
121122
marked()
123+
&.empty
124+
color lighten(inactiveTextColor, 10%)
125+
user-select none
126+
font-size 14px
122127
.CodeEditor
123128
absolute top bottom left right

browser/styles/main/HomeContainer/components/ArticleDetail.styl

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -257,6 +257,10 @@ infoButton()
257257
border-top solid 1px borderColor
258258
overflow-y auto
259259
user-select all
260+
&.empty
261+
color lighten(inactiveTextColor, 10%)
262+
user-select none
263+
font-size 14px
260264
.CodeEditor
261265
absolute left right bottom
262266
top 60px

0 commit comments

Comments
 (0)