1
0
mirror of https://github.com/ianstormtaylor/slate.git synced 2025-08-16 04:04:06 +02:00

fix React warnings on renderMark, renderBlock, renderDecoration (#2974)

* fix React warnings on renderMark, renderBlock, renderDecoration

* included decorateNode and relocated code into constants in EventHandler

* Put decorateNode and render handlers into a seperate file.

* fix indentation

* overlooked indentation.
This commit is contained in:
Yue
2019-08-23 04:50:32 +12:00
committed by Ian Storm Taylor
parent 1f673a9b43
commit 6e56932ee4
2 changed files with 29 additions and 0 deletions

View File

@@ -9,6 +9,7 @@ import omit from 'lodash/omit'
import { Editor as Controller } from 'slate'
import EVENT_HANDLERS from '../constants/event-handlers'
import OTHER_HANDLERS from '../constants/other-handlers'
import Content from './content'
import ReactPlugin from '../plugins/react'
@@ -54,6 +55,10 @@ class Editor extends React.Component {
obj[handler] = Types.func
return obj
}, {}),
...OTHER_HANDLERS.reduce((obj, handler) => {
obj[handler] = Types.func
return obj
}, {}),
}
/**

View File

@@ -0,0 +1,24 @@
/**
* Other handlers used by Slate plugins.
*
* @type {Array}
*/
const OTHER_HANDLERS = [
'decorateNode',
'renderAnnotation',
'renderBlock',
'renderDecoration',
'renderDocument',
'renderEditor',
'renderInline',
'renderMark',
]
/**
* Export.
*
* @type {Array}
*/
export default OTHER_HANDLERS