godgetfun / pagedown

Automatically exported from code.google.com/p/pagedown
Other
0 stars 0 forks source link

Ctrl-z undo twice #60

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
When I type ctrl-z, the undo action is performed twice. Not handling the "y" 
and "z" event in util.addEvent() in Markdown.Editor.js line 1255 corrects this 
problem.

    util.addEvent(inputBox, keyEvent, function (key) {

            // Check to see if we have a button key and, if so execute the callback.
            if ((key.ctrlKey || key.metaKey) && !key.altKey && !key.shiftKey) {

                var keyCode = key.charCode || key.keyCode;
                var keyCodeStr = String.fromCharCode(keyCode).toLowerCase();

                switch (keyCodeStr) {
                    ....
                    case "h":
                        doClick(buttons.heading);
                        break;
                    case "r":
                        doClick(buttons.hr);
                        break;
                    case "y":
                        //doClick(buttons.redo);
                        break;
                    case "z":
                        //if (key.shiftKey) {
                        //    doClick(buttons.redo);
                        //}
                        //else {
                        //    doClick(buttons.undo);
                        //}
                        break;
                    default:
                        return;
                }

Original issue reported on code.google.com by freepl...@gmail.com on 1 Jun 2013 at 4:02