diff --git a/src/ep.json b/src/ep.json index ec09696c5..ad357846c 100644 --- a/src/ep.json +++ b/src/ep.json @@ -12,6 +12,12 @@ "shutdown": "ep_etherpad-lite/node/utils/Minify" } }, + { + "name": "chat", + "client_hooks": { + "aceKeyEvent": "ep_etherpad-lite/static/js/chat" + } + }, { "name": "express", "hooks": { diff --git a/src/static/js/ace2_inner.js b/src/static/js/ace2_inner.js index 0f3bc36e7..6874c85fd 100644 --- a/src/static/js/ace2_inner.js +++ b/src/static/js/ace2_inner.js @@ -2585,15 +2585,6 @@ function Ace2Inner(editorInfo, cssManagers) { firstEditbarElement.focus(); evt.preventDefault(); } - if (!specialHandled && type === 'keydown' && - altKey && keyCode === 67 && - padShortcutEnabled.altC) { - // Alt c focuses on the Chat window - evt.target.blur(); - parent.parent.chat.show(); - parent.parent.chat.focus(); - evt.preventDefault(); - } if (!specialHandled && type === 'keydown' && evt.ctrlKey && shiftKey && keyCode === 50 && padShortcutEnabled.cmdShift2) { diff --git a/src/static/js/chat.js b/src/static/js/chat.js index 16ba2f946..43fa8efd4 100755 --- a/src/static/js/chat.js +++ b/src/static/js/chat.js @@ -296,3 +296,13 @@ exports.chat = (() => { }, }; })(); + +exports.aceKeyEvent = (hookName, {evt}) => { + const {altC} = window.clientVars.padShortcutEnabled; + if (evt.type !== 'keydown' || !evt.altKey || evt.keyCode !== 67 || !altC) return; + evt.target.blur(); + exports.chat.show(); + exports.chat.focus(); + evt.preventDefault(); + return true; +};