From: Kohei Yoshino Date: Wed, 5 Jun 2019 20:52:26 +0000 (-0400) Subject: Bug 929502 - bugs with very long but unwrappable summaries cause the tables to overla... X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=eda29bb77cb4a7a3d58624ef676de4ac2fda1a06;p=thirdparty%2Fbugzilla.git Bug 929502 - bugs with very long but unwrappable summaries cause the tables to overlap when the window is small --- diff --git a/Bugzilla/Template.pm b/Bugzilla/Template.pm index fbff69bb3..7489bc5a0 100644 --- a/Bugzilla/Template.pm +++ b/Bugzilla/Template.pm @@ -707,9 +707,11 @@ sub create { # * `test_switch_window_content.py` # * `TestSwitchToWindowContent` # * `mozilla.org` + # * `MOZILLA_PKIX_ERROR_MITM_DETECTED` wbr => sub { my ($var) = @_; - $var =~ s/([a-z])([A-Z\._])(?![^<]*>)/$1$2/g; + $var =~ s/([a-z])([A-Z])(?![^<]*>)/$1$2/g; + $var =~ s/([A-Za-z0-9])([\._])(?![^<]*>)/$1$2/g; return $var; }, diff --git a/extensions/MyDashboard/web/js/query.js b/extensions/MyDashboard/web/js/query.js index fe7a28a76..1dd082bf3 100644 --- a/extensions/MyDashboard/web/js/query.js +++ b/extensions/MyDashboard/web/js/query.js @@ -149,7 +149,7 @@ $(function() { const link_formatter = ({ data, value }) => ` - ${String(value).htmlEncode()}`; + ${isNaN(value) ? value.htmlEncode().wbr() : value}`; lastChangesQuery = new Y.DataSource.IO({ source: `${BUGZILLA.config.basepath}jsonrpc.cgi` }); diff --git a/js/global.js b/js/global.js index 691229caf..11510043d 100644 --- a/js/global.js +++ b/js/global.js @@ -210,6 +210,25 @@ if (!String.prototype.htmlEncode) { })(); } +// Insert `` HTML tags to camel and snake case words as well as +// words containing dots in the given string so a long bug summary, +// for example, will be wrapped in a preferred manner rather than +// overflowing or expanding the parent element. This conversion +// should exclude existing HTML tags such as links. Examples: +// * `test_switch_window_content.py` +// * `TestSwitchToWindowContent` +// * `mozilla.org` +// * `MOZILLA_PKIX_ERROR_MITM_DETECTED` +// This is the JavaScript version of `wbr` in Bugzilla/Template.pm. +if (!String.prototype.wbr) { + (function() { + String.prototype.wbr = function() { + return this.replace(/([a-z])([A-Z])(?![^<]*>)/g, '$1$2') + .replace(/([A-Za-z0-9])([\._])(?![^<]*>)/g, '$1$2'); + }; + })(); +} + // our auto-completion disables browser native autocompletion, however this // excludes it from being restored by bf-cache. trick the browser into // restoring by changing the autocomplete attribute when a page is hidden and