mirror of
https://github.com/EnixCoda/Gitako.git
synced 2026-03-11 08:54:44 +00:00
feat: prevent auto expand if GitHub native PR tree is enabled
This commit is contained in:
parent
1e72cad644
commit
89c747206b
2 changed files with 7 additions and 2 deletions
|
|
@ -27,7 +27,8 @@ export function isInRepoPage() {
|
|||
|
||||
export function isInCodePage() {
|
||||
const branchListSelector = ['#branch-select-menu', '.branch-select-menu'].join()
|
||||
return Boolean($(branchListSelector))
|
||||
// The element may still exist in DOM for PR pages, but not visible
|
||||
return Boolean($(branchListSelector, e => e.offsetWidth > 0 && e.offsetHeight > 0))
|
||||
}
|
||||
|
||||
export function getIssueTitle() {
|
||||
|
|
@ -259,3 +260,7 @@ export function getPath() {
|
|||
.slice(1) // the first is the repo's name
|
||||
return path
|
||||
}
|
||||
|
||||
export function isNativePRFileTreeShown() {
|
||||
return $('file-tree[data-target="diff-layout.fileTree"]')
|
||||
}
|
||||
|
|
|
|||
|
|
@ -168,7 +168,7 @@ export const GitHub: Platform = {
|
|||
return await getRepositoryTreeData(metaData, path, recursive, accessToken)
|
||||
},
|
||||
shouldShow() {
|
||||
return Boolean(DOMHelper.isInCodePage() || URLHelper.isInPullPage())
|
||||
return Boolean(DOMHelper.isInCodePage() || (URLHelper.isInPullPage() && !DOMHelper.isNativePRFileTreeShown()))
|
||||
},
|
||||
shouldExpandAll() {
|
||||
return Boolean(URLHelper.isInPullPage())
|
||||
|
|
|
|||
Loading…
Reference in a new issue