(currentValue.length);
+ const [localAttrValue, setAttributeValue] = useState(currentValue);
useEffect(() => {
const textArea = ref?.current?.resizableTextArea?.textArea;
@@ -39,13 +41,28 @@ function renderInputElement(parameters: InputElementParameters): JSX.Element {
}
}, [currentValue]);
+ useEffect(() => {
+ // attribute value updated from inside the app (for example undo/redo)
+ if (currentValue !== localAttrValue) {
+ setAttributeValue(currentValue);
+ }
+ }, [currentValue]);
+
+ useEffect(() => {
+ // wrap to internal use effect to avoid issues
+ // with chinese keyboard
+ if (localAttrValue !== currentValue) {
+ onChange(localAttrValue);
+ }
+ }, [localAttrValue]);
+
const renderCheckbox = (): JSX.Element => (
<>
Checkbox:
onChange(event.target.checked ? 'true' : 'false')}
- checked={currentValue === 'true'}
+ onChange={(event: CheckboxChangeEvent): void => setAttributeValue(event.target.checked ? 'true' : 'false')}
+ checked={localAttrValue === 'true'}
/>
>
@@ -56,9 +73,9 @@ function renderInputElement(parameters: InputElementParameters): JSX.Element {
Values: