diff --git a/browser-extension/src/lib/enhancers/github/ghOptions.ts b/browser-extension/src/lib/enhancers/github/ghOptions.ts new file mode 100644 index 0000000..321389b --- /dev/null +++ b/browser-extension/src/lib/enhancers/github/ghOptions.ts @@ -0,0 +1,7 @@ +import type { Options } from 'overtype' + +export const commonGithubOptions: Options = { + autoResize: true, + lineHeight: 'var(--text-body-lineHeight-medium, 1.4285)', + padding: 'var(--base-size-16)', +} diff --git a/browser-extension/src/lib/enhancers/github/githubIssueAddComment.ts b/browser-extension/src/lib/enhancers/github/githubIssueAddComment.ts index bfdc02f..b279429 100644 --- a/browser-extension/src/lib/enhancers/github/githubIssueAddComment.ts +++ b/browser-extension/src/lib/enhancers/github/githubIssueAddComment.ts @@ -2,6 +2,7 @@ import OverType, { type OverTypeInstance } from 'overtype' import type { CommentEnhancer, CommentSpot } from '../../enhancer' import { logger } from '../../logger' import { modifyDOM } from '../modifyDOM' +import { commonGithubOptions } from './ghOptions' import { githubHighlighter } from './githubHighlighter' interface GitHubIssueAddCommentSpot extends CommentSpot { @@ -47,9 +48,8 @@ export class GitHubIssueAddCommentEnhancer implements CommentEnhancer { + overtype.updatePreview() + }, 100) + setTimeout(() => { + overtype.updatePreview() + }, 200) + setTimeout(() => { + overtype.updatePreview() + }, 400) + setTimeout(() => { + overtype.updatePreview() + }, 8000) + } + getEnhancerCount(): number { return this.enhancers.size } diff --git a/browser-extension/tests/har-fixture.ts b/browser-extension/tests/har-fixture.ts index 60e7e90..befcdf9 100644 --- a/browser-extension/tests/har-fixture.ts +++ b/browser-extension/tests/har-fixture.ts @@ -18,6 +18,7 @@ vi.mock('overtype', () => { preview: document.createElement('div'), setValue: vi.fn(), textarea: document.createElement('textarea'), + updatePreview: vi.fn(), wrapper: document.createElement('div'), }, ]) diff --git a/packages/overtype b/packages/overtype index 80caa5d..35cb823 160000 --- a/packages/overtype +++ b/packages/overtype @@ -1 +1 @@ -Subproject commit 80caa5d1a0139171e3e250c9c9e25bd63a67d331 +Subproject commit 35cb82382c6f2d4352e4608f3e437ff5c3bcd032