Support placeholderText parameter

This commit is contained in:
Nathan Sobo
2017-03-16 21:59:08 -06:00
committed by Antonio Scandurra
parent 36f5262f40
commit 4e00139965
2 changed files with 25 additions and 7 deletions

View File

@@ -315,7 +315,8 @@ class TextEditorComponent {
style.height = height
children = [
this.renderCursorsAndInput(width, height),
this.renderLineTiles(width, height)
this.renderLineTiles(width, height),
this.renderPlaceholderText()
]
} else {
children = $.div({ref: 'characterMeasurementLine', className: 'line'},
@@ -427,6 +428,17 @@ class TextEditorComponent {
}, children)
}
renderPlaceholderText () {
const {model} = this.props
if (model.isEmpty()) {
const placeholderText = model.getPlaceholderText()
if (placeholderText != null) {
return $.div({className: 'placeholder-text'}, placeholderText)
}
}
return null
}
renderHiddenInput () {
let top, left
if (this.hiddenInputPosition) {