fix the whitespace fix
This commit is contained in:
parent
183914f351
commit
0d30465f32
1 changed files with 6 additions and 12 deletions
|
@ -1,19 +1,13 @@
|
||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
|
import { tick } from "svelte";
|
||||||
|
|
||||||
export let value: string;
|
export let value: string;
|
||||||
let root: HTMLDivElement;
|
let root: HTMLDivElement;
|
||||||
|
|
||||||
$: valueStart = value.substring(0, value.length - 7);
|
$: valueStart = value.substring(0, value.length - 7).replace(" ", "\xa0");
|
||||||
$: valueEnd = value.substring(value.length - 7, value.length);
|
$: valueEnd = value
|
||||||
|
.substring(value.length - 7, value.length)
|
||||||
// If the break happens to be on a space, it gets collapsed; `white-space` CSS
|
.replace(" ", "\xa0");
|
||||||
// property doesn't help, and replacing the spaces in the strings gets escaped
|
|
||||||
// by Svelte; hence, direct manipulation of the DOM.
|
|
||||||
$: {
|
|
||||||
value;
|
|
||||||
Array.from(root?.children || []).forEach(
|
|
||||||
(el) => (el.innerHTML = el.innerHTML.replace(" ", " "))
|
|
||||||
);
|
|
||||||
}
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<div class="ellipsis" bind:this={root}>
|
<div class="ellipsis" bind:this={root}>
|
||||||
|
|
Loading…
Reference in a new issue