1
0
mirror of https://github.com/ianstormtaylor/slate.git synced 2025-02-13 11:44:55 +01:00
Jinxuan Zhu 6e6e9cf710 Fix spell check bug (#1753)
* Fix spell check bug by add data-text:true

* Fix spell check bug by spell check add length to a leaf

* Fix tests to use data-text:true for marks

* Rename data-text to data-slate-leaf; Remove setRef; unlift attributes in leaf

* Update examples with data-*

* Add attributes to document

* Fix renderMark in all documents

* Prettier markdown
2018-04-27 14:06:24 -07:00

42 lines
755 B
JavaScript

/** @jsx h */
import React from 'react'
import h from '../../helpers/h'
function Bold(props) {
return React.createElement('strong', { ...props.attributes }, props.children)
}
function renderMark(props) {
switch (props.mark.type) {
case 'bold':
return Bold(props)
}
}
export const props = {
renderMark,
}
export const value = (
<value>
<document>
<paragraph>
one<b>two</b>three
</paragraph>
</document>
</value>
)
export const output = `
<div data-slate-editor="true" contenteditable="true" role="textbox">
<div style="position:relative">
<span>
<span>one</span>
<span><strong data-slate-leaf="true">two</strong></span>
<span>three</span>
</span>
</div>
</div>
`.trim()