mirror of
https://github.com/ianstormtaylor/slate.git
synced 2025-03-10 00:10:18 +01:00
* rename `kind` to `object` for clarity * add deprecation warning for direct access * add deprecation warning for node creation
46 lines
778 B
JavaScript
46 lines
778 B
JavaScript
|
|
/** @jsx h */
|
|
|
|
import h from '../helpers/h'
|
|
|
|
export const config = {
|
|
rules: [
|
|
{
|
|
deserialize(el, next) {
|
|
switch (el.tagName.toLowerCase()) {
|
|
case 'p': {
|
|
return {
|
|
object: 'block',
|
|
type: 'paragraph',
|
|
nodes: next(el.childNodes),
|
|
}
|
|
}
|
|
case 'blockquote': {
|
|
return {
|
|
object: 'block',
|
|
type: 'quote',
|
|
nodes: next(el.childNodes),
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
]
|
|
}
|
|
|
|
export const input = `
|
|
<blockquote><p>one</p></blockquote>
|
|
`.trim()
|
|
|
|
export const output = (
|
|
<value>
|
|
<document>
|
|
<quote>
|
|
<paragraph>
|
|
one
|
|
</paragraph>
|
|
</quote>
|
|
</document>
|
|
</value>
|
|
)
|