diff --git a/playground/index.jsx b/playground/index.jsx index b7750278..a792aba0 100644 --- a/playground/index.jsx +++ b/playground/index.jsx @@ -41,6 +41,10 @@ class Demo extends React.Component { console.log(this.state.editorState.toHTML()) } + logRAW = () => { + console.log(this.state.editorState.toRAW()) + } + render() { const { readOnly, editorState } = this.state @@ -50,6 +54,12 @@ class Demo extends React.Component {
{ } if (command === 'tab') { - const blockType = ContentUtils.getSelectionBlockType(editorState) if (blockType === 'code-block') { editor.setValue(ContentUtils.insertText(editorState, ' '.repeat(editor.editorProps.codeTabIndents))) return 'handled' + } else if (blockType === 'ordered-list-item' || blockType === 'unordered-list-item') { + const newEditorState = RichUtils.onTab( + event, + editorState, + 4, + ) + if (newEditorState !== editorState) { + editor.setValue(newEditorState) + } + return 'handled' } else if (blockType !== 'atomic' && allowIndent && cursorIsAtFirst) { editor.setValue(ContentUtils.increaseSelectionIndent(editorState)) return 'handled'