2

When using Firefox for content authoring, when you paste a paragraph of content in your rich text field, it adds unwanted
tags at the end.

I can replicate this issue on the Vanilla instance of Sitecore Version 9.3 and Sitecore Version 10.

Steps to replicate:

  1. Open the Content editor
  2. Select default home page
  3. Select the Text field under Data and click Show editor. enter image description here
  4. Select the content and cut and paste the same (you will not few extra lines added at the bottom)
  5. Click Accept in Rich Text Editor
  6. Click Edit Html
  7. You can now see a new BR tag added <br class="t-last-br"/>

enter image description here

Does anyone know why this happens, it happens only in Firefox. We tried this in Version 9.3 and 10. This may be an issue in other versions too.

2 Answers 2

4

We experienced the same issue on a Sitecore 9.3 instance and fixed it adding the following code at the top of the \sitecore\shell\Controls\Rich Text Editor\RichText Commands.js file in our solution, as recommended by the Sitecore Support team:

function RadEditorCustomFilter() {
    RadEditorCustomFilter.initializeBase(this);
    this.set_isDom(false);
    this.set_enabled(true);
    this.set_name("RadEditor filter");
    this.set_description("RadEditor filter description");
}
RadEditorCustomFilter.prototype =
    {
        getHtmlContent: function (content) {
            if (Telerik.Web.Browser.ff) {
                content = content.replace('<br class="t-last-br" />\n', '');
            }
            return content;
        }
    }
RadEditorCustomFilter.registerClass('RadEditorCustomFilter', Telerik.Web.UI.Editor.Filter);

And inside \sitecore\shell\Controls\Rich Text Editor\EditorPage.aspx, inside OnClientLoad add:

var customFilter = new RadEditorCustomFilter();
editor.get_filtersManager().add(customFilter);
2
  • That worked @Alessandro Faniuolo. thanks for that Feb 5, 2021 at 2:08
  • I have recently faced the same issue, we have applied the above fix, but it did not work as expected. I had debugged the javascript and update as below to achieve the fix. Instead of content = content.replace('<br class="t-last-br" />\n', ''); actual fix is - content = content.replace('<br class="t-last-br">\n', ''); Apr 25, 2022 at 16:10
0

I too had faced the similar issue and changing the "HtmlEditor.RemoveScripts" value to "false" fixed it for me. By default, the value for this setting is set to true. This setting is present in Sitecore.Config. The screenshot below for reference:

enter image description here

2
  • we have this value set to false already. let me check show config to make sure it is in effect. Feb 4, 2021 at 22:08
  • I can confirm that the setting is set to false, but the issue still exists Feb 4, 2021 at 22:21

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.