@ant-design/icons#EnterOutlined JavaScript Examples

The following examples show how to use @ant-design/icons#EnterOutlined. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: HtxTextBox.js    From label-studio-frontend with Apache License 2.0 5 votes vote down vote up
renderEdit() {
    const { className = "", rows = 1, onlyEdit, name, onFocus, onChange, ...props } = this.props;
    const { height, value } = this.state;

    const inputProps = {
      name,
      className: "ant-input " + styles.input,
      style: height ? { height } : null,
      autoFocus: true,
      ref: this.inputRef,
      value,
      onBlur: isFF(FF_DEV_1566) ? ()=>{
        onChange(this.state.value);
      } : this.save,
      onFocus,
      onChange: e => {
        this.setValue(e.target.value);
        this.updateHeight();
      },
      onKeyDown: e => {
        const { key, shiftKey } = e;

        if (key === "Enter") {
          // for multiline textarea save only by shift+enter
          if (+rows === 1 || shiftKey) {
            e.preventDefault();
            e.stopPropagation();
            this.save();
          }
        } else if (key === "Escape") {
          this.cancel();
        } else if (isFF(FF_DEV_1566) && key === "Tab") {
          this.setEditing(false);
        }
      },
    };

    this.updateHeight();

    return (
      <Paragraph {...props} className={className + " ant-typography-edit-content " + styles.editing}>
        {rows > 1 ? <textarea {...inputProps} /> : <input {...inputProps} />}
        {!onlyEdit && (
          <Tooltip title="Save: [shift+enter]">
            <EnterOutlined className={"ant-typography-edit-content-confirm " + styles.enter} onClick={this.save} />
          </Tooltip>
        )}
      </Paragraph>
    );
  }