Skip to content

Commit fc9b1df

Browse files
committed
adapt GitHub to this new api
1 parent da93494 commit fc9b1df

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

browser-extension/src/lib/enhancers/github.ts

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ export class GitHubAddCommentEnhancer implements CommentEnhancer<GitHubAddCommen
2929
return [...GITHUB_SPOT_TYPES]
3030
}
3131

32-
tryToEnhance(textarea: HTMLTextAreaElement): [OverTypeInstance, GitHubAddCommentSpot] | null {
32+
tryToEnhance(_textarea: HTMLTextAreaElement): GitHubAddCommentSpot | null {
3333
// Only handle github.com domains TODO: identify GitHub Enterprise somehow
3434
if (window.location.hostname !== 'github.com') {
3535
return null
@@ -44,22 +44,22 @@ export class GitHubAddCommentEnhancer implements CommentEnhancer<GitHubAddCommen
4444
const [, owner, repo, numberStr] = match
4545
const slug = `${owner}/${repo}`
4646
const number = parseInt(numberStr!, 10)
47-
4847
const unique_key = `github.com:${slug}:${number}`
49-
50-
const spot: GitHubAddCommentSpot = {
48+
return {
5149
domain: 'github.com',
5250
number,
5351
slug,
5452
type: 'GH_PR_ADD_COMMENT',
5553
unique_key,
5654
}
57-
return [this.createOvertypeFor(textarea), spot]
5855
}
5956

60-
private createOvertypeFor(ghCommentBox: HTMLTextAreaElement): OverTypeInstance {
57+
prepareForFirstEnhancement(): void {
6158
OverType.setCodeHighlighter(hljsHighlighter)
62-
const overtypeContainer = this.modifyDOM(ghCommentBox)
59+
}
60+
61+
enhance(textArea: HTMLTextAreaElement, _spot: GitHubAddCommentSpot): OverTypeInstance {
62+
const overtypeContainer = this.modifyDOM(textArea)
6363
return new OverType(overtypeContainer, {
6464
autoResize: true,
6565
minHeight: '102px',

0 commit comments

Comments
 (0)