field-plugin
field-plugin copied to clipboard
Visual Editor does not detect changes in custom field plugin
Describe the bug I have following behavior with my custom field plugin: The Visual Editor does not detect changes if the content of the field plugin changes
Created a react field plugin that returns an object like {A:stringA, b:stringB}.
In the plugin the state will be stored with useState
const [value, setValue] = useState<>({A: '',B: ''})
every time the value changes the setContent function will be called via an useEffect
useEffect(() => {
actions?.setContent(value)
}, [value])
To Reproduce Steps to reproduce the behavior:
- Create a blok with a custom field plugin
- Add the blok to a story
- Change a value in the field plugin
- "Save" button keeps state - signaling that there is no change
Expected behavior "Save" button of Visual Editor should change to a different state - signaling that there are changes in the story