-
Notifications
You must be signed in to change notification settings - Fork 323
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 special characters in hyperlink in ag grid #11962
Conversation
🧪 Storybook is successfully deployed!📊 Dashboard:
|
@@ -438,10 +442,7 @@ function toLinkField(fieldName: string, options: LinkFieldOptions = {}): ColDef | |||
params.node?.rowPinned === 'top' ? | |||
null | |||
: `Double click to view this ${tooltipValue ?? 'value'} in a separate component`, | |||
cellRenderer: (params: ICellRendererParams) => |
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.
Removing this as it is no longer needed- the pinned row was the original set up of the data metrics and this has been leftover from that
@@ -197,7 +197,11 @@ function formatText(params: ICellRendererParams) { | |||
.replaceAll('>', '>') | |||
|
|||
if (textFormatterSelected.value === 'off') { | |||
return htmlEscaped.replace(/^\s+|\s+$/g, ' ') | |||
const replaceLinks = htmlEscaped.replace( | |||
/https?:\/\/([a-zA-Z0-9-]+(\.[a-zA-Z0-9-]+)+)(:[0-9]+)?(\/[-()_.!~*';/?:%@&=+$,A-Za-z0-9]*)?/, |
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.
This regexp could use some test cases. test.each
may be helpful. I would test what the RE matches rather than the expected result of inserting the <a>
tag so that it is independent of the details of link rendering.
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.
Actually, we have a LINKABLE_URL_REGEX
that might be appropriate here
const replaceLinks = replaceSpaces.replace( | ||
/https?:\/\/([-()_.!~*';/?:@&=+$,A-Za-z0-9])+/g, | ||
/https?:\/\/([a-zA-Z0-9-]+(\.[a-zA-Z0-9-]+)+)(:[0-9]+)?(\/[-()_.!~*';/?:%@&=+$,A-Za-z0-9]*)?/, | ||
(url: string) => `<a href="${url}" target="_blank" class="link">${url}</a>`, | ||
) |
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.
This is complex enough to warrant extraction to a function rather than duplicating it.
Pull Request Description
Important Notes
Checklist
Please ensure that the following checklist has been satisfied before submitting the PR:
Scala,
Java,
TypeScript,
and
Rust
style guides. In case you are using a language not listed above, follow the Rust style guide.
or the Snowflake database integration, a run of the Extra Tests has been scheduled.