From 9c2cca13729da684aced1a7a49cedd61f1cdf0fe Mon Sep 17 00:00:00 2001 From: Henry Oswald Date: Wed, 23 Jul 2014 14:40:01 +0100 Subject: [PATCH] Added the old backspace highjack back in. It uses jquery and works well. There may be an angular way todo this but the jquery way seemed cleanest to me. --- .../public/coffee/ide/hotkeys/BackspaceHighjack.coffee | 9 +++++++++ services/web/public/coffee/ide/hotkeys/index.coffee | 1 + 2 files changed, 10 insertions(+) create mode 100644 services/web/public/coffee/ide/hotkeys/BackspaceHighjack.coffee diff --git a/services/web/public/coffee/ide/hotkeys/BackspaceHighjack.coffee b/services/web/public/coffee/ide/hotkeys/BackspaceHighjack.coffee new file mode 100644 index 0000000000..b3fcf1cce1 --- /dev/null +++ b/services/web/public/coffee/ide/hotkeys/BackspaceHighjack.coffee @@ -0,0 +1,9 @@ +define [ +], () -> + rx = /INPUT|SELECT|TEXTAREA/i + + $(document).bind "keydown keypress", (e)-> + if e.which == 8 + # 8 == backspace + if !rx.test(e.target.tagName) || e.target.disabled || e.target.readOnly + e.preventDefault() \ No newline at end of file diff --git a/services/web/public/coffee/ide/hotkeys/index.coffee b/services/web/public/coffee/ide/hotkeys/index.coffee index acc7577c6d..7de8bd990f 100644 --- a/services/web/public/coffee/ide/hotkeys/index.coffee +++ b/services/web/public/coffee/ide/hotkeys/index.coffee @@ -1,3 +1,4 @@ define [ + "ide/hotkeys/BackspaceHighjack" "ide/hotkeys/controllers/HotkeysController" ], () -> \ No newline at end of file