1
0
mirror of https://github.com/ianstormtaylor/slate.git synced 2025-02-13 11:44:55 +01:00
2018-10-09 18:43:47 -07:00

44 lines
698 B
JavaScript

/** @jsx h */
import React from 'react'
import h from '../../helpers/h'
function Code(props) {
return React.createElement(
'pre',
props.attributes,
React.createElement('code', {}, props.children)
)
}
export const props = {
renderNode(p, editor, next) {
switch (p.node.type) {
case 'code':
return Code(p)
default:
return next()
}
},
}
export const value = (
<value>
<document>
<code>word</code>
</document>
</value>
)
export const output = `
<div data-slate-editor="true" contenteditable="true" role="textbox">
<pre>
<code>
<span>
<span>word</span>
</span>
</code>
</pre>
</div>
`.trim()