-
Notifications
You must be signed in to change notification settings - Fork 87
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
Fix 607 - Format http(s) links and emails as <a> in query results #4257
Conversation
…ments in query results
a1d2912
to
75aba94
Compare
We have a mix between |
src/misc/filters.js
Outdated
* @param {angular.$sce} $sce Angular sce service. | ||
* @param {!Array.<!ngeox.StringToHtmlReplacement>} | ||
* ngeoStringToHtmlReplacements List of replacements for string to html. | ||
* html. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
minor: extra html.
comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks very good.
Thanks for the reply.
StringToHtmlReplacements is the global value that is an array, i.e. StringToHtmlReplacement is the ngeox definition of what a single entity of a "replacement" is, that is: the expression and the template when we have a match. i.e.: It think this is okay as it is. Please, let me know if you agree. |
@adube ok, understood. Please merge |
This patch introduces a new filter in ngeo that allows to return a value as trusted HTML in addition to automatically converting http(s) or email strings into anchor html strings.
StringToHtmlReplacements
is an angular constant that defines expressions that can be converted and a template to use when a string matches.ngeoTrustHtmlAuto
is the new filter that does likengeoTrustHtml
, but will replace strings with html if a match is found.Note: Instead of the regex provided in 607 for the email, I used the one from: https://www.regular-expressions.info/email.html, which is lighter when used in a case-insensitive regex and more robust.