Active
Project:
Form Tips
Version:
8.x-1.x-dev
Component:
Code
Priority:
Normal
Category:
Feature request
Assigned:
Unassigned
Reporter:
Created:
18 Jun 2019 at 15:52 UTC
Updated:
15 Oct 2019 at 21:43 UTC
Jump to comment: Most recent
First off, great module! Thanks for your hard work!
Sometimes descriptions have multiple lines. They should be displayed as such.
https://git.drupalcode.org/project/formtips/blob/8.x-1.x/css/formtips.cs...
.formtips-processed {
/* ... */
white-space: pre-line;
}
https://git.drupalcode.org/project/formtips/blob/8.x-1.x/js/formtips.js#L22
$.trim() or even "".trim() doesn't augment the string being checked. So you must actually set the text or html after trimming if you want to avoid leading/trailing whitespace in the tooltip. Maybe do something like this...
// figured you're already looping with filter, no need to do these augmentations outside of the filter callback.
// but you certainly could...
$descriptions = $descriptions.filter(function () {
const $el = $(this);
const trimmed = $.trim($el.text());
$el.text(trimmed);
return trimmed !== '';
});
Comments
Comment #2
joelpittetThat sounds like a promising idea! I've never heard of "pre-line" Is there an example of this somewhere in core that I could test?
Comment #3
joelpittetFeel free to submit a patch with the changes, though I've not got es6 stuff setup on this module yet.