Skip to content

Conversation

@mcl-sz
Copy link
Contributor

@mcl-sz mcl-sz commented Oct 1, 2025

Prerequisites

  • I have added steps to test this contribution in the description below

If there's an existing issue for this PR then this fixes #18127 #16922

Description

In Tinymce, an empty paragraph is filled with a non-breaking space character. When saving the content, the DOMParser replaces this empty non-breaking space character with an   entity. This causes the editor to be dirty when the content contains an empty paragraph. By making these the same before the comparison, this is prevented.

Tesing

  • In Umbraco 13 add a Richtext editor (Umbraco.TinyMCE) to a Doctype.
  • Optionally add an Blockgrid editor and add an element that contains an Richtext editor.
  • Create a page of this doctype and put 2 lines of text in the editor and separate them with an empty paragraph (simply push Enter).
  • Save the page.
  • Click inside the editor and then click outside the editor.
  • Navigate to another page, a "Unsaved changes"-dialog will appear, even without changing anything.

Apply the patch and try the last 2 steps again. The "Unsaved changes"-dialog doesn't appear anymore.

In Tinymce, an empty paragraph is marked with a non-breaking space character.
When saving the content, the DOMParser replaces this empty non-breaking space character with an   entity.
This causes the editor to always be dirty when the content contains an empty paragraph.
By making these the same befor the comparison, this is prevented.
@github-actions
Copy link

github-actions bot commented Oct 1, 2025

Hi there @mcl-sz, thank you for this contribution! 👍

While we wait for one of the Core Collaborators team to have a look at your work, we wanted to let you know about that we have a checklist for some of the things we will consider during review:

  • It's clear what problem this is solving, there's a connected issue or a description of what the changes do and how to test them
  • The automated tests all pass (see "Checks" tab on this PR)
  • The level of security for this contribution is the same or improved
  • The level of performance for this contribution is the same or improved
  • Avoids creating breaking changes; note that behavioral changes might also be perceived as breaking
  • If this is a new feature, Umbraco HQ provided guidance on the implementation beforehand
  • 💡 The contribution looks original and the contributor is presumably allowed to share it

Don't worry if you got something wrong. We like to think of a pull request as the start of a conversation, we're happy to provide guidance on improving your contribution.

If you realize that you might want to make some changes then you can do that by adding new commits to the branch you created for this work and pushing new commits. They should then automatically show up as updates to this pull request.

Thanks, from your friendly Umbraco GitHub bot 🤖 🙂

@mcl-sz mcl-sz changed the title Prevent RTE being marked as dirty when content containt empty paragraph Prevent RTE being marked as dirty when content contains empty paragraph Oct 1, 2025
@mcl-sz
Copy link
Contributor Author

mcl-sz commented Oct 1, 2025

It's not entirely clear to me whether I should use the "dev" or "main" branch to submit the change.

Copy link
Contributor

@AndyButland AndyButland left a comment

Choose a reason for hiding this comment

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

Thanks @mcl-sz, it does look like this solves the problem. I've followed along with your testing steps and tried a few more combinations, and am no longer seeing the incorrect dialog for pending changes.

@AndyButland AndyButland merged commit d4805fa into umbraco:v13/dev Oct 1, 2025
20 checks passed
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.

2 participants