Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added EditableText input type field #3235

Merged
merged 1 commit into from Dec 14, 2018
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 8 additions & 2 deletions packages/core/src/components/editable-text/editableText.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,11 @@ export interface IEditableTextProps extends IIntentProps, IProps {
*/
selectAllOnFocus?: boolean;

/**
* The type of input that should be shown, when not `multiline`.
*/
type?: string;

/** Text value of controlled input. */
value?: string;

Expand Down Expand Up @@ -116,6 +121,7 @@ export class EditableText extends AbstractPureComponent<IEditableTextProps, IEdi
minWidth: 80,
multiline: false,
placeholder: "Click to Edit",
type: "text",
};

private valueElement: HTMLSpanElement;
Expand Down Expand Up @@ -280,7 +286,7 @@ export class EditableText extends AbstractPureComponent<IEditableTextProps, IEdi
};

private maybeRenderInput(value: string) {
const { maxLength, multiline, placeholder } = this.props;
const { maxLength, multiline, type, placeholder } = this.props;
if (!this.state.isEditing) {
return undefined;
}
Expand All @@ -301,7 +307,7 @@ export class EditableText extends AbstractPureComponent<IEditableTextProps, IEdi
return multiline ? (
<textarea ref={this.refHandlers.input} {...props} />
) : (
<input ref={this.refHandlers.input} type="text" {...props} />
<input ref={this.refHandlers.input} type={type} {...props} />
);
}

Expand Down