const isValidId = id => !isNaN(parseInt(id, 10))
// Loop to update each block after the inserted li nextBlocks.map((block, index) => { const previousContent = index === 0 ? this.getEditorState() .getCurrentContent() .getBlockForKey(this.getCurrentAnchorKey()) : newEditorState.getCurrentContent().getBlockBefore(block.getKey()); // Check if there was an li before the position so we update the entire list bullets const number = previousContent ? parseInt(previousContent.getText().split('.')[0], 10) : 0; liNumber = isNaN(number) ? 1 : number + 1; const nextBlockText = index === 0 ? `${liNumber}. ` : nextBlocks.get(index - 1).getText(); // Update the current block const newBlock = createNewBlock(nextBlockText, 'block-list', block.getKey()); // Update the contentState const newContentState = this.createNewContentStateFromBlock( newBlock, newEditorState.getCurrentContent(), ); newEditorState = EditorState.push(newEditorState, newContentState); });
if (validationValue === 'json') { try { if (isObject(value) || isBoolean(value) || isNumber(value) || isArray(value) || isNaN(value) || isNull(value)) { value = JSON.parse(JSON.stringify(value)); } else {