Switch readonly values to readonly inputs
It fits better in the layout after all.
This commit is contained in:
@@ -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) {
|
||||||
|
|||||||
Reference in New Issue
Block a user