Problem/Motivation
The module is only decoding first occurence of at the moment, while other popular HTML entities are ignored. This especially affects CKEditor, because it returns encoded entities that are counted as more than 1 character.
Steps to reproduce
- Enable max length for CKEditor-enabled field.
- Enter
<into the CKEditor area in WYSIWYG mode. - The counter is expected to decrease by 1, but it changes by 4.
Proposed resolution
Decode at least the most common entities: & < > " and all occurrences of the non-breaking space, not just the first one.
Remaining tasks
No.
User interface changes
No.
API changes
No.
Data model changes
No.
| Comment | File | Size | Author |
|---|---|---|---|
| #3 | maxlength-decode-common-html-entities-3233046-3.diff | 3.06 KB | dmitriy.trt |
Issue fork maxlength-3233046
Show commands
Start within a Git clone of the project using the version control instructions.
Or, if you do not have SSH keys set up on git.drupalcode.org:
Comments
Comment #3
dmitriy.trt commentedSubmitted MR!2.
I'm also attaching a diff at commit
f8f2ee28for a stable reference from composer files.Comment #4
dmitriy.trt commentedAdded information about issue with decoding the
that is also fixed by the MR.Comment #5
cedeweyComment #6
cedeweyAssigning to Jeff to review.
Comment #7
cedeweyJeff to review and look into whether there's JavaScript function that can be used to address this.
Comment #10
hipp2bsquare commentedI created a new merge request -- MR 15, 3233046-simplified-decode-html-entities
This is based on Dmitriy.trt's work, but it doesn't try to define a set, limited list of html entities -- it instead finds and string using the html entity structure ( &
chars;) and treats them as a single character for the purposes of counting and truncation.Clayton, I'm turning this over to you to test. Thanks!
Comment #11
cedeweyI've tested this out with
<, and"and they all now count as expected. Marking reviewed and tested and assigning to Steven for a final code review.Comment #13
hipp2bsquare commentedComment #15
hipp2bsquare commentedsrdtwc and I did peer code review. This work is merged into the dev branch. Thanks everyone for your contributions.