As for the context:
We're using telerik:RadEditor to e.g. edit and
display html-contents including SVGs (scalable vector graphics). In
this editor we have declared multiple EditorContextMenu containing
EditorTools, which call custom js-functions which in turn perform the
intended actions.
This is an extract of our code:
<script type="text/javascript">
Telerik.Web.UI.Editor.CommandList["ChangeDiagramm"] = function (commandName, editor, args) {
var elem = editor.getSelectedElement();
/* Issue: Depending on the browser, "elem" is or is not a SVG, although the EditorContextMenu, mentioned below, is the only one calling this js-function! */
if (elem.tagName.toUpperCase() == "SVG") {
StartModalDialog('EditHtmliagramRedirect.aspx?ID=' + elem.attributes.name.value, 500, 600, 1);
}
};
</script>
<telerik:RadEditor ExternalDialogsPath="~/Documentation/Documentation/Dialogs/Editor/Controls" EnableTrackChanges="false"
EnableComments="false" ID="ReHtml" EnableResize="False" NewLineMode="P" runat="server" OnClientLoad="OnClientLoaded"
OnClientSubmit="OnClientSubmit" OnClientPasteHtml="OnClientPasteHtml" OnClientCommandExecuting="OnClientCommandExecuting"
OnClientCommandExecuted="OnClientCommandExecuted" OnClientSelectionChange="OnClientSelectionChanged" UseRadContextMenu="False">
<ContextMenus>
<telerik:EditorContextMenu TagName="svg">
<telerik:EditorTool Name="ChangeDiagramm" ShowIcon="true" Text="Edit SVG" ShowText="false" />
</telerik:EditorContextMenu>
<%--
More EditorContextMenus each of which for different html-tags; none of them related to SVGs (img, a, li, span, ...)
--%>
</ContextMenus>
</telerik:RadEditor>
Example-editor-content:
<p>before</p><svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" version="1.1" width="391px" height="221px" viewBox="-0.5 -0.5 391 221" name="c26facdc-b9af-46d3-8de6-7afc86696afa"><defs style=""></defs><g style=""><rect x="0" y="0" width="80" height="80" fill="#ffffff" stroke="#000000" pointer-events="all"></rect>
<path d="M 110 0 L 210 0 L 230 40 L 210 80 L 110 80 L 130 40 Z" fill="#ffffff" stroke="#000000" stroke-miterlimit="10" pointer-events="all"></path>
<path d="M 270 0 L 370 0 L 390 20 L 390 80 L 290 80 L 270 60 L 270 0 Z" fill="#ffffff" stroke="#000000" stroke-miterlimit="10" pointer-events="all"></path>
<path d="M 270 0 L 370 0 L 390 20 L 290 20 Z" fill-opacity="0.05" fill="#000000" stroke="none" pointer-events="all"></path>
<path d="M 270 0 L 290 20 L 290 80 L 270 60 Z" fill-opacity="0.1" fill="#000000" stroke="none" pointer-events="all"></path>
<path d="M 290 80 L 290 20 L 270 0 M 290 20 L 390 20" fill="none" stroke="#000000" stroke-miterlimit="10" pointer-events="all"></path>
<path d="M 40 80 Q 80 220 205 220 Q 330 220 339.55 86.35" fill="none" stroke="#000000" stroke-miterlimit="10" pointer-events="stroke"></path>
<path d="M 339.92 81.12 L 342.91 88.35 L 339.55 86.35 L 335.93 87.85 Z" fill="#000000" stroke="#000000" stroke-miterlimit="10" pointer-events="all"></path>
</g></svg><p>after</p>
For a long time, this code was working as intended in Firefox, Chrome and Microsoft Edge (the new one, based on the chromium engine). I.e. if someone right-clicks the svg-graphic in "Design"-mode of the editor, the corresponding js-function is being called and the "elem"-variable within the js-function has been set to the svg-element of the "Example-editor-content", hence fulfilling the if-statement and opening the modal dialog.
As of recent Edge and Chrome now show "elem" to be the "p"-tag containing the text "after", whereas Firefox still works as intended and sets "elem" to the "svg"-tag. Unfortunately I don't know the exact date, when it broke.
I suspect, the issue might be due to changes in Chrome/Edge/chromium, because the same issue also arises in older versions of our web-application. But since the editor.getSelectedElement-js-function is a black-box to me, I'm not able to confirm this.
Could you please investigate this issue?