forked from kaivi/riek
-
Notifications
You must be signed in to change notification settings - Fork 10
Open
Description
When using this:
<RIETextArea
value={ this.state.contents }
change={ this.editContents }
propName='contents'
validate={ _.isString }
rows={ 10 }
cols={ 60 }
/>
And then creating the payload to be sent to the API:
async editContents (updatedText) {
console.log('Sending updated contents:', updatedText);
const payload = [{ op: 'replace', path: '/contents', value: updatedText }];
The JSON that is sent out is not as expected.
Expected:
[
{
op: "replace",
path: "/contents",
value: "The updated text from the textarea element"
}
]
Actual:
[
{
op: "replace",
path: "/contents",
value: {
contents: "The updated text from the textarea element"
}
]
If you remove the propName from RIETextArea, it gives an error. Is there some way to strip the { contents: ... } from around the actual data without doing some manual Object.keys() stuff when you want to have multiple fields editable? Of course if there is just one, using eg. updatedText.contents works.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels