|
|
|
@ -113,18 +113,21 @@ class Carbon extends React.PureComponent {
|
|
|
|
|
onSelectionChange = changes => {
|
|
|
|
|
if (this.state.selectionAt) {
|
|
|
|
|
const css = [
|
|
|
|
|
`font-weight: ${changes.bold ? 'bold' : 'initial'}`,
|
|
|
|
|
`font-style: ${changes.italics ? 'italic' : 'initial'}`,
|
|
|
|
|
`text-decoration: ${changes.underline ? 'underline' : 'initial'}`,
|
|
|
|
|
changes.bold && `font-weight: ${changes.bold ? 'bold' : 'initial'}`,
|
|
|
|
|
changes.italics && `font-style: ${changes.italics ? 'italic' : 'initial'}`,
|
|
|
|
|
changes.underline && `text-decoration: ${changes.underline ? 'underline' : 'initial'}`,
|
|
|
|
|
changes.color && `color: ${changes.color} !important`
|
|
|
|
|
]
|
|
|
|
|
.filter(Boolean)
|
|
|
|
|
.join('; ')
|
|
|
|
|
this.props.editorRef.current.editor.doc.markText(
|
|
|
|
|
this.state.selectionAt.from,
|
|
|
|
|
this.state.selectionAt.to,
|
|
|
|
|
{ css }
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
if (css) {
|
|
|
|
|
this.props.editorRef.current.editor.doc.markText(
|
|
|
|
|
this.state.selectionAt.from,
|
|
|
|
|
this.state.selectionAt.to,
|
|
|
|
|
{ css }
|
|
|
|
|
)
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|