Undo doesn't work for Delete and Backspace

10 posts, 1 answers
  1. Caesar
    Caesar avatar
    59 posts
    Member since:
    Aug 2008

    Posted 28 Dec 2010 Link to this post

    Hi,

    If there is an existing text in the editor, setting focus by clicking and then pressing delete or backspace to delete text, then the undo button isn't enabled.

    Even after typing some other text, and then deleting with delete-key, the undo/redo-chain isn't working as expected.

    This doesn't work in the demo either:
    http://demos.telerik.com/aspnet-ajax/editor/examples/default/defaultcs.aspx

    Regards
    Rikard
  2. Rumen
    Admin
    Rumen avatar
    14361 posts

    Posted 28 Dec 2010 Link to this post

    Hello Rikard,

    The delete / backspace commands are not included into the Undo list to prevent editing performance problems when working with large content.

    Nevertheless, the requested Undo/Redo functionality is already logged in our PITS system and you can vote for it here: http://www.telerik.com/support/pits.aspx#/public/aspnet-ajax/1672.

    We will raise its priority if more users request this feature.

    Best regards,
    Rumen
    the Telerik team
    Browse the vast support resources we have to jump start your development with RadControls for ASP.NET AJAX. See how to integrate our AJAX controls seamlessly in SharePoint 2007/2010 visiting our common SharePoint portal.
  3. Caesar
    Caesar avatar
    59 posts
    Member since:
    Aug 2008

    Posted 10 Jan 2011 Link to this post

    Hi,

    I (and everybody I have asked in my office) thinks deletions are even more important to undo than typing...

    /Rikard
  4. Caesar
    Caesar avatar
    59 posts
    Member since:
    Aug 2008

    Posted 31 Jan 2011 Link to this post

    Hi,

    Is there any other solution for this? For example replacing some internal telerik javascript method?
    No one that I have asked understands why there is an undo button that doesn't undo deletions...

    Regards
    Caesar
  5. Answer
    Rumen
    Admin
    Rumen avatar
    14361 posts

    Posted 31 Jan 2011 Link to this post

    Hello Caesar,

    Please, try the following JavaScript function that will enable the DeleteKey command in the Undo / Redo list:

    <telerik:RadEditor ID="RadEditor1" runat="server" OnClientLoad="OnClientLoad">
    </telerik:RadEditor>
    <script type="text/javascript">
    function OnClientLoad(editor, args)
    {
        editor.attachEventHandler("onkeydown", function (e) {
            if (e.keyCode == 8 || e.keyCode == 46) {
                var oCmd = new Telerik.Web.UI.Editor.GenericCommand("DeleteKey", editor.get_contentWindow(), editor);
                editor.executeCommand(oCmd);
            }
        });
    }
    </script>



    Best regards,
    Rumen
    the Telerik team
    Browse the vast support resources we have to jump start your development with RadControls for ASP.NET AJAX. See how to integrate our AJAX controls seamlessly in SharePoint 2007/2010 visiting our common SharePoint portal.
  6. Caesar
    Caesar avatar
    59 posts
    Member since:
    Aug 2008

    Posted 02 Feb 2011 Link to this post

    Thanks!

    This works just fine!!!

    Regards
    Caesar
  7. dick
    dick avatar
    11 posts
    Member since:
    Jun 2010

    Posted 29 Jun 2011 Link to this post

    I used the executeCommand and it works fine but if I click Redo, it doesnt work. Any suggestions?
  8. Rumen
    Admin
    Rumen avatar
    14361 posts

    Posted 04 Jul 2011 Link to this post

    Hi Dick,

    Could you please provide detailed steps to reproduce the problem? Right now I am unable to reproduce the issue as shown in the following video: http://screencast.com/t/rFufKIvd.

    Best wishes,
    Rumen
    the Telerik team

    Browse the vast support resources we have to jump start your development with RadControls for ASP.NET AJAX. See how to integrate our AJAX controls seamlessly in SharePoint 2007/2010 visiting our common SharePoint portal.

  9. Francisco
    Francisco avatar
    2 posts
    Member since:
    Feb 2012

    Posted 01 Feb 2012 Link to this post

    Hi, I have tried this solution and is not working for me.

    I have seen that in my case the OnClientLoad="OnClientLoad" is not doing anything, the function is not being triggered.

    In my case I have the RadEditor inside of a Telerik:RadTabStrip as follows:

       <telerik:RadTabStrip ID="ResourceTabContainer" runat="server" SelectedIndex="0" MultiPageID="RadMultiPage">
                                    <Tabs>
                                        <telerik:RadTab Text="Editor" PageViewID="EditorTab" Value="EditorTab">
                                        </telerik:RadTab>
                                    </Tabs>
                                </telerik:RadTabStrip>
                                <telerik:RadMultiPage ID="RadMultiPage" runat="server" SelectedIndex="0">
                                    <telerik:RadPageView ID="EditorRadPageView" runat="server">
                                        <telerik:RadEditor ID="ResourceValueEditor" runat="server" SkinID="BasicSetOfTools" OnClientLoad="OnClientLoad"
                                            Width="100%" Height="400px" StripFormattingOnPaste="MSWordRemoveAll">
                                            <SpellCheckSettings spellcheckprovider="EditDistanceProvider"></SpellCheckSettings>
                                        </telerik:RadEditor>
                                    </telerik:RadPageView>
                                </telerik:RadMultiPage>

    And my java script function is this:

    function OnClientLoad(editor, args) {
       alert("OnClientLoad function called");
                editor.attachEventHandler("onkeydown", function (e) {
                    if (e.keyCode == 8 || e.keyCode == 46) {
                        var oCmd = new Telerik.Web.UI.Editor.GenericCommand("DeleteKey", editor.get_contentWindow(), editor);
                        editor.executeCommand(oCmd);
                    }
                });
            }

    But I can't even see the "OnClientLoad function called"  message.

    Could you please tell me what could be the problem?

    Thanks in advance
  10. Francisco
    Francisco avatar
    2 posts
    Member since:
    Feb 2012

    Posted 01 Feb 2012 Link to this post

    Never mind

    The problem was an overwrite for the OnClientLoad event from the code behind that I wasn't aware of.

    Thanks
Back to Top