Let’s say I have a title and a description field and I’d like to display the values inputted on these fields on a custom widget and update it accordingly if these fields values change. Is this possible?
In other words, do I have access to the editor’s form values on a custom widget?
EDIT:
I figured out how to access these fields values, and now I’m trying to discover how to change my custom widget on author and title field change.
This is what I have so far:
const Controller = window.createClass({
renderWrapper(title, author) {
const titleElement = window.h('div', null, title);
const authorElement = window.h('div', null, author);
return window.h('div', null, [titleElement, authorElement]);
},
render() {
const entry = JSON.parse(JSON.stringify(this.props.entry));
return window.h(
'div',
null,
this.renderWrapper(entry.data.title, entry.data.author)
);
},
});
window.CMS.registerWidget('customField', Controller);