1
0
mirror of https://github.com/ianstormtaylor/slate.git synced 2025-07-31 20:40:19 +02:00

fix renderers in core plugin

This commit is contained in:
Ian Storm Taylor
2016-07-06 14:48:40 -07:00
parent de4afd38b1
commit 14e02b1c67

View File

@@ -4,6 +4,28 @@ import keycode from 'keycode'
import { isCommand, isCtrl, isWindowsCommand, isWord } from '../utils/event'
import { IS_WINDOWS, IS_MAC } from '../utils/environment'
/**
* Default block renderer.
*/
const DEFAULT_BLOCK = props => <div>{props.children}</div>
/**
* Default inline renderer.
*
* @type {Component}
*/
const DEFAULT_INLINE = props => <span>{props.children}</span>
/**
* Default mark renderer.
*
* @type {Object}
*/
const DEFAULT_MARK = {}
/**
* Export.
*/
@@ -121,7 +143,7 @@ export default {
},
/**
* The core `onPaste` handler.
* The core `onPaste` handler, which treats everything as plain text.
*
* @param {Event} e
* @param {Object} paste
@@ -146,7 +168,8 @@ export default {
},
/**
* Default `node` renderer.
* The core `node` renderer, which uses plain `<div>` or `<span>` depending on
* what kind of node it is.
*
* @param {Node} node
* @return {Component} component
@@ -154,19 +177,19 @@ export default {
renderNode(node) {
return node.kind == 'block'
? (props) => <div>{props.children}</div>
: (props) => <span>{props.children}</span>
? DEFAULT_BLOCK
: DEFAULT_INLINE
},
/**
* Default `mark` renderer.
* The core `mark` renderer, with no styles.
*
* @param {Mark} mark
* @return {Object} style
*/
renderMark(mark) {
return {}
return DEFAULT_MARK
}
}