Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[SDAAP-56] Quirk in the headline character count counts the last spac… #4166

Merged
merged 4 commits into from
Jan 3, 2023

Conversation

marwoodandrew
Copy link
Contributor

…e as 6 characters

@tomaskikutis
Copy link
Member

It isn't clean to say the string is HTML when it's not :) I think trimming before counting characters would help. If not, post a snippet of text where it doesn't count correctly and I'll fix it.

@marwoodandrew
Copy link
Contributor Author

@tomaskikutis I think it is html, at least at the point the character count is being done it is :) I'm not saying it should be!

If you look at the ticket you'll see a real world example of a string that demonstrates the issue with a video!

If you log into that PR's test instance instance find the story slugged "BAD HEADLINE LENGTH" and edit it, you'll note the length of headline "123<>4" is given as 6 (correct) and is indeed text, Now just go add a space at the end and magicaly the headline length becomes 18 which by some strange coincidence has the same length as the string 123&lt;&gt;4&nbsp;

image

If you inspect the element you get the following, which shows the value being a bit html like.
<div class="text-editor editor-type-html ng-isolate-scope medium-editor-element" tabindex="10" sd-text-editor-drop-zone="false" sd-focus-element="" data-append-element=".field" data-append-class="active" placeholder="Add content here" ng-show="type == 'text' || !type" spellcheck="false" contenteditable="true" data-medium-editor-element="true" role="textbox" aria-multiline="true" data-medium-editor-editor-index="5" medium-editor-index="d584b5b5-92b9-5498-a376-fabad068b553" data-medium-focused="true">123&lt;&gt;4&nbsp;</div>

I was simply reverting the behavour back to how it was in 1.33, which incidentaly was wrong although it handles the &nbsp; it doesn't handle the &lt; or &gt; in I think cleanHTML might need to do more!

…ts the last space as 6 characters""

This reverts commit 91da9bc.
@tomaskikutis
Copy link
Member

You're right, it does escape spaces to HTML entities which then causes wrong character count. I didn't notice it's about editor2.

@tomaskikutis tomaskikutis merged commit ce3b61e into superdesk:develop Jan 3, 2023
MarkLark86 pushed a commit to MarkLark86/superdesk-client-core that referenced this pull request Feb 7, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants