From 13a6d43f0b63faa5b55d357124401c854dbf0b30 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20Colomb?= Date: Sun, 3 Mar 2024 20:55:09 +0100 Subject: [PATCH] gui: Fix wrapping in "Shared With" / "Folders" lists. (#9438) This change was split off from #9355 as an independent clean-up / fix. See that PR for review discussion, testing, and screenshots. Improve the wrapping of folder labels / device names by going back to word-wrapping, but making sure other spans, such as the trailing comma, do not get separated from the label span. * Avoid adding whitespace caused by line wraps in HTML source code. The different cases within the ng-switch block are separated by newlines for readability, but that gets parsed as whitespace. For wrapping purposes, this should not happen, because then there is no way to keep other HTML parts glued to the name / label in each list entry. * Simplify redundant conditional comma code. The separating comma after a device name or folder label (all but the last) should always stick to it. Use the HTML comment trick to avoid whitespace and therefore a wrapping opportunity caused by the code formatting newline. Thus the conditional comma only needs to be defined once, not in each ng-switch case. * Wrap at word boundaries and only break up words if necessary. Use the overflow-wrap: break-word; style instead of word-break: break-all;. While the latter is suitable for longish paths, breaking device names or folder labels arbitrarily within words is ugly. This also makes the the numbers actually stay glued to their respective neighboring words. Include legacy CSS alias "word-wrap" in the class definition. * Fix indentation (unrelated). --- gui/default/assets/css/overrides.css | 7 +++++++ gui/default/index.html | 26 ++++++++++++++------------ 2 files changed, 21 insertions(+), 12 deletions(-) diff --git a/gui/default/assets/css/overrides.css b/gui/default/assets/css/overrides.css index b773cf000..043e6a924 100644 --- a/gui/default/assets/css/overrides.css +++ b/gui/default/assets/css/overrides.css @@ -189,6 +189,13 @@ input[type="checkbox"].extended-attributes-filter-rule-checkbox { word-break: break-all; } +/* Break up long words in paragraphs only if necessary to prevent text overflow. */ +.overflow-break-word { + overflow-wrap: break-word; + /* Legacy name alias */ + word-wrap: break-word; +} + .folder-advanced { padding: 1rem; margin-bottom: 15px; diff --git a/gui/default/index.html b/gui/default/index.html index 12216d485..26f4e8655 100644 --- a/gui/default/index.html +++ b/gui/default/index.html @@ -404,9 +404,9 @@ ({{scanPercentage(folder.id) | percent}}) ({{syncPercentage(folder.id) | percent}}, {{model[folder.id].needBytes | binary}}B) - + - +
{{folder.label.length != 0 ? folder.label : folder.id}} @@ -585,12 +585,13 @@  Shared With - + - - {{deviceName(devices[device.deviceID])}}1, - {{deviceName(devices[device.deviceID])}}2, - {{deviceName(devices[device.deviceID])}}, + {{deviceName(devices[device.deviceID])}}1{{deviceName(devices[device.deviceID])}}2{{deviceName(devices[device.deviceID])}}, @@ -940,12 +941,13 @@  Folders - + - - {{folderLabel(folderID)}}1, - {{folderLabel(folderID)}}2, - {{folderLabel(folderID)}}, + {{folderLabel(folderID)}}1{{folderLabel(folderID)}}2{{folderLabel(folderID)}},