Having an issue with an editor. Fairly certain it is not control version related, as it is working fine in a radwindow.
Editor (shortened it)
<telerik:RadEditor ID="txtEditorBody" runat="server" Height="400px" Width="700px" ContentAreaMode="Iframe" OnClientCommandExecuting="customTokens"> <Tools> <telerik:EditorToolGroup Tag="MainToolbar"> <telerik:EditorTool Name="AjaxSpellCheck" Visible="true" Enabled="true" /> <telerik:EditorSeparator /> </telerik:EditorToolGroup> <telerik:EditorToolGroup Tag="Formatting"> <telerik:EditorTool Name="Bold" /> <telerik:EditorSeparator /> <telerik:EditorSplitButton Name="ForeColor"> </telerik:EditorSplitButton> <telerik:EditorSeparator /> <telerik:EditorDropDown Name="FontName"> </telerik:EditorDropDown> <telerik:EditorDropDown Name="FontSize"> </telerik:EditorDropDown> </telerik:EditorToolGroup> <telerik:EditorToolGroup> <telerik:EditorDropDown Name="Info" Width="50" Text="Info"> <telerik:EditorDropDownItem Name="First Name" Value=" %firstname% " /> </telerik:EditorDropDown> </telerik:EditorToolGroup> </Tools> <Content> </Content> <TrackChangesSettings CanAcceptTrackChanges="False"></TrackChangesSettings> </telerik:RadEditor>
Javascript:
function customTokens(editor, args) { var name = args.get_name(); var val = args.get_value(); if (name == "Info") { editor.pasteHtml(val); args.set_cancel(true); };};
It seems that when the page loads, the cursor is not visible in the editor. If you type in it, it then becomes visible. When you ensure the cursor is in the editor, and then click the custom drop down, the cursor leaves the editor. After you click the drop down item, nothing happens, and the cursor does not return to the window. Interestingly if you hi-light some text and then click the drop down item, it just removes the hilighted text instead of inserting the value.
Running a simple alert(name); and alert(val); shows that JS is pulling the correct info to insert, so the issue appears to be with editor.pastHtml()
Even trying something simple like OnLoad and then attempting pasteHtml("Test") does not work.