From 3410a58cd9db9dc12fb27e687061378467b230ac Mon Sep 17 00:00:00 2001 From: tophf Date: Mon, 11 Dec 2017 22:39:22 +0300 Subject: [PATCH] don't add ­ on word boundaries and strip it from tooltips addresses #300 --- js/dom.js | 3 ++- js/localization.js | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/js/dom.js b/js/dom.js index fc0abbbe..a2e54316 100644 --- a/js/dom.js +++ b/js/dom.js @@ -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 = ''; diff --git a/js/localization.js b/js/localization.js index 0b54d2de..90165cb3 100644 --- a/js/localization.js +++ b/js/localization.js @@ -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'); }