| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent 288706e commit 893768e
2 files changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -365,6 +365,19 @@ function handleCodeHost(codeHost: CodeHost): Subscription { | |||
| 365 | 365 | const toURIWithPath = (ctx: AbsoluteRepoFile) => | |
| 366 | 366 | `git://${ctx.repoPath}?${ctx.commitID}#${ctx.filePath}` | |
| 367 | 367 | ||
| 368 | + const originalDOM = dom | ||
| 369 | + dom = { | ||
| 370 | + ...dom, | ||
| 371 | + // If any parent element has the sourcegraph-extension-element | ||
| 372 | + // class then that element does not have any code. We | ||
| 373 | + // must check for "any parent element" because extensions | ||
| 374 | + // create their DOM changes before the blob is tokenized | ||
| 375 | + // into multiple elements. | ||
| 376 | + getCodeElementFromTarget: (target: HTMLElement): HTMLElement | null => | ||
| 377 | + target.closest('.sourcegraph-extension-element') !== null | ||
| 378 | + ? null | ||
| 379 | + : originalDOM.getCodeElementFromTarget(target), | ||
| 380 | + } | ||
| 368 | 381 | if (extensionsController) { | |
| 369 | 382 | const { content, baseContent } = getContentOfCodeView(codeView, { isDiff, getLineRanges, dom }) | |
| 370 | 383 | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -174,13 +174,15 @@ export const applyDecoration = ( | |||
| 174 | 174 | if (decoration.after) { | |
| 175 | 175 | const linkTo = (url: string) => (e: HTMLElement): HTMLElement => { | |
| 176 | 176 | const link = document.createElement('a') | |
| 177 | + link.className = 'sourcegraph-extension-element' | ||
| 177 | 178 | link.setAttribute('href', url) | |
| 178 | 179 | link.style.color = decoration.after!.color || null | |
| 179 | 180 | link.appendChild(e) | |
| 180 | 181 | return link | |
| 181 | 182 | } | |
| 182 | 183 | ||
| 183 | 184 | const after = document.createElement('span') | |
| 185 | + after.className = 'sourcegraph-extension-element' | ||
| 184 | 186 | after.style.backgroundColor = decoration.after.backgroundColor || null | |
| 185 | 187 | after.textContent = decoration.after.contentText || null | |
| 186 | 188 | ||
| Back | FazBrowse Home | New Git URL |
0 commit comments