Use unique class for breadcrumb divider (#26524)

Fix regression from https://github.com/go-gitea/gitea/pull/25539:
https://github.com/go-gitea/gitea/pull/26519#issuecomment-1678825200.

Before:
<img width="429" alt="Screenshot 2023-08-15 at 15 46 12"
src="a818f60a-77a2-48fe-8e6f-363d152ccb1e">

After:
<img width="424" alt="Screenshot 2023-08-15 at 15 46 19"
src="c90159e2-ced2-4a74-8a0f-a1b2b5d0b565">

<img width="605" alt="Screenshot 2023-08-15 at 15 56 11"
src="3ded6f57-86f4-422a-86cb-56dd2c216dee">
This commit is contained in:
silverwind 2023-08-16 02:08:23 +02:00 committed by GitHub
parent bc930f332f
commit 3e044d2c9f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
7 changed files with 15 additions and 10 deletions

View file

@ -1,7 +1,12 @@
.breadcrumb .divider {
.breadcrumb {
display: flex;
flex-wrap: wrap;
align-items: center;
gap: 3px;
}
.breadcrumb .breadcrumb-divider {
color: var(--color-text-light-2);
margin-left: 3px;
margin-right: 3px;
}
.breadcrumb > * {

View file

@ -114,7 +114,7 @@ export function initRepoEditor() {
if (i < parts.length - 1) {
if (value.length) {
$(`<span class="section"><a href="#">${htmlEscape(value)}</a></span>`).insertBefore($(this));
$('<div class="divider"> / </div>').insertBefore($(this));
$('<div class="breadcrumb-divider">/</div>').insertBefore($(this));
}
} else {
$(this).val(value);
@ -132,7 +132,7 @@ export function initRepoEditor() {
// Jump back to last directory once the filename is empty
if (e.code === 'Backspace' && getCursorPosition($(this)) === 0 && $section.length > 0) {
e.preventDefault();
const $divider = $('.breadcrumb div.divider');
const $divider = $('.breadcrumb .breadcrumb-divider');
const value = $section.last().find('a').text();
$(this).val(value + $(this).val());
this.setSelectionRange(value.length, value.length);