mirror of
https://github.com/ianstormtaylor/slate.git
synced 2025-03-10 08:28:36 +01:00
36 lines
601 B
JavaScript
36 lines
601 B
JavaScript
|
|
||
|
/** @jsx h */
|
||
|
|
||
|
import React from 'react'
|
||
|
import h from '../../../helpers/h'
|
||
|
|
||
|
export const rules = [
|
||
|
{
|
||
|
serialize(obj, children) {
|
||
|
if (obj.kind == 'block' && obj.type == 'paragraph') {
|
||
|
return React.createElement('p', {}, children)
|
||
|
}
|
||
|
|
||
|
if (obj.kind == 'inline' && obj.type == 'link') {
|
||
|
return React.createElement('a', {}, children)
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
]
|
||
|
|
||
|
export const input = (
|
||
|
<state>
|
||
|
<document>
|
||
|
<paragraph>
|
||
|
<link>
|
||
|
one
|
||
|
</link>
|
||
|
</paragraph>
|
||
|
</document>
|
||
|
</state>
|
||
|
)
|
||
|
|
||
|
export const output = `
|
||
|
<p><a>one</a></p>
|
||
|
`.trim()
|