Skip to content

Commit

Permalink
Merge pull request #12850 from influxdata/fix/note-auto-focus
Browse files Browse the repository at this point in the history
ensure editor is focused when editing/creating note
  • Loading branch information
ischolten authored Mar 22, 2019
2 parents 9277a76 + 433f99f commit 6840050
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
### UI Improvements

1. [12782](https://github.com/influxdata/influxdb/pull/12782): Move bucket selection in the query builder to the first card in the list
1. [12850](https://github.com/influxdata/influxdb/pull/12850): Ensure editor is automatically focused in note editor

## v2.0.0-alpha.6 [2019-03-15]

Expand Down
7 changes: 6 additions & 1 deletion ui/src/dashboards/components/NoteEditorText.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// Libraries
import React, {PureComponent} from 'react'
import {Controlled as ReactCodeMirror} from 'react-codemirror2'
import {Controlled as ReactCodeMirror, IInstance} from 'react-codemirror2'

// Utils
import {humanizeNote} from 'src/dashboards/utils/notes'
Expand Down Expand Up @@ -35,10 +35,15 @@ class NoteEditorText extends PureComponent<Props, {}> {
options={OPTIONS}
onBeforeChange={this.handleChange}
onTouchStart={noOp}
editorDidMount={this.handleMount}
/>
)
}

private handleMount = (instance: IInstance) => {
instance.focus()
}

private handleChange = (_, __, note: string) => {
const {onChangeNote} = this.props

Expand Down

0 comments on commit 6840050

Please sign in to comment.