phplist3 icon indicating copy to clipboard operation
phplist3 copied to clipboard

Shortening text that needs to be multibyte aware

Open bramley opened this issue 2 years ago • 1 comments

Description

shortenTextDisplay() currently returns a span element which can be used when displaying URLs or email addresses.

This change splits the part of shortening text that needs to be multibyte aware into a separate function so that it can be used on its own to shorten other text, such as an attribute name in a select list.

It also fixes a few small issues that were introduced in earlier pull requests

  • the non multibyte version of the function had a sprintf() with more parameters than %s placeholders
  • the multibyte version had an ondblclick() handler which had been removed from the non multibyte version
  • when a URL had been shortened the title tooltip didn't show the original text but that with leading https:// removed

Related Issue

The new function shortenText() can be used instead of shortenTextDisplay() in PR https://github.com/phpList/phplist3/pull/876

Screenshots (if appropriate):

bramley avatar Jul 02 '22 10:07 bramley

I've tested this and it works fine. I will also push the tests I use to the repo in a new PR. It related to #876 which can be updated to use the new shortenText. There's a slight difference in that substr takes the first X characters, where shortenText takes the first and the last and puts ... in between. But that's cosmetic.

michield avatar Sep 19 '22 13:09 michield

This pull request has been mentioned on phpList Discuss. There might be relevant details there:

https://discuss.phplist.org/t/3-6-9-release-candidate-ready-for-testing/8445/1

phpListDockerBot avatar Sep 30 '22 11:09 phpListDockerBot

This pull request has been mentioned on phpList Discuss. There might be relevant details there:

https://discuss.phplist.org/t/phplist-3-6-9-is-available-for-download/8474/1

phpListDockerBot avatar Oct 20 '22 15:10 phpListDockerBot