Skip to content

Commit

Permalink
Added humanReadable boolean to editorStateToJSON
Browse files Browse the repository at this point in the history
  • Loading branch information
Mark Wilkinson authored and vitorhugomattos committed Oct 4, 2022
1 parent df439de commit b4dd12f
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,10 @@ import {

import defaultDecorator from "./decorators/defaultDecorator";

export function editorStateToJSON(editorState) {
export function editorStateToJSON(editorState, humanReadable = true) {
if (editorState) {
const content = editorState.getCurrentContent();
return JSON.stringify(convertToRaw(content), null, 2);
return JSON.stringify(convertToRaw(content), null, humanReadable ? 2 : 0);
}
}

Expand Down

0 comments on commit b4dd12f

Please sign in to comment.