chat: Move Alt-C handling to chat.js

This commit is contained in:
Richard Hansen 2021-12-05 21:15:00 -05:00
parent 92cd1feb8a
commit 870191f622
3 changed files with 16 additions and 9 deletions

View file

@ -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": {

View file

@ -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) {

View file

@ -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;
};