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

RichTextEditor removes relative urls #6834

Open
derflotzi opened this issue Nov 19, 2024 · 1 comment
Open

RichTextEditor removes relative urls #6834

derflotzi opened this issue Nov 19, 2024 · 1 comment
Labels
enhancement New feature or request refactor Internal improvement vaadin-rich-text-editor

Comments

@derflotzi
Copy link

Description

If you enter a link with a relative URL in the RichTextEditor, the link is removed.
Example: <a href="/my/realitve/url">link</a> results in <a rel="nofollow">link</a>

This is because the Jsoup implementation in the method static String sanitize(String html) removes the link.

Solution: If the visibility of the sanitize method were more open, I could adjust this behaviour myself.

Expected outcome

Output should be

<a href="/my/realitve/url">link</a>

Minimal reproducible example

RichTextEditor description = new RichTextEditor();
description.setValue("<a href=\"/my/realitve/url\">link</a>");
System.out.println(description.asHtml().getValue());
// results in: <a rel="nofollow">link</a>

Steps to reproduce

  1. Add the snippet above to a view
  2. See the printed wrong result

Environment

Vaadin version(s): 24.5.3
OS: macOS Sonoma 14.6.1

Browsers

Issue is not browser related

@yuriy-fix
Copy link
Contributor

We could consider exposing the sanitize, so sanitization rules can be user-defined.

@yuriy-fix yuriy-fix added enhancement New feature or request refactor Internal improvement vaadin-rich-text-editor labels Nov 21, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request refactor Internal improvement vaadin-rich-text-editor
Projects
None yet
Development

No branches or pull requests

2 participants