#103144crop ViewHelper has a curious interpretation of respecting word boundaries
Description
Hello,
the f:format.crop ViewHelper does not take the full string into account to cut at position of maxCharacters.
```<f:format maxcharacters="18" respecthtml="true" respectwordboundaries="true"><p>Ein schönes Bild</p><img src="#" width="128" height="128" title="nice" alt="sonne"><p>Nicht wahr?</p><br>``` <p>Results in:</p> ```<br><p>Ein schönes Bild</p><img src="#" width="128" height="128" title="nice" alt="sonne"><p>Ni…</p><br>``` <p>The HtmlCropper cuts all text and html parts into sections. So, we have sections with p, sections with img and of cause two text sections in the resulting array. The expected behavior is, that the HtmlCropper should cut in front of “Nicht”, but instead it cuts inside of that word. That’s because internally this text is in another section and does not know anything about the previous text. That’s why HtmlCropper thinks, that “Nichts” would be the first and only word and that why it cuts within the word instead of in front of that word.</p> <p>German explanation with example: <a href="https://www.typo3lexikon.de/typo3-tutorials/core/systemextensions/fluid/viewhelper/format/#beispiel-nicht-im-html-trennen" target="_blank" rel="noreferrer">https://www.typo3lexikon.de/typo3-tutorials/core/systemextensions/fluid/viewhelper/format/#beispiel-nicht-im-html-trennen</a></p> <p>Stefan</p></f:format>
Reviews 2
History 312
-
Georg Ringer commented and changed status
NewAccepted 06/20/24, 20:20 -
Gerrit Code Review pushed patch set 1 for main to change 84854 status
AcceptedUnder Review 06/21/24, 23:03 -
Gerrit Code Review pushed patch set 2 for main to change 84854 06/22/24, 03:42
-
Gerrit Code Review pushed patch set 3 for main to change 84854 08/19/24, 06:20
-
Gerrit Code Review pushed patch set 4 for main to change 84854 10/18/24, 13:43
-
Gerrit Code Review pushed patch set 5 for main to change 84854 10/21/24, 06:59
-
Gerrit Code Review pushed patch set 6 for main to change 84854 03/11/25, 10:36
-
Gerrit Code Review pushed patch set 7 for main to change 84854 04/01/25, 17:12
-
Gerrit Code Review pushed patch set 8 for main to change 84854 04/02/25, 19:17
-
Gerrit Code Review pushed patch set 1 for 13.4 to change 88924 04/02/25, 21:29
-
Stefan Froemken commented and changed status
Under ReviewResolved done0 %100 % 04/02/25, 22:15Applied in changeset commit:39746e8044966f68cefa621b107d17fb3f439dc4.
-
Benni Mack changed status
ResolvedClosed 08/12/25, 14:36
confirmed but no clue how this could be really fixed or if there are any good html cropper out there. projects like https://github.com/judev/php-htmltruncator are also rather old