Skip to content

Commit 83e925a

Browse files
committed
Use own function instead
1 parent 50bf708 commit 83e925a

File tree

2 files changed

+17
-13
lines changed

2 files changed

+17
-13
lines changed

web_src/js/components/ViewFileTree.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ async function loadViewContent(url: string) {
3737
document.querySelector('.repo-view-content').innerHTML = await response.text();
3838
}
3939
40-
async function navigateTreeView(treePath: string, newTab: boolean) {
40+
async function navigateTreeView(treePath: string, newTab?: boolean) {
4141
const url = `${props.repoLink}/src/${props.currentRefNameSubURL}/${pathEscapeSegments(treePath)}`;
4242
if (newTab) {
4343
window.open(url, '_blank');

web_src/js/components/ViewFileTreeItem.vue

Lines changed: 16 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ type Item = {
1414
1515
const props = defineProps<{
1616
item: Item,
17-
navigateViewContent:(treePath: string, newTab: boolean) => void,
17+
navigateViewContent:(treePath: string, newTab?: boolean) => void,
1818
loadChildren:(treePath: string, subPath?: string) => Promise<Item[]>,
1919
selectedItem?: string,
2020
}>();
@@ -35,13 +35,17 @@ const doLoadChildren = async () => {
3535
}
3636
};
3737
38-
const doLoadDirContent = (newTab: boolean) => {
39-
if (!newTab) doLoadChildren();
40-
props.navigateViewContent(props.item.fullPath, newTab);
38+
const doLoadDirContent = () => {
39+
doLoadChildren();
40+
props.navigateViewContent(props.item.fullPath);
4141
};
4242
43-
const doLoadFileContent = (newTab: boolean) => {
44-
props.navigateViewContent(props.item.fullPath, newTab);
43+
const doLoadFileContent = () => {
44+
props.navigateViewContent(props.item.fullPath);
45+
};
46+
47+
const doOpenContentInNewTab = () => {
48+
props.navigateViewContent(props.item.fullPath, true);
4549
};
4650
4751
const doGotoSubModule = () => {
@@ -67,8 +71,8 @@ const doGotoSubModule = () => {
6771
v-else-if="item.entryMode === 'symlink'" class="tree-item type-symlink"
6872
:class="{'selected': selectedItem === item.fullPath}"
6973
:title="item.entryName"
70-
@click.stop="doLoadFileContent(false)"
71-
@auxclick.stop="doLoadFileContent(true)"
74+
@click.stop="doLoadFileContent"
75+
@auxclick.stop="doOpenContentInNewTab"
7276
>
7377
<!-- symlink -->
7478
<div class="item-content">
@@ -81,8 +85,8 @@ const doGotoSubModule = () => {
8185
v-else-if="item.entryMode !== 'tree'" class="tree-item type-file"
8286
:class="{'selected': selectedItem === item.fullPath}"
8387
:title="item.entryName"
84-
@click.stop="doLoadFileContent(false)"
85-
@auxclick.stop="doLoadFileContent(true)"
88+
@click.stop="doLoadFileContent"
89+
@auxclick.stop="doOpenContentInNewTab"
8690
>
8791
<!-- file -->
8892
<div class="item-content">
@@ -95,8 +99,8 @@ const doGotoSubModule = () => {
9599
v-else class="tree-item type-directory"
96100
:class="{'selected': selectedItem === item.fullPath}"
97101
:title="item.entryName"
98-
@click.stop="doLoadDirContent(false)"
99-
@auxclick.stop="doLoadDirContent(true)"
102+
@click.stop="doLoadDirContent"
103+
@auxclick.stop="doOpenContentInNewTab"
100104
>
101105
<!-- directory -->
102106
<div class="item-toggle">

0 commit comments

Comments
 (0)