From 14e02b1c6795ea069c9b9199a9162839cf094ac8 Mon Sep 17 00:00:00 2001 From: Ian Storm Taylor Date: Wed, 6 Jul 2016 14:48:40 -0700 Subject: [PATCH] fix renderers in core plugin --- lib/plugins/core.js | 35 +++++++++++++++++++++++++++++------ 1 file changed, 29 insertions(+), 6 deletions(-) diff --git a/lib/plugins/core.js b/lib/plugins/core.js index 32e6a6de2..252679a3a 100644 --- a/lib/plugins/core.js +++ b/lib/plugins/core.js @@ -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 =>
{props.children}
+ +/** + * Default inline renderer. + * + * @type {Component} + */ + +const DEFAULT_INLINE = props => {props.children} + +/** + * 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 `
` or `` 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) =>
{props.children}
- : (props) => {props.children} + ? 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 } }