11// @flow
22
33import React , { Component } from 'react'
4+ import type { Node } from 'react'
45import { withPluginContext , constants } from '@djsp/core'
56import type { PluginProps } from '@djsp/core'
67import { ContentBlock , EditorState , Modifier , SelectionState } from 'draft-js'
@@ -13,7 +14,7 @@ const _BlockChildren = ({
1314 editorState,
1415 setEditorState,
1516 ...props
16- } : Object ) => {
17+ } : Object ) : Node => {
1718 const blockKey = props . block . getKey ( )
1819 const { children, focusBlock } = props . blockProps
1920 const selection = editorState . getSelection ( )
@@ -43,7 +44,7 @@ type Props = PluginProps & {
4344// Set selection of editor to next/previous block
4445const setSelection = (
4546 editorState : EditorState ,
46- setEditorState : EditorState ,
47+ setEditorState : ( editorState : EditorState ) => void ,
4748 newActiveBlock : ContentBlock
4849) : void => {
4950 // TODO verify that always a key-0-0 exists
@@ -91,7 +92,7 @@ class AtomicBlockPlugin extends Component<Props> {
9192 this . unregister ( )
9293 }
9394
94- handleKeyCommand = ( command , editorState ) => {
95+ handleKeyCommand = ( command : string , editorState : EditorState ) : DraftHandleValue => {
9596 const { setEditorState } = this . props
9697
9798 let contentState = editorState . getCurrentContent ( )
@@ -189,7 +190,7 @@ class AtomicBlockPlugin extends Component<Props> {
189190 )
190191 }
191192
192- handleReturn = ( event , editorState ) => {
193+ handleReturn = ( event : SyntheticKeyboardEvent < * > , editorState : EditorState ) : DraftHandleValue => {
193194 const { setEditorState } = this . props
194195 const selection = editorState . getSelection ( )
195196
@@ -205,7 +206,7 @@ class AtomicBlockPlugin extends Component<Props> {
205206 return constants . NOT_HANDLED
206207 }
207208
208- blockRendererFn = block => {
209+ blockRendererFn = ( block : ContentBlock ) : ? Object => {
209210 const { type, children, editorState } = this . props
210211
211212 const content = editorState . getCurrentContent ( )
0 commit comments