Merge pull request #2109 from maxberger/trimowner

UI: Trim owner length for incoming shares
This commit is contained in:
Peter Bieringer
2026-04-26 09:06:04 +02:00
committed by GitHub
2 changed files with 16 additions and 2 deletions

View File

@@ -132,3 +132,17 @@ export function get_element(node, selector) {
}
return /** @type {HTMLElement} */ (element);
}
/**
* Trim a string to the given maximum number of characters
*
* @param {string} str
* @param {number} max
* @returns {str}
*/
export function trim_to_max(str, max) {
if (str.length > max - 2) {
return str.substring(0, max) + "...";
}
return str;
}