* Return true if selection is inside a code block * * @param {Draft.EditorState} editorState * @return {Boolean}
(editorState)
| 5 | * @return {Boolean} |
| 6 | */ |
| 7 | function hasSelectionInBlock(editorState) { |
| 8 | var selection = editorState.getSelection(); |
| 9 | var contentState = editorState.getCurrentContent(); |
| 10 | var startKey = selection.getStartKey(); |
| 11 | var currentBlock = contentState.getBlockForKey(startKey); |
| 12 | |
| 13 | return currentBlock.getType() === 'code-block'; |
| 14 | } |
| 15 | |
| 16 | module.exports = hasSelectionInBlock; |
no outgoing calls
no test coverage detected