commit fb07bcd2b564c325fa77691e2ed68745278c54c7 Author: Ole Date: Thu Oct 8 17:55:29 2020 +0200 Use the GrDiff type now that it's available Cleaning up a tempary duplication created during TypeScript migration. Change-Id: I1a6aafb1630b9991ebd44f1f08a3eeece903b6e6 diff --git a/polygerrit-ui/app/elements/diff/gr-diff-cursor/gr-diff-cursor.ts b/polygerrit-ui/app/elements/diff/gr-diff-cursor/gr-diff-cursor.ts index 59a0370..2486c03 100644 --- a/polygerrit-ui/app/elements/diff/gr-diff-cursor/gr-diff-cursor.ts +++ b/polygerrit-ui/app/elements/diff/gr-diff-cursor/gr-diff-cursor.ts @@ -32,6 +32,7 @@ import {GrDiffLineType} from '../gr-diff/gr-diff-line'; import {PolymerSpliceChange} from '@polymer/polymer/interfaces'; import {PolymerDomWrapper} from '../../../types/types'; import {GrDiffGroupType} from '../gr-diff/gr-diff-group'; +import {GrDiff} from '../gr-diff/gr-diff'; const DiffViewMode = { SIDE_BY_SIDE: 'SIDE_BY_SIDE', @@ -46,15 +47,6 @@ const RIGHT_SIDE_CLASS = 'target-side-right'; // Time in which pressing n key again after the toast navigates to next file const NAVIGATE_TO_NEXT_FILE_TIMEOUT_MS = 5000; -// TODO(TS): Use proper GrDiff type once that file is converted to TS. -interface GrDiff extends HTMLElement { - path: string; - addDraftAtLine: (element: HTMLElement) => void; - createRangeComment: () => void; - getCursorStops: () => HTMLElement[]; - isRangeSelected: () => boolean; -} - export interface GrDiffCursor { $: { cursorManager: GrCursorManager; diff --git a/polygerrit-ui/app/elements/diff/gr-diff/gr-diff.ts b/polygerrit-ui/app/elements/diff/gr-diff/gr-diff.ts index 8efb89f..022ac80 100644 --- a/polygerrit-ui/app/elements/diff/gr-diff/gr-diff.ts +++ b/polygerrit-ui/app/elements/diff/gr-diff/gr-diff.ts @@ -455,12 +455,14 @@ export class GrDiff extends GestureEventListeners( this.cancelDebouncer(RENDER_DIFF_TABLE_DEBOUNCE_NAME); } - getCursorStops() { + getCursorStops(): HTMLElement[] { if (this.hidden && this.noAutoRender) return []; if (!this.root) return []; return Array.from( - this.root.querySelectorAll(':not(.contextControl) > .diff-row') + this.root.querySelectorAll( + ':not(.contextControl) > .diff-row' + ) ).filter(tr => tr.querySelector('button')); }