Skip to content

Commit

Permalink
fix(plugins/plugin-client-common): double clicking on Commentary ente…
Browse files Browse the repository at this point in the history
…rs edit mode, even for readOnly clients

part of #7977
  • Loading branch information
starpit committed Sep 13, 2021
1 parent 831a5f5 commit 2d351f6
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
*/

import React from 'react'
import { CommentaryResponse, REPL, i18n } from '@kui-shell/core'
import { CommentaryResponse, REPL, i18n, isReadOnlyClient } from '@kui-shell/core'

import Card from '../spi/Card'
import Button from '../spi/Button'
Expand Down Expand Up @@ -169,7 +169,7 @@ export default class Commentary extends React.PureComponent<Props, State> {

private card() {
return (
<span className="kui--commentary-card" onDoubleClick={this._setEdit}>
<span className="kui--commentary-card" onDoubleClick={isReadOnlyClient() ? undefined : this._setEdit}>
<Card
{...this.props}
data-is-editing={this.state.isEdit || undefined}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,11 @@ describe('Link blocks', function(this: Common.ISuite) {

it('paste the link to a commentary block, and expect the commentary block show the status of ls', async () => {
try {
await CLI.command('#', this.app).then(ReplExpect.ok)
const res = await CLI.command('#', this.app).then(ReplExpect.ok)

await this.app.client
.$(`${Selectors.OUTPUT_N(res.count)} ${Selectors.COMMENTARY_EDITOR}`)
.then(_ => _.waitForDisplayed({ timeout: CLI.waitTimeout }))

await this.app.client.execute(() => document.execCommand('paste'))

Expand Down

0 comments on commit 2d351f6

Please sign in to comment.