mirror of
https://github.com/ianstormtaylor/slate.git
synced 2025-03-06 05:49:47 +01:00
* Add Prettier, with basic config and ESLint integration * Apply Prettier to all files using `yarn lint --fix` * Tell Prettier to ignore an empty text in a test output. * Run Prettier on JS files not handled by ESLint, and lint them too
31 lines
533 B
JavaScript
31 lines
533 B
JavaScript
/** @jsx h */
|
|
|
|
import React from 'react'
|
|
import h from '../helpers/h'
|
|
|
|
export const rules = [
|
|
{
|
|
serialize(obj, children) {
|
|
if (obj.object == 'block' && obj.type == 'paragraph') {
|
|
return React.createElement(
|
|
'p',
|
|
{ 'data-thing': obj.data.get('thing') },
|
|
children
|
|
)
|
|
}
|
|
},
|
|
},
|
|
]
|
|
|
|
export const input = (
|
|
<value>
|
|
<document>
|
|
<paragraph thing="value">one</paragraph>
|
|
</document>
|
|
</value>
|
|
)
|
|
|
|
export const output = `
|
|
<p data-thing="value">one</p>
|
|
`.trim()
|