Hi community, in my app users can write comments and they're also able to add references to other users in comments. This is done just like in many other software by typing @ and the users name. When creating the comment the user has an assistant to input the reference via a single click, by doing so I ensure the reference has the correct convention, which in my case is "@Fullname (GID)". In the UI where I show the comment I then use some logic to highlight the name of the current user in those comments if he was referenced there. First I used a calculated attribute with a microflow which converted the simple string message to a string with HTML/CSS encoded highlights. This was working pretty good, but I decided to delete the calculated attribute since it can take quite some time to execute the microflow several times when showing multiple comments on one page. So I decided to transform the text right there where its displayed, without any microflows. Therefore I use a expression rather then a attribute like before. Here you can see the expression: Strangely the text gets displayed like the user inputed it, without any highlights for the current user. However when I use the same expression in the microflow for the calculated attribute everything works again. What am I doing wrong? Why doesn't the replaceAll do the same thing in a expression of text placeholder as it does in the microflow? Any assistance to find a solution without calculated attributes is highly welcomed. Thanks Syman
asked
Syman Scholze
2 answers
1
hi syman,
you can use highlighter widget to highlight the text,
answered
Sharad Suryavanshi
0
It's a bit tricky to figure out based just on the screenshot, but have you considered doing that in a pre-commit hook? I.e. before committing the comment, you look for @-mentions, and add the highlights there?
The way this looks, you will run into problems anyway because your current method doesn't seem to work in case 2 or more people are being @-mentioned.