Skip to content
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

Merged
merged 4 commits into from
Jan 3, 2025

Conversation

marthasharkey
Copy link
Contributor

@marthasharkey marthasharkey commented Jan 2, 2025

Pull Request Description

Important Notes

Checklist

Please ensure that the following checklist has been satisfied before submitting the PR:

  • The documentation has been updated, if necessary.
  • Screenshots/screencasts have been attached, if there are any visual changes. For interactive or animated visual changes, a screencast is preferred.
  • All code follows the
    Scala,
    Java,
    TypeScript,
    and
    Rust
    style guides. In case you are using a language not listed above, follow the Rust style guide.
  • Unit tests have been written where possible.
  • If meaningful changes were made to logic or tests affecting Enso Cloud integration in the libraries,
    or the Snowflake database integration, a run of the Extra Tests has been scheduled.
    • If applicable, it is suggested to paste a link to a successful run of the Extra Tests.

Copy link

github-actions bot commented Jan 2, 2025

🧪 Storybook is successfully deployed!

📊 Dashboard:

@marthasharkey marthasharkey changed the title Wip/mk/hyperlink ag grid fix special characters in hyperlink in ag grid Jan 2, 2025
@@ -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) =>
Copy link
Contributor Author

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

@marthasharkey marthasharkey marked this pull request as ready for review January 3, 2025 10:56
@@ -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]*)?/,
Copy link
Contributor

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.

Copy link
Contributor

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

Comment on lines 225 to 228
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>`,
)
Copy link
Contributor

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.

@marthasharkey marthasharkey added CI: No changelog needed Do not require a changelog entry for this PR. CI: Ready to merge This PR is eligible for automatic merge labels Jan 3, 2025
@mergify mergify bot merged commit dee53b7 into develop Jan 3, 2025
41 of 43 checks passed
@mergify mergify bot deleted the wip/mk/hyperlink-ag-grid branch January 3, 2025 16:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CI: No changelog needed Do not require a changelog entry for this PR. CI: Ready to merge This PR is eligible for automatic merge
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Vizualisation Hyperlink breaks on special characters
2 participants