Refactor text input to not render as disabled but behave like that
[MAILPOET-2599]
This commit is contained in:
committed by
Veljko V
parent
631deeb669
commit
ab3267bb6d
@@ -1,4 +1,4 @@
|
|||||||
import React from 'react';
|
import React, { useRef } from 'react';
|
||||||
import PropTypes from 'prop-types';
|
import PropTypes from 'prop-types';
|
||||||
import ParagraphEdit from './paragraph_edit.jsx';
|
import ParagraphEdit from './paragraph_edit.jsx';
|
||||||
import formatLabel from './label_formatter.jsx';
|
import formatLabel from './label_formatter.jsx';
|
||||||
@@ -11,6 +11,7 @@ const TextInputEdit = ({
|
|||||||
mandatory,
|
mandatory,
|
||||||
styles,
|
styles,
|
||||||
}) => {
|
}) => {
|
||||||
|
const input = useRef(null);
|
||||||
const id = `${name}_${Math.random().toString(36).substring(2, 15)}`;
|
const id = `${name}_${Math.random().toString(36).substring(2, 15)}`;
|
||||||
|
|
||||||
const labelStyles = {
|
const labelStyles = {
|
||||||
@@ -34,13 +35,14 @@ const TextInputEdit = ({
|
|||||||
const getTextInput = (placeholder) => (
|
const getTextInput = (placeholder) => (
|
||||||
<input
|
<input
|
||||||
id={id}
|
id={id}
|
||||||
|
ref={input}
|
||||||
className="mailpoet_text"
|
className="mailpoet_text"
|
||||||
type={name === 'email' ? 'email' : 'text'}
|
type={name === 'email' ? 'email' : 'text'}
|
||||||
name={name}
|
name={name}
|
||||||
disabled
|
|
||||||
placeholder={placeholder}
|
placeholder={placeholder}
|
||||||
data-automation-id={`editor_${name}_input`}
|
data-automation-id={`editor_${name}_input`}
|
||||||
style={inputStyles}
|
style={inputStyles}
|
||||||
|
onFocus={() => input.current.blur()}
|
||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user