diff options
author | Ben Rohlfs <brohlfs@google.com> | 2023-08-23 17:30:35 +0200 |
---|---|---|
committer | Ben Rohlfs <brohlfs@google.com> | 2023-08-23 15:34:41 +0000 |
commit | 94c384bf5d325649d950796a2a68ed6a8708dde9 (patch) | |
tree | 6b9658246cb0c204d2a9c1158db05dbac4a44a81 | |
parent | 3001d25c79e549c6e477040ab00d9c093ca17e77 (diff) |
Fix embedded gr-diff to work with the new diff
We have to import the new `gr-diff`. Otherwise it will not even be known
as a custom element.
And the objects/classes that we expose on `window` need to differentiate
based on the common `isNewDiff()` logic.
Release-Notes: skip
Change-Id: I9a5dd880152f02e0eb5497618f679176ab261f52
-rw-r--r-- | polygerrit-ui/app/embed/gr-diff.ts | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/polygerrit-ui/app/embed/gr-diff.ts b/polygerrit-ui/app/embed/gr-diff.ts index 1524a788d3..02a153d532 100644 --- a/polygerrit-ui/app/embed/gr-diff.ts +++ b/polygerrit-ui/app/embed/gr-diff.ts @@ -14,18 +14,23 @@ import '../api/embed'; import '../scripts/bundled-polymer'; import './diff-old/gr-diff/gr-diff'; import './diff-old/gr-diff-cursor/gr-diff-cursor'; +import './diff/gr-diff/gr-diff'; +import './diff/gr-diff-cursor/gr-diff-cursor'; import {TokenHighlightLayer} from './diff/gr-diff-builder/token-highlight-layer'; -import {GrDiffCursor} from './diff-old/gr-diff-cursor/gr-diff-cursor'; -import {GrAnnotation} from './diff-old/gr-diff-highlight/gr-annotation'; +import {GrDiffCursor as GrDiffCursorOld} from './diff-old/gr-diff-cursor/gr-diff-cursor'; +import {GrDiffCursor as GrDiffCursorNew} from './diff/gr-diff-cursor/gr-diff-cursor'; +import {GrAnnotation as GrAnnotationOld} from './diff-old/gr-diff-highlight/gr-annotation'; +import {GrAnnotationImpl as GrAnnotationNew} from './diff/gr-diff-highlight/gr-annotation'; import {createDiffAppContext} from './gr-diff-app-context-init'; import {injectAppContext} from '../services/app-context'; +import {isNewDiff} from './diff/gr-diff/gr-diff-utils'; // Setup appContext for diff. // TODO (dmfilippov): find a better solution injectAppContext(createDiffAppContext()); // Setup global variables for existing usages of this component window.grdiff = { - GrAnnotation, - GrDiffCursor, + GrAnnotation: isNewDiff() ? GrAnnotationNew : GrAnnotationOld, + GrDiffCursor: isNewDiff() ? GrDiffCursorNew : GrDiffCursorOld, TokenHighlightLayer, }; |