RadzenHtmlEditor behaviour in newer versions

We are trying to update to a new version of Radzen.Blazor, but the RadzenHtmlEditor in newer versions does not behave in the same way as we are currently used to.

Version 7.3.4 is te last version that works as we expect it to work.

Expected behaviour (version 7.3.4 and below):

We copy and paste excel fields into the RadzenHtmlEditor:

In the Paste handler we parse and edit the pasted content if it is from excel:

async Task<string> OnPaste(HtmlEditorPasteEventArgs args)
{
    if (args.Html.Contains("content=Excel.Sheet"))
    {

The Paste handler shows the following value for args.Html:

<html xmlns:v="urn:schemas-microsoft-com:vml"\r\nxmlns:o="urn:schemas-microsoft-com:office:office"\r\nxmlns:x="urn:schemas-microsoft-com:office:excel"\r\nxmlns="http://www.w3.org/TR/REC-html40">\r\n\r\n<head>\r\n<meta http-equiv=Content-Type content="text/html; charset=utf-8">\r\n<meta name=ProgId content=Excel.Sheet>\r\n<meta name=Generator content="Microsoft Excel 15">\r\n<link id=Main-File rel=Main-File\r\nhref="………..">\r\n<link rel=File-List\r\nhref="f…cing=0 width=144 style='border-collapse:\r\n collapse;width:108pt'>\r\n<!--StartFragment-->\r\n <col width=72 span=2 style='width:54pt'>\r\n <tr height=19 style='height:14.25pt'>\r\n  <td height=19 class=xl65 width=72 style='height:14.25pt;width:54pt'>Column 1</td>\r\n  <td class=xl65 width=72 style='width:54pt'>Column 2</td>\r\n </tr>\r\n <tr height=19 style='height:14.25pt'>\r\n  <td height=19 style='height:14.25pt'>Value 1</td>\r\n  <td>Value 2</td>\r\n </tr>\r\n<!--EndFragment-->\r\n</table>\r\n\r\n</body>\r\n\r\n</html>\r\n

After parsing and editing the value in args.Html we have the following result:

<table class='inserted-table'>\r\n<!--StartFragment-->\r\n \r\n <tr>\r\n  <th>Column 1</th>\r\n  <th>Column 2</th>\r\n </tr>\r\n <tr>\r\n  <td>Value 1</td>\r\n  <td>Value 2</td>\r\n </tr>\r\n<!--EndFragment-->\r\n</table>"

The issue (version 7.3.5+):

Starting from version 7.3.5 when we paste the same cells from excel we see that we receive this in our Paste handler:

<col width=72 span=2 style='width:54pt'>\r\n <tr height=19 style='height:14.25pt'>\r\n  <td height=19 class=xl65 width=72 style='height:14.25pt;width:54pt'>Column 1</td>\r\n  <td class=xl65 width=72 style='width:54pt'>Column 2</td>\r\n </tr>\r\n <tr height=19 style='height:14.25pt'>\r\n  <td height=19 style='height:14.25pt'>Value 1</td>\r\n  <td>Value 2</td>\r\n </tr>

I can understand removing a lot of the overhead, but why is the table tag removed? Without the table tag it it will not display as a table in the editor:

We can work around this by adding the table tag ourselves, but not being able to see that the content came from excel might cause issues when pasting other data as checking to see if it starts with ‘<col’ is not as secure as checking if it contains “Excel.Sheet”.

A bigger issue starts to show when using the latest version 9.0.X, if we paste the excel cells they are automatically converted to an image. The Paste handler show this value for args.Html:

<img src="data:image/png;base64,iVBORw0KGgoAAAANSUh.......AABJRU5ErkJggg==">

While this makes the pasted cells look identical to the cells in excel, this also means that it is impossible to edit and style the table in the editor which is not a workable solution for us.

Is it possible to prevent the conversion to image? If not, we either need to stay on a lower version (which is not acceptable in the long run) or we need to find another library/create our own editor (which is also not ideal).

I suspect something from this commit is causing this behavior. What browser are you pasting in?

UPDATE: I reproduced it in Edge. The linked pull request is indeed causing the problem as Excel adds a file in the clipboard as well (the image). We will try to address that issue with the next release.