how can i add a shortcut key to the editor to submit?

Last post 03-18-2009, 3:19 AM by rewalax. 3 replies.
Sort Posts: Previous Next
  •  03-16-2009, 4:50 AM 49914

    how can i add a shortcut key to the editor to submit?

    how can i add a shortcut key to the editor to submit?for example, users can press ctrl+enter to submit what they've inputted instead of clicking a submit button.
    thank you
  •  03-16-2009, 11:00 AM 49930 in reply to 49914

    Re: how can i add a shortcut key to the editor to submit?

    Hi,
     
    You can catch the key event this way:
     
    var editor1=document.getElementById("<%=Editor1.ClientID%>");
    if(editor1.IsReady)CuteEditor_OnInitialized(editor);
    function CuteEditor_OnInitialized(editor)
    {
     editor1.HookEvent(editor1.GetDocument(),"keydown",function(e)
     {
      var e=e||editor1.GetWindow().event;
      //alert(e.keyCode);
     });
    }
     
    Regards,
    Terry
     
  •  03-16-2009, 1:01 PM 49939 in reply to 49930

    Re: how can i add a shortcut key to the editor to submit?

    thank you for your answer and I've solved the problem above(submit by press ctrl+enter),but now,although I can press ctrl+enter to submit ,if I do it twice or more ,an error occurs which says "error 800a025e caused by this action can not be completed". It doesnt occur in Firefox
     
    Error:由于出现错误 800a025e 而导致此项操作无法完成。(error 800a025e caused by this action can not be completed)
    Address:http://localhost:22146/WXBlog/CuteSoft_Client/CuteEditor/Load.ashx?type=scripts&file=IE_Loader
     
    I googled it and it turned out once a  bug in FCKEditor(a famous editor),and i wonder if it's a bug of CuteEditor or just my mistake somewhere.
     
    The following is my code to implement "ctrl + enter" shortcut key.
            Content.Attributes["oninitialized"] = "CuteEditor_OnInitialized(this)";
     
            function CuteEditor_OnInitialized(editor) {
                if (editor.IsReady) {
                    editor.HookEvent(editor.GetDocument(), "keydown", function(e) {
                        var e = e || editor.GetWindow().event;
                        if (e.ctrlKey && e.keyCode == 13) {
                            document.getElementById("<%= bBlogSubmit.ClientID %>").click();
                        }
                    });
                }
            }
     
     
    waiting for your answer. thank you
  •  03-18-2009, 3:19 AM 50013 in reply to 49939

    Re: how can i add a shortcut key to the editor to submit?

    anybody found this issue too?
View as RSS news feed in XML