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:
@@ -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
|
||||
}, {}),
|
||||
}
|
||||
|
||||
/**
|
||||
|
24
packages/slate-react/src/constants/other-handlers.js
Normal file
24
packages/slate-react/src/constants/other-handlers.js
Normal 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
|
Reference in New Issue
Block a user