diff --git a/components/Carbon.js b/components/Carbon.js index 5b82e4c..d9b1ac1 100644 --- a/components/Carbon.js +++ b/components/Carbon.js @@ -34,6 +34,15 @@ function searchLanguage(l) { } function noop() {} +function getUnderline(underline) { + switch (underline) { + case 1: + return 'underline' + case 2: + return `${COLORS.RED} wavy underline; text-decoration-skip-ink: none` + } + return 'initial' +} class Carbon extends React.PureComponent { static defaultProps = { @@ -115,8 +124,7 @@ class Carbon extends React.PureComponent { const css = [ changes.bold != null && `font-weight: ${changes.bold ? 'bold' : 'initial'}`, changes.italics != null && `font-style: ${changes.italics ? 'italic' : 'initial'}`, - changes.underline != null && - `text-decoration: ${changes.underline ? 'underline' : 'initial'}`, + changes.underline != null && `text-decoration: ${getUnderline(changes.underline)}`, changes.color != null && `color: ${changes.color} !important`, ] .filter(Boolean) diff --git a/components/SelectionEditor.js b/components/SelectionEditor.js index 0781f0d..ca16f72 100644 --- a/components/SelectionEditor.js +++ b/components/SelectionEditor.js @@ -37,7 +37,7 @@ function reducer(state, action) { case 'UNDERLINE': { return { ...state, - underline: !state.underline, + underline: Number(state.underline + 1) % 3, } } case 'COLOR': {