How to use the megadraft.editorStateToJSON function in megadraft

To help you get started, we’ve selected a few megadraft examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github udacityalumni / udacity-alumni-fe / app / src / containers / CmsEditorContainer / index.js View on Github external
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);
    }
github udacityalumni / udacity-alumni-fe / app / src / containers / CmsEditorContainer / index.js View on Github external
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() {