Skip to content

Commit

Permalink
PackageDetail: improve clickability of code files
Browse files Browse the repository at this point in the history
  • Loading branch information
dmstern committed Nov 22, 2018
1 parent 26484b2 commit 6c96696
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions src/views/PackageDetail.vue
Original file line number Diff line number Diff line change
Expand Up @@ -483,16 +483,20 @@ export default class PackageDetail extends Vue {
private selectCode(event: Event): void {
const target = event.target as HTMLElement;
const label = target.classList.contains('v-icon')
? (target.nextSibling as HTMLElement)
: target;
const clickedLabel = label.innerHTML;
const treeItem = target.closest('.v-treeview-node__root');
if (!this.data.activeFile.length) {
if (!this.data.activeFile.length || !treeItem) {
this.resetActiveCode();
return;
}
const labelElement = treeItem.querySelector('.v-treeview-node__label');
if (!labelElement) {
return;
}
const clickedLabel = labelElement.innerHTML;
const id = this.data.activeFile[0];
if (this.data.packageDetail && this.data.packageDetail.fileList) {
Expand Down

0 comments on commit 6c96696

Please sign in to comment.