Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open asset on click #1847

Merged
merged 3 commits into from
Feb 9, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 10 additions & 6 deletions web/src/views/FileBrowserView/FileBrowser.vue
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@
v-for="item in items"
:key="item.path"
color="primary"
@click="selectPath(item)"
@click.self="openItem(item)"
>
<v-icon
class="mr-2"
Expand Down Expand Up @@ -158,7 +158,7 @@
</v-icon>
</v-btn>
</template>
<span>Open asset in browser</span>
<span>Open asset in browser (you can also click on the item itself)</span>
</v-tooltip>
</v-list-item-action>

Expand Down Expand Up @@ -445,12 +445,16 @@ function locationSlice(index: number) {
return `${splitLocation.value.slice(0, index + 1).join('/')}/`;
}

function selectPath(item: AssetPath) {
function openItem(item: AssetPath) {
const { asset, path } = item;

// Return early if path is a file
if (asset) { return; }
location.value = path;
if (asset) {
// If the item is an asset, open it in the browser.
window.open(inlineURI(asset.asset_id), "_self");
} else {
// If it's a directory, move into it.
location.value = path;
}
}

function navigateToParent() {
Expand Down