Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
const clone = {};
fieldsToSave.forEach((field) => {
clone[field] = data[field];
});
itemData = clone;
} else {
// Use the whole object.
itemData = data;
}
const nextData = Object.assign({}, itemData, {
id,
label,
});
const nextState = DraftUtils.createEntity(
editorState,
type,
nextData,
nextData.label,
entityMutability,
);
onUpdate(nextState);
}
} else if (display in data && data[display]) {
label = data[display];
}
if (label === undefined) {
label = data[pkName];
}
entityMutability = 'IMMUTABLE';
}
const nextData = {
id,
label,
content_type,
};
const nextState = DraftUtils.createEntity(
editorState,
type,
nextData,
nextData.label,
entityMutability,
);
onUpdate(nextState);
}
onSelected(id, data) {
const { editorState, options, onUpdate } = this.props;
const fieldName = options.display;
const nextData = {
id: id,
label: data[fieldName],
contentType: options.contentType,
};
const nextState = DraftUtils.createEntity(editorState, options.type, nextData, nextData.label, 'IMMUTABLE');
onUpdate(nextState);
}