field-plugin icon indicating copy to clipboard operation
field-plugin copied to clipboard

Visual Editor does not detect changes in custom field plugin

Open RoettingerJ opened this issue 1 year ago • 6 comments

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:

  1. Create a blok with a custom field plugin
  2. Add the blok to a story
  3. Change a value in the field plugin
  4. "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

RoettingerJ avatar Jan 17 '24 14:01 RoettingerJ