- Issue created by @Sapnakhatri
- Merge request !8Issue #3440466: Implement Word Count Feature for text, textarea and ckeditor5 fields in textfield_counter Module. → (Open) created by Sapnakhatri
- Issue was unassigned.
- Status changed to Needs review
7 months ago 5:42am 23 April 2024 - Status changed to RTBC
6 months ago 6:20am 9 June 2024 - 🇮🇳India adwivedi008
Test the MR-8 changes with CKE-5 and Drupal-10 and its working fine as the feature is expected
Moving the issue to RTBC
- Status changed to Needs work
3 months ago 12:24pm 22 August 2024 - 🇬🇧United Kingdom hocu London
This one has one small bug, though. The counter works fine for words, while entering text. But as soon as you clear the field, "Used" value is still 1, see the screenshots.
The issue is around:
var rawInput = $("<div/>").html($(this).val()); input = rawInput.text().trim().replace(/(\r?\n|\r)+/g, " "); var words = input.split(" "); currentLength = words.length;
When you split an empty string, you get an array with one empty string. So,
var words = input.split(" ")
returns[""]
. Therefore, the length is 1.The solution is simple though, we just need a check for
rawInput.text()
, and if it's not empty, we can proceed to sanitise its input and split it.I'll submit a patch for that one today.
- Assigned to hocu
- Issue was unassigned.
- Status changed to Needs review
3 months ago 12:58pm 22 August 2024 - Status changed to RTBC
3 months ago 1:03pm 27 August 2024 Hello,
I have tested this feature on my local. It looks good to me. Attaching screenshot for reference. Moving this to RTBC.
- Status changed to Needs review
3 months ago 1:06pm 27 August 2024 - Status changed to RTBC
3 months ago 1:07pm 27 August 2024