Unplanned
Last Updated: 26 May 2022 09:01 by Liyuan
Liyuan
Created on: 26 May 2022 09:01
Category: Editor
Type: Bug Report
0
The context menu closes itself after shown when you call getContextMenuByTagName method

The execution of the getContextMenuByTagName inside the oncontextmenu event of RadEditor hides the context menu once it is shown. This happens in Lightweight render mode only and when the UseRadContextMenu is enabled:

<telerik:RadEditor ID="RadEditor1" runat="server" ContentAreaMode="iframe" OnClientLoad="OnClientLoad">
    <Content>
        <table>
            <tr>
                <td>test</td>
            </tr>
                <tr>
                <td>test</td>
            </tr>
                <tr>
                <td>test</td>
            </tr>
        </table>
    </Content>
</telerik:RadEditor>
<script>
    function OnClientLoad(editor, args) {
        editor.attachEventHandler("oncontextmenu", function (e) {
            var oSelection = editor.getSelectedElement();

            setTimeout(function () {
                var tdMenu = editor.getContextMenuByTagName("TD"); //the call of getContextMenuByTagName closes the context menu when lightweight render mode is used. You can slow down the closing with the setTimeout function or by settign UseRadContextMenu to false.

            }, 1000);
        });

    }
</script>

0 comments