Skip to content

Commit

Permalink
fix(plugins/plugin-client-common): Markdown links should have a tooltip
Browse files Browse the repository at this point in the history
This PR also exports the Tooltip spi from plugin-client-common.

Fixes #6939
  • Loading branch information
starpit committed Feb 3, 2021
1 parent 78a4925 commit 011cf02
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 1 deletion.
Expand Up @@ -25,6 +25,7 @@ import { REPL, Tab as KuiTab, getPrimaryTabId } from '@kui-shell/core'
// GitHub Flavored Markdown plugin; see https://github.com/IBM/kui/issues/6563
import gfm from 'remark-gfm'

import Tooltip from '../spi/Tooltip'
import CodeSnippet from '../spi/CodeSnippet'
const SimpleEditor = React.lazy(() => import('./Editor/SimpleEditor'))

Expand Down Expand Up @@ -176,7 +177,11 @@ export default class Markdown extends React.PureComponent<Props> {
} else if (!isLocal && this.props.noExternalLinks) {
return <span className={this.props.className}>{props.href}</span>
} else {
return <a className="bx--link" {...props} target={target} onClick={onClick} />
return (
<Tooltip markdown={`### External Link\n#### ${props.href}\n\n\`Link will open in a separate window\``}>
<a className="bx--link" {...props} target={target} onClick={onClick} />
</Tooltip>
)
}
},
code: props => {
Expand Down
1 change: 1 addition & 0 deletions plugins/plugin-client-common/src/index.ts
Expand Up @@ -58,6 +58,7 @@ export { default as Button } from './components/spi/Button'
export { default as Card } from './components/spi/Card'
export { default as Popover } from './components/spi/Popover'
export { default as Tag } from './components/spi/Tag'
export { default as Tooltip } from './components/spi/Tooltip'

// Input components
export {
Expand Down
Expand Up @@ -48,6 +48,10 @@ $bgcolor: var(--color-base06);
color: var(--color-base02);
font-family: var(--font-sans-serif);
}

a[href] {
color: var(--color-base0F);
}
}

& > div {
Expand Down

0 comments on commit 011cf02

Please sign in to comment.