Merge branch 'development' into cherry-picking-continue-after-conflicts

This commit is contained in:
tidy-dev 2021-03-02 06:09:20 -05:00
commit adac27d087
3 changed files with 19 additions and 0 deletions

View file

@ -87,6 +87,7 @@ const imageFileExtensions = new Set([
'.ico',
'.webp',
'.bmp',
'.avif',
])
/**
@ -299,6 +300,9 @@ function getMediaType(extension: string) {
if (extension === '.bmp') {
return 'image/bmp'
}
if (extension === '.avif') {
return 'image/avif'
}
// fallback value as per the spec
return 'text/plain'

View file

@ -121,6 +121,8 @@ export class CommitMessage extends React.Component<
private descriptionTextArea: HTMLTextAreaElement | null = null
private descriptionTextAreaScrollDebounceId: number | null = null
private coAuthorInputRef = React.createRef<AuthorInput>()
public constructor(props: ICommitMessageProps) {
super(props)
const { commitMessage } = this.props
@ -180,6 +182,14 @@ export class CommitMessage extends React.Component<
if (this.props.focusCommitMessage) {
this.focusSummary()
} else if (
prevProps.showCoAuthoredBy === false &&
this.isCoAuthorInputVisible &&
// The co-author input could be also shown when switching between repos,
// but in that case we don't want to give the focus to the input.
prevProps.repository.id === this.props.repository.id
) {
this.coAuthorInputRef.current?.focus()
}
}
@ -344,6 +354,7 @@ export class CommitMessage extends React.Component<
return (
<AuthorInput
ref={this.coAuthorInputRef}
onAuthorsUpdated={this.onCoAuthorsUpdated}
authors={this.props.coAuthors}
autoCompleteProvider={autocompletionProvider}

View file

@ -467,6 +467,10 @@ export class AuthorInput extends React.Component<IAuthorInputProps, {}> {
this.state = {}
}
public focus() {
this.editor?.focus()
}
public componentWillUnmount() {
// Sometimes the completion box seems to fail to register
// the blur event and close. It's hard to reproduce so