mirror of
https://github.com/ianstormtaylor/slate.git
synced 2025-02-13 11:44:55 +01:00
This fixes https://github.com/ianstormtaylor/slate/issues/2231 where a rogue empty line appears before an inline block.
60 lines
953 B
JavaScript
60 lines
953 B
JavaScript
/** @jsx h */
|
|
|
|
import React from 'react'
|
|
import h from '../../helpers/h'
|
|
|
|
function Emoji(props) {
|
|
return React.createElement('img', props.attributes)
|
|
}
|
|
|
|
function renderNode(props) {
|
|
switch (props.node.type) {
|
|
case 'emoji':
|
|
return Emoji(props)
|
|
}
|
|
}
|
|
|
|
export const props = {
|
|
readOnly: true,
|
|
renderNode,
|
|
schema: {
|
|
inlines: {
|
|
emoji: {
|
|
isVoid: true,
|
|
},
|
|
},
|
|
},
|
|
}
|
|
|
|
export const value = (
|
|
<value>
|
|
<document>
|
|
<paragraph>
|
|
<emoji />
|
|
</paragraph>
|
|
</document>
|
|
</value>
|
|
)
|
|
|
|
export const output = `
|
|
<div data-slate-editor="true">
|
|
<div style="position:relative">
|
|
<span>
|
|
<span>
|
|
<span data-slate-zero-width="z"></span>
|
|
</span>
|
|
</span>
|
|
<span data-slate-void="true">
|
|
<span>
|
|
<img>
|
|
</span>
|
|
</span>
|
|
<span>
|
|
<span>
|
|
<span data-slate-zero-width="n"></span>
|
|
</span>
|
|
</span>
|
|
</div>
|
|
</div>
|
|
`.trim()
|