mirror of https://github.com/vector-im/riot-web
show implicit names as placeholders if available
parent
d39a9a0f18
commit
0cb6094992
|
@ -44,9 +44,11 @@ module.exports = React.createClass({
|
||||||
componentWillReceiveProps: function(newProps) {
|
componentWillReceiveProps: function(newProps) {
|
||||||
if (newProps.editing) {
|
if (newProps.editing) {
|
||||||
var topic = this.props.room.currentState.getStateEvents('m.room.topic', '');
|
var topic = this.props.room.currentState.getStateEvents('m.room.topic', '');
|
||||||
|
var name = this.props.room.currentState.getStateEvents('m.room.name', '');
|
||||||
|
|
||||||
this.setState({
|
this.setState({
|
||||||
name: this.props.room.name,
|
name: name ? name.getContent().name : '',
|
||||||
|
initialName: name ? name.getContent().name : '',
|
||||||
topic: topic ? topic.getContent().topic : '',
|
topic: topic ? topic.getContent().topic : '',
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -119,12 +121,14 @@ module.exports = React.createClass({
|
||||||
// </div>
|
// </div>
|
||||||
// if (topic) topic_el = <div className="mx_RoomHeader_topic"><textarea>{ topic.getContent().topic }</textarea></div>
|
// if (topic) topic_el = <div className="mx_RoomHeader_topic"><textarea>{ topic.getContent().topic }</textarea></div>
|
||||||
|
|
||||||
|
var placeholderName = this.state.initialName ? "Unnamed Room" : this.props.room.name;
|
||||||
|
|
||||||
name =
|
name =
|
||||||
<div className="mx_RoomHeader_name">
|
<div className="mx_RoomHeader_name">
|
||||||
<EditableText
|
<EditableText
|
||||||
className="mx_RoomHeader_nametext mx_RoomHeader_editable"
|
className="mx_RoomHeader_nametext mx_RoomHeader_editable"
|
||||||
placeholderClassName="mx_RoomHeader_placeholder"
|
placeholderClassName="mx_RoomHeader_placeholder"
|
||||||
placeholder="Unnamed Room"
|
placeholder={ placeholderName }
|
||||||
blurToCancel={ false }
|
blurToCancel={ false }
|
||||||
onValueChanged={ this.onNameChanged }
|
onValueChanged={ this.onNameChanged }
|
||||||
initialValue={ this.state.name }/>
|
initialValue={ this.state.name }/>
|
||||||
|
|
Loading…
Reference in New Issue