mirror of
https://github.com/ianstormtaylor/slate.git
synced 2025-02-13 11:44:55 +01:00
* Reshape `Void` component. Add some cases where editor blur should be prevented. * Update tests.
52 lines
1.0 KiB
JavaScript
52 lines
1.0 KiB
JavaScript
/** @jsx h */
|
|
|
|
import React from 'react'
|
|
import h from '../../helpers/h'
|
|
|
|
export const schema = {
|
|
nodes: {
|
|
emoji: (props) => {
|
|
return (
|
|
React.createElement('img', props.attributes)
|
|
)
|
|
}
|
|
}
|
|
}
|
|
|
|
export const state = (
|
|
<state>
|
|
<document>
|
|
<paragraph>
|
|
<emoji />
|
|
</paragraph>
|
|
</document>
|
|
</state>
|
|
)
|
|
|
|
export const output = `
|
|
<div data-slate-editor="true" contenteditable="true" role="textbox">
|
|
<div style="position:relative">
|
|
<span>
|
|
<span>
|
|
<span data-slate-zero-width="true"> </span>
|
|
</span>
|
|
</span>
|
|
<span data-slate-void="true" draggable="true" contenteditable="false">
|
|
<span contenteditable="true" data-slate-spacer="true" style="height:0;color:transparent;outline:none">
|
|
<span>
|
|
<span></span>
|
|
</span>
|
|
</span>
|
|
<span>
|
|
<img>
|
|
</span>
|
|
</span>
|
|
<span>
|
|
<span>
|
|
<span data-slate-zero-width="true"> </span>
|
|
</span>
|
|
</span>
|
|
</div>
|
|
</div>
|
|
`.trim()
|