1
0
mirror of https://github.com/ianstormtaylor/slate.git synced 2025-02-13 11:44:55 +01:00
Irwan Fario Subastian 7f91d0b557 Inline Void block cursor (#1886)
* add contentEditable=false to void block wrapper

* put contentEditable fals on inline void

fix from https://github.com/ianstormtaylor/slate/pull/1734 works for block but inline void have a cursor which shouldn’t be there as typing inside inline void won’t work. so only removing contentEditable on blocks but not inline

* update test
2018-06-10 16:59:16 -07:00

59 lines
1.2 KiB
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 = {
renderNode,
}
export const value = (
<value>
<document>
<paragraph>
<emoji />
</paragraph>
</document>
</value>
)
export const output = `
<div data-slate-editor="true" contenteditable="true" role="textbox">
<div style="position:relative">
<span>
<span>
<span data-slate-zero-width="z">&#x200B;</span>
</span>
</span>
<span data-slate-void="true" contenteditable="false">
<span data-slate-spacer="true" style="height:0;color:transparent;outline:none;position:absolute">
<span>
<span>
<span data-slate-zero-width="z">&#x200B;</span>
</span>
</span>
</span>
<span contenteditable="false">
<img>
</span>
</span>
<span>
<span>
<span data-slate-zero-width="z">&#x200B;</span>
</span>
</span>
</div>
</div>
`.trim()