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