feat: 添加文件名列的点击事件,优化文件链接交互体验

This commit is contained in:
2025-11-10 22:34:31 +08:00
parent a907ccaee2
commit c8229c89d7
2 changed files with 19 additions and 3 deletions

View File

@@ -291,8 +291,18 @@ h1 > div {
background-color: var(--hover-bg); background-color: var(--hover-bg);
} }
.file-name-col {
cursor: pointer;
user-select: none;
}
.file-name-col:hover {
background-color: var(--hover-bg);
}
.file-icon { .file-icon {
margin-right: 8px; margin-right: 8px;
pointer-events: none;
} }
.folder { .folder {

View File

@@ -77,13 +77,19 @@ current_prefix }}"{% endblock %} {% block content %}
aria-label="选择 {{ entry.name }}" aria-label="选择 {{ entry.name }}"
/> />
</td> </td>
<td class="file-name-col"> <td
class="file-name-col"
onclick="{% if entry.is_dir %}window.location.href='/{{ entry.key.rstrip('/') }}'{% else %}window.open('{{ entry.file_url }}', '_blank'){% endif %}"
style="cursor: pointer"
>
{% if entry.is_dir %} {% if entry.is_dir %}
<i class="file-icon folder fas fa-folder"></i> <i class="file-icon folder fas fa-folder"></i>
<a href="/{{ entry.key.rstrip('/') }}">{{ entry.name }}</a> <a href="/{{ entry.key.rstrip('/') }}" onclick="event.stopPropagation();">{{ entry.name }}</a>
{% else %} {% else %}
<i class="file-icon file {{ entry.name|fileicon }}"></i> <i class="file-icon file {{ entry.name|fileicon }}"></i>
<a href="{{ entry.file_url }}" target="_blank">{{ entry.name }}</a> <a href="{{ entry.file_url }}" target="_blank" onclick="event.stopPropagation();"
>{{ entry.name }}</a
>
{% endif %} {% endif %}
</td> </td>
<td class="file-size-col file-size"> <td class="file-size-col file-size">