Skip to content

Commit

Permalink
fix: clicking on certain links in kubectl help result in odd behavior
Browse files Browse the repository at this point in the history
Fixes #4473
  • Loading branch information
starpit committed May 5, 2020
1 parent 8941dd0 commit 035894b
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,12 @@ export default class Markdown extends React.PureComponent<Props> {
? undefined
: async () => {
let file = props.href
if (props.href.charAt(0) === '#') {
if (props.href.startsWith('#kuiexec?command=')) {
const cmdline = decodeURIComponent(props.href.slice('#kuiexec?command='.length))
if (cmdline) {
return this.props.repl.pexec(cmdline)
}
} else if (props.href.charAt(0) === '#') {
const elt = this.props.tab.querySelector(
`[data-markdown-anchor="${this.anchorFrom(props.href.slice(1))}"]`
)
Expand Down
2 changes: 1 addition & 1 deletion plugins/plugin-kubectl/src/lib/util/help.ts
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ const renderHelpUnsafe = (
.map(_ =>
_.replace(
/"([^"]+)"/g,
(_, command) => `[${command}](kui://exec?command=${encodeURIComponent(command)} "Execute ${command}")`
(_, command) => `[${command}](#kuiexec?command=${encodeURIComponent(command)} "Execute ${command}")`
)
)
// .map(_ => ` - ${_}`)
Expand Down

0 comments on commit 035894b

Please sign in to comment.