don't add ­ on word boundaries and strip it from tooltips

addresses #300
This commit is contained in:
tophf 2017-12-11 22:39:22 +03:00
parent 23733bd9fe
commit 3410a58cd9
2 changed files with 3 additions and 2 deletions

View File

@ -36,7 +36,8 @@ $$.remove = (selector, base = document) => {
const padding = btn.offsetWidth - btn.clientWidth;
const displayedWidth = btn.getBoundingClientRect().width - padding;
if (btn.scrollWidth > displayedWidth) {
btn.title = btn.textContent;
const text = btn.textContent;
btn.title = text.includes('\u00AD') ? text.replace(/\u00AD/g, '') : text;
btn.titleIsForEllipsis = true;
} else if (btn.title) {
btn.title = '';

View File

@ -194,5 +194,5 @@ function tDocLoader() {
function tWordBreak(text) {
// adds soft hyphens every 10 characters to ensure the long words break before breaking the layout
return text.length <= 10 ? text :
text.replace(/[\d\w\u007B-\uFFFF]{10}|[\d\w\u007B-\uFFFF]{5,10}[!-/]|((?!\s)\W){10}/g, '$&\u00AD');
text.replace(/([\d\w\u007B-\uFFFF]{10}|[\d\w\u007B-\uFFFF]{5,10}[!-/]|((?!\s)\W){10})(?!\b)/g, '$&\u00AD');
}