[MM-34527] fix reload and long names (#1524)

This commit is contained in:
Guillermo Vayá
2021-04-07 00:48:19 +02:00
committed by GitHub
parent dd41c3a14d
commit 923212780a
5 changed files with 25 additions and 8 deletions

View File

@@ -44,8 +44,19 @@ function browserWindowFromWebContents(content) {
return window;
}
const DEFAULT_MAX = 20;
function shorten(string, max) {
const maxLength = (max && max >= 4) ? max : DEFAULT_MAX;
if (string.length >= maxLength) {
return `${string.slice(0, maxLength - 3)}...`;
}
return string;
}
export default {
getDisplayBoundaries,
runMode,
browserWindowFromWebContents,
shorten,
};