Skip to content

Conversation

TatuLund
Copy link
Contributor

@TatuLund TatuLund commented Oct 4, 2023

@@ -270,13 +270,17 @@ private String getDeltaValue() {
}

static String sanitize(String html) {
return org.jsoup.Jsoup.clean(html,
org.jsoup.nodes.Document.OutputSettings settings = new org.jsoup.nodes.Document.OutputSettings();
settings.prettyPrint(false);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This doesn't seem to fix the original issue. You can try it with the following:

editor.asDelta().setValue(
                "[{\"attributes\":{\"bold\":true},\"insert\":\"Line 1\"},{\"insert\":\"\\n" + //
                                "\\tIndent 1\\n" + //
                                "\\t\\tIndent 2\\n" + //
                                "Last line with\\textra         spaces and a \\ttab\\n" + //
                                "\\n" + //
                                "\"}] ");

The above will still produce:
Screenshot 2023-10-04 at 11 55 41

In fact, the result is the same even if you return the given html as such from the sanitize method.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I need to dig this deeper. It may be that the fix needs changes in web component as well. Or if the white spaces are stripped also in Quill. If the later, we are stuck. If it is not the trouble maker, i.e. issue in our code, this Java side change is needed anyway, but if it is Quill related, this change is meaningless.

Copy link
Member

@tomivirkki tomivirkki Oct 16, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Did some more investigation. This is actually a proper fix for the Flow RichTextEditor. To fully cover the original issue, another fix to the Web Component is also required. I'm working on that now. Once the Web Component with the fix is available, we can merge this change and close the issue.

@yuriy-fix
Copy link
Contributor

We will proceed with PR once WC alpha6 is available.

@tomivirkki tomivirkki enabled auto-merge (squash) October 26, 2023 08:23
@sonarqubecloud
Copy link

SonarCloud Quality Gate failed.    Quality Gate failed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell B 7 Code Smells

No Coverage information No Coverage information
0.0% 0.0% Duplication

idea Catch issues before they fail your Quality Gate with our IDE extension sonarlint SonarLint

@tomivirkki tomivirkki merged commit 0834f75 into main Oct 26, 2023
@tomivirkki tomivirkki deleted the fix5533 branch October 26, 2023 08:37
vaadin-bot pushed a commit that referenced this pull request Oct 26, 2023
Co-authored-by: Tomi Virkki <tomivirkki@users.noreply.github.com>
vaadin-bot pushed a commit that referenced this pull request Oct 26, 2023
Co-authored-by: Tomi Virkki <tomivirkki@users.noreply.github.com>
tomivirkki added a commit that referenced this pull request Oct 26, 2023
Co-authored-by: Tatu Lund <tatu@vaadin.com>
Co-authored-by: Tomi Virkki <tomivirkki@users.noreply.github.com>
@vaadin-bot
Copy link
Collaborator

This ticket/PR has been released with Vaadin 24.3.0.alpha2 and is also targeting the upcoming stable 24.3.0 version.

tomivirkki added a commit that referenced this pull request Nov 3, 2023
Co-authored-by: Tatu Lund <tatu@vaadin.com>
Co-authored-by: Tomi Virkki <tomivirkki@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

RichTextEditor: extra white space is removed when content is loaded
4 participants