1
0
mirror of https://github.com/ianstormtaylor/slate.git synced 2025-08-30 10:29:48 +02:00

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
This commit is contained in:
Jinxuan Zhu
2018-04-27 17:06:24 -04:00
committed by Ian Storm Taylor
parent 9b39a89f20
commit 6e6e9cf710
16 changed files with 101 additions and 59 deletions

View File

@@ -268,13 +268,14 @@ class App extends React.Component {
// Add a `renderMark` method to render marks.
renderMark = props => {
switch (props.mark.type) {
const { mark, attributes } = props
switch (mark.type) {
case 'bold':
return <strong>{props.children}</strong>
return <strong {...{ attributes }}>{props.children}</strong>
case 'italic':
return <em>{props.children}</em>
return <em {...{ attributes }}>{props.children}</em>
case 'underline':
return <u>{props.children}</u>
return <u {...{ attributes }}>{props.children}</u>
}
}
}

View File

@@ -43,7 +43,7 @@ class App extends React.Component {
renderMark = props => {
switch (props.mark.type) {
case 'bold':
return <strong>{props.children}</strong>
return <strong {...{props.attributes}}>{props.children}</strong>
}
}
}