Skip to content

Commit

Permalink
Merge pull request #410 from jekyll/focus
Browse files Browse the repository at this point in the history
Autofocus to newly created metafield
  • Loading branch information
mertkahyaoglu authored Jul 1, 2017
2 parents 9b1f29b + e808e0d commit ef08663
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
5 changes: 5 additions & 0 deletions src/components/metadata/MetaField.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,11 @@ import MetaButtons from './MetaButtons';

export class MetaField extends Component {

componentDidMount() {
const isNewField = /New field/.test(this.props.fieldKey);
isNewField && this.refs.field_key.select();
}

handleConvertClick(type) {
const { convertField, nameAttr } = this.props;
convertField(nameAttr, type);
Expand Down
2 changes: 1 addition & 1 deletion src/reducers/metadata.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import { addField, removeField, updateFieldKey,
export default function metadata(state = {
metadata: {},
new_field_count: 1,
key_prefix: '', // force children to be destroyed on sort
key_prefix: '', // force children to be rerendered on sort
fieldChanged: false
}, action) {
switch (action.type) {
Expand Down

0 comments on commit ef08663

Please sign in to comment.