Switch readonly values to readonly inputs

It fits better in the layout after all.
This commit is contained in:
Ingvar Stepanyan
2022-01-17 20:19:53 +00:00
parent 473e41f423
commit e6cb4fc269

View File

@@ -126,7 +126,7 @@ export class Widget extends Component {
break; break;
} }
case 'text': case 'text':
inputElem = readonly ? value : h(EditableInput, attrs); inputElem = h(EditableInput, attrs);
break; break;
case 'toggle': { case 'toggle': {
inputElem = h('input', { inputElem = h('input', {
@@ -182,7 +182,7 @@ class EditableInput extends Component {
ref = createRef(); ref = createRef();
shouldComponentUpdate() { shouldComponentUpdate() {
return document.activeElement !== this.ref.current; return this.props.readonly || document.activeElement !== this.ref.current;
} }
render(props) { render(props) {