Merge pull request #4368 from mempool/simon/truncate-selection

Make search and select work for truncated text
This commit is contained in:
softsimon 2023-11-15 16:25:17 +09:00 committed by GitHub
commit eac8f8c2c6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 16 additions and 1 deletions

View File

@ -1,4 +1,5 @@
<span class="truncate" [style.max-width]="maxWidth ? maxWidth + 'px' : null" [style.justify-content]="textAlign" [class.inline]="inline"> <span class="truncate" [style.max-width]="maxWidth ? maxWidth + 'px' : null" [style.justify-content]="textAlign" [class.inline]="inline">
<div class="hidden">{{ text }}</div>
<ng-container *ngIf="link"> <ng-container *ngIf="link">
<a [routerLink]="link" class="truncate-link"> <a [routerLink]="link" class="truncate-link">
<ng-container *ngIf="rtl; then rtlTruncated; else ltrTruncated;"></ng-container> <ng-container *ngIf="rtl; then rtlTruncated; else ltrTruncated;"></ng-container>
@ -11,6 +12,7 @@
</span> </span>
<ng-template #ltrTruncated> <ng-template #ltrTruncated>
<span class="first">{{text.slice(0,-lastChars)}}</span><span class="last-four">{{text.slice(-lastChars)}}</span> <span class="first">{{text.slice(0,-lastChars)}}</span><span class="last-four">{{text.slice(-lastChars)}}</span>
</ng-template> </ng-template>

View File

@ -27,4 +27,17 @@
&.inline { &.inline {
display: inline-flex; display: inline-flex;
} }
} }
.hidden {
color: transparent;
position: absolute;
max-width: 300px;
overflow: hidden;
}
@media (max-width: 567px) {
.hidden {
max-width: 150px;
}
}