Revert "Truncate Center Component: Fix Vue rendering (#6087)"

This reverts commit e7297ce6b8.
This commit is contained in:
d11n 2024-07-10 11:00:52 +02:00 committed by GitHub
parent e7297ce6b8
commit 21ea49e89d
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -4,23 +4,23 @@
var isTruncated = !string.IsNullOrEmpty(Model.Start) && !string.IsNullOrEmpty(Model.End); var isTruncated = !string.IsNullOrEmpty(Model.Start) && !string.IsNullOrEmpty(Model.End);
@if (Model.Copy) classes += " truncate-center--copy"; @if (Model.Copy) classes += " truncate-center--copy";
@if (Model.Elastic) classes += " truncate-center--elastic"; @if (Model.Elastic) classes += " truncate-center--elastic";
var prefix = Model.IsVue ? ":" : "";
} }
<span class="truncate-center @classes" id="@Model.Id" data-text="@Model.Text"> <span class="truncate-center @classes"@(!string.IsNullOrEmpty(Model.Id) ? $"id={Model.Id}" : null) data-text=@Safe.Json(Model.Text)>
@if (Model.IsVue) @if (Model.IsVue)
{ {
<span class="truncate-center-truncated" data-bs-toggle="tooltip" :title="@Model.Text"> <span class="truncate-center-truncated" data-bs-toggle="tooltip" :title=@Safe.Json(Model.Text)>
@if (Model.Elastic) @if (Model.Elastic)
{ {
<span class="truncate-center-start" v-text="@Model.Text"></span> <span class="truncate-center-start" v-text=@Safe.Json(Model.Text)></span>
} }
else else
{ {
<span class="truncate-center-start" v-text="@(Model.Text).length > 2 * @(Model.Padding) ? (@(Model.Text).slice(0, @(Model.Padding)) + '…') : @(Model.Text)"></span> <span class="truncate-center-start" v-text=@Safe.Json($"{Model.Text}.slice(0, {Model.Padding})")></span>
<span>…</span>
} }
<span class="truncate-center-end" v-text="@(Model.Text).slice(-@(Model.Padding))" v-if="@(Model.Text).length > 2 * @(Model.Padding)"></span> <span class="truncate-center-end" v-text=@Safe.Json($"{Model.Text}.slice(-{Model.Padding})")></span>
</span> </span>
<span class="truncate-center-text" v-text="@Model.Text"></span> <span class="truncate-center-text" v-text=@Safe.Json(Model.Text)></span>
} }
else else
{ {
@ -35,13 +35,13 @@
} }
@if (Model.Copy) @if (Model.Copy)
{ {
<button type="button" class="btn btn-link p-0" @(prefix)data-clipboard="@Model.Text"> <button type="button" class="btn btn-link p-0" @(Model.IsVue ? ":" : string.Empty)data-clipboard=@Safe.Json(Model.Text)>
<vc:icon symbol="actions-copy" /> <vc:icon symbol="actions-copy" />
</button> </button>
} }
@if (!string.IsNullOrEmpty(Model.Link)) @if (!string.IsNullOrEmpty(Model.Link))
{ {
<a @(prefix)href="@Model.Link" rel="noreferrer noopener" target="_blank"> <a @(Model.IsVue ? ":" : "")href="@Model.Link" rel="noreferrer noopener" target="_blank">
<vc:icon symbol="info" /> <vc:icon symbol="info" />
</a> </a>
} }