a bunch of small bugs fixed
This commit is contained in:
@@ -112,6 +112,7 @@ class NewTopicView extends React.Component {
|
||||
type="p2p"
|
||||
onSearchContacts={this.handleSearchContacts} />
|
||||
<ContactList
|
||||
tinode={this.props.tinode}
|
||||
contacts={this.props.searchResults}
|
||||
myUserId={this.props.myUserId}
|
||||
emptyListMessage={no_contacts_placeholder}
|
||||
|
||||
@@ -35,7 +35,7 @@ export default class InPlaceEdit extends React.Component {
|
||||
}
|
||||
|
||||
handeTextChange(e) {
|
||||
this.setState({value: e.target.value});
|
||||
this.setState({value: e.target.value || ''});
|
||||
}
|
||||
|
||||
handleKeyDown(e) {
|
||||
@@ -59,13 +59,13 @@ export default class InPlaceEdit extends React.Component {
|
||||
}
|
||||
|
||||
handleEditingFinished(event) {
|
||||
if (this.props.required && !event.target.checkValidity()) {
|
||||
const value = this.state.value.trim();
|
||||
if (this.props.required && (!event.target.checkValidity() || !value)) {
|
||||
// Empty input
|
||||
this.setState({value: this.props.value, active: false});
|
||||
return;
|
||||
}
|
||||
this.setState({active: false});
|
||||
const value = this.state.value.trim();
|
||||
if ((value || this.props.value) && (value !== this.props.value)) {
|
||||
this.props.onFinished(value);
|
||||
}
|
||||
|
||||
@@ -34,7 +34,7 @@ export default class NewTopicGroup extends React.PureComponent {
|
||||
}
|
||||
|
||||
handleFieldEdit(name, e) {
|
||||
this.setState({[name]: e.target.value});
|
||||
this.setState({[name]: e.target.value || ''});
|
||||
}
|
||||
|
||||
handleImageChanged(img) {
|
||||
@@ -82,7 +82,7 @@ export default class NewTopicGroup extends React.PureComponent {
|
||||
<FormattedMessage id="topic_name_editing_placeholder" defaultMessage="Freeform name of the group"
|
||||
description="Prompt for entering topic name">{
|
||||
(placeholder) => <input type="text" id="new-topic-fn" placeholder={placeholder}
|
||||
ref={this.fullName} value={this.state.fullName} onChange={this.handleFieldEdit.bind('fullName')}
|
||||
ref={this.fullName} value={this.state.fullName} onChange={this.handleFieldEdit.bind(this, 'fullName')}
|
||||
autoFocus required tabIndex={0} />
|
||||
}</FormattedMessage>
|
||||
</div>
|
||||
@@ -94,7 +94,7 @@ export default class NewTopicGroup extends React.PureComponent {
|
||||
<FormattedMessage id="private_editing_placeholder" defaultMessage="Visible to you only"
|
||||
description="Placeholder for editing 'private'">{
|
||||
(placeholder) => <input type="text" id="new-topic-priv" placeholder={placeholder}
|
||||
value={this.state.private} onChange={this.handleFieldEdit.bind('private')} tabIndex={1} />
|
||||
value={this.state.private} onChange={this.handleFieldEdit.bind(this, 'private')} tabIndex={1} />
|
||||
}</FormattedMessage>
|
||||
</div>
|
||||
<div className="group">
|
||||
@@ -105,7 +105,7 @@ export default class NewTopicGroup extends React.PureComponent {
|
||||
<FormattedMessage id="description_editing_placeholder" defaultMessage="Description (optional)"
|
||||
description="Placeholder for editing topic description">{
|
||||
(placeholder) => <input type="text" id="new-topic-desc" placeholder={placeholder}
|
||||
value={this.state.description} onChange={this.handleFieldEdit.bind('description')} tabIndex={2} />
|
||||
value={this.state.description} onChange={this.handleFieldEdit.bind(this, 'description')} tabIndex={2} />
|
||||
}</FormattedMessage>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -196,11 +196,11 @@ export default class TopicDescEdit extends React.Component {
|
||||
<div>
|
||||
<FormattedMessage id="full_name_prompt" defaultMessage="Full name, e.g. John Doe"
|
||||
description="Input placeholder for person's full name">{
|
||||
(full_name_placeholder) => <InPlaceEdit
|
||||
placeholder={full_name_placeholder}
|
||||
value={this.state.fullName}
|
||||
required={true}
|
||||
onFinished={this.handleFullNameUpdate} />
|
||||
(full_name_placeholder) => <InPlaceEdit
|
||||
placeholder={full_name_placeholder}
|
||||
value={this.state.fullName}
|
||||
required={true}
|
||||
onFinished={this.handleFullNameUpdate} />
|
||||
}</FormattedMessage>
|
||||
</div>
|
||||
</div>
|
||||
@@ -212,12 +212,15 @@ export default class TopicDescEdit extends React.Component {
|
||||
description="Label for editing topic name" />
|
||||
</label></div>
|
||||
<div>
|
||||
<InPlaceEdit
|
||||
placeholder={this.state.groupTopic ? "Group name" : <i>Unknown</i>}
|
||||
readOnly={!editable}
|
||||
value={this.state.fullName}
|
||||
required={true}
|
||||
onFinished={this.handleFullNameUpdate} />
|
||||
<FormattedMessage id="topic_name_editing_placeholder" defaultMessage="Freeform name of the group"
|
||||
description="Prompt for entering topic name">{
|
||||
(group_name_placeholder) => <InPlaceEdit
|
||||
placeholder={group_name_placeholder}
|
||||
readOnly={!editable}
|
||||
value={this.state.fullName}
|
||||
required={true}
|
||||
onFinished={this.handleFullNameUpdate} />
|
||||
}</FormattedMessage>
|
||||
</div>
|
||||
</div>
|
||||
<div className="group">
|
||||
@@ -228,8 +231,7 @@ export default class TopicDescEdit extends React.Component {
|
||||
</label>
|
||||
</div>
|
||||
<div>
|
||||
<FormattedMessage id="private_editing_placeholder"
|
||||
defaultMessage="Visible to you only"
|
||||
<FormattedMessage id="private_editing_placeholder" defaultMessage="Visible to you only"
|
||||
description="Placeholder for editing 'private'">{
|
||||
(private_placeholder) => <InPlaceEdit
|
||||
placeholder={private_placeholder}
|
||||
|
||||
Reference in New Issue
Block a user