Paste Event problem.

Hi,

I'm using iframe and also having trouble with PasteCleanup. It doesn't seem to simply clean up within the 'paste' area; I have a feeling it's cleaning up the entire document.


When I paste a line of formatted text, The DOM outside the pasted content becomes corrupted. Many DOM elements are removed, and nodes marked with contenteditable="false" also have their structure altered after the paste. Additionally, the undo functionality no longer works. In some cases, after each paste, the cursor automatically jumps back to the top of the page.


Let's review some of these functions:

updateValue: function() {

e.parent.updateValue()

},

processHtmlPaste

handleHtmlValuePaste

These are the functions that change the content in front:

e.cursorPos = function(...) {

e.classList.add("lastNode"),

r.innerHTML = jy(r.innerHTML, this.isBlazor),

...

}

The cursor position is lost after pasting:

e.pasteInsertHTML= function(...) {

this.positionCursorAfterPaste(...);

..

}

Additionally, I've noticed an issue with executeCommand("insertHTML", ...). It can cause the undo functionality to stop working and may also break the layout. I suspect it triggers a DOM cleanup process.


Thanks you.

Jamin.


1 Reply 1 reply marked as answer

VJ Vinitha Jeyakumar Syncfusion Team July 8, 2026 07:12 AM UTC

Hi jamin,


Reg the issue 1. "removed, and nodes marked with contenteditable="false" also have their structure altered after the paste. Additionally, the undo functionality no longer works. In some cases, after each paste, the cursor automatically jumps back to the top of the page."

We have attempted to reproduce the reported issue using the details provided. however, we were unable to observe the behavior you described in the Rich Text Editor while using Iframe mode.
To assist you further, we have prepared a sample for your reference:
Could you please share the following details to help us reproduce the issue on our end?
  • The exact steps to reproduce the issue.
  • The complete Rich Text Editor code snippet/configuration being used.
  • A video recording or screenshots demonstrating the issue.
  • The current package version of the Rich Text Editor in your application.
Once we receive these details, we will investigate the issue further and provide an appropriate solution.

Reg issue 2. "I've noticed an issue with executeCommand("insertHTML", ...). It can cause the undo functionality to stop working and may also break the layout"
When using the executeCommand method in the Rich Text Editor, the changes made through the API are not automatically added to the undo/redo stack. To enable undo and redo functionality for content modified using executeCommand, you need to explicitly call the saveData method and enableUndo function after the command execution.
Please refer to the following code example:
 function onclick = (): void => {
  editor.executeCommand('insertHTML', 'inserted an html');
  editor.formatter.saveData();
  editor.formatter.enableUndo(editor);
};


Marked as answer
Loader.
Up arrow icon