Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
handleSubmit() {
const {
action,
editorTitle,
editorState,
modal,
} = this.props;
const json = editorStateToJSON(editorState);
const blockArray = convertFromRaw(JSON.parse(json));
const content = stateToMarkdown(blockArray);
const article = inputToArticle({
json,
content,
title: editorTitle,
status: modal.status,
spotlighted: modal.spotlighted,
tags: modal.selectedTags,
feature_image: modal.featureImage || '',
});
if (action && action === 'edit') {
this.handleUpdateArticleSubmission(article);
} else {
this.handleNewArticleSubmission(article);
}
handlePreviewArticle() {
const {
editorState,
editorTitle,
actions,
} = this.props;
const rawState = editorStateToJSON(editorState);
const blockArray = convertFromRaw(JSON.parse(rawState));
const markdown = stateToMarkdown(blockArray);
actions.cmsSetPreviewState({ markdown, title: editorTitle });
}
handleClosePreview() {