on 09-05-2014 2:27 PM
Hi,
Is there someone who knows how I can search for url's in a textarea of feedlistitem and make them clickable?
I already tried this, but the loop doesn't work for me...
http://stackoverflow.com/questions/1500260/detect-urls-in-text-with-javascript
Regards,
RW
Is the issue that you can't add the HTML syntax or the RegEx doesn't work? I believe for security reasons the controls escape the HTML to ensure you can't inject any harmful code for XSS attacks.
https://sapui5.hana.ondemand.com/sdk/#docs/guide/4de64e2e191f4a7297d4fd2d1e233a2d.html
The RenderManager writeAttributeEscape function calls jQuery.sap.escapeHTML
Regards,
Jason
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Robbe,
I have not tried this but I think you can use event handler when clicking on the text area.
Please refer to the link below for more informaitn on event handler for SAP UI5:
Handling Events in Controls - User Interface Add-On for SAP NetWeaver - SAP Library
Regards,
Ashvin
I guess you could extend the controls and implement your own renderer or onAfterRendering method to add the link HTML. However if you are relying on users entering the text, I think you would need to still perform some validation of the URL to ensure that you don't introduce any cross scripting security issues.
Regards,
Jason
Thanks guys, I got it working. I'll probably create a document about this, because I think this might be helpfull for other users to.
What I did was:
1: in the updateFinished event from my sap.m.list I call a function 'createURL'.
2. In the 'createURL' function I loop through all the objects of the same div class
3. Get the plain tekst with the html() function
4. Use autolinker (gregjacobs/Autolinker.js · GitHub ) to detect every url and create the a href tags.
5. replace the old html content with the new
The next thing I'll so is set up the validation.
Kind regards,
RW
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
90 | |
10 | |
10 | |
10 | |
7 | |
7 | |
6 | |
5 | |
4 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.