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

[stable4] feat(FilePicker): Always show file extension as a trailing text part #933

Merged
merged 1 commit into from Aug 23, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion l10n/messages.pot
Expand Up @@ -90,7 +90,7 @@ msgstr ""
msgid "Undo"
msgstr ""

#: lib/components/FilePicker/FileListRow.vue:22
#: lib/components/FilePicker/FileListRow.vue:23
msgid "Unset"
msgstr ""

Expand Down
15 changes: 13 additions & 2 deletions lib/components/FilePicker/FileListRow.vue
Expand Up @@ -12,6 +12,7 @@
<div class="file-picker__name-container">
<div class="file-picker__file-icon" :style="{ backgroundImage }" />
<div class="file-picker__file-name" :title="displayName" v-text="displayName" />
<div class="file-picker__file-extension" v-text="fileExtension" />
</div>
</td>
<td class="row-size">
Expand Down Expand Up @@ -50,9 +51,14 @@ const emit = defineEmits<{
}>()

/**
* The displayname of the current node
* The displayname of the current node (excluding file extension)
*/
const displayName = computed(() => props.node.attributes?.displayname || props.node.basename)
const displayName = computed(() => props.node.attributes?.displayName || props.node.basename.slice(0, props.node.extension ? -props.node.extension.length : undefined))

/**
* The file extension of the file
*/
const fileExtension = computed(() => props.node.extension)

/**
* If this node can be picked, basically just check if picking a directory is allowed
Expand Down Expand Up @@ -119,5 +125,10 @@ function handleKeyDown(event: KeyboardEvent) {
overflow: hidden;
text-overflow: ellipsis;
}

&__file-extension {
color: var(--color-text-maxcontrast);
min-width: fit-content;
}
}
</style>