@annoyingmouse/wc-trim-middle
v1.0.2
Published
This web component was inspired by Chris Heilmann and does not trim strings that don’t fit the space at the end, but in the middle of the string
Downloads
11
Readme
Shamelessly stolen from Christian Heilmann this takes his function and embeds it into a Web Component without a shadowDOM, according to Mr Heilmann:
The original text is retained in the title attribute of the element, but only if the string has been trimmed.
Usage
<span is="wc-trim-middle">This is a long string that will be trimmed</span>
<script type="module" src="wc-trim-middle.js"></script>Configuration
- Adding a
widthattribute allow you to define the amount of letters you want to show - it defaults to 16. - Adding a
replacementattribute allows you to change what the character in between the parts should be - it defaults to….
License
MIT
