mirror of
https://github.com/ether/etherpad-lite.git
synced 2025-01-20 06:29:53 +01:00
Do not use cookie for pad shortcuts
Users still cannot choose which shortcuts they want to enable/disable, so it does not make sense (yet) to have a cookie with that preference. This can be reverted once we create an UI to change shortcuts, but PLEASE PLEASE PLEASE do not read the cookie every time handleKeyEvent is called!!! This is an adjustment to #2891.
This commit is contained in:
parent
1ebcf0dc47
commit
cf686282ef
3 changed files with 2 additions and 38 deletions
|
@ -1197,6 +1197,7 @@ function handleClientReady(client, message)
|
|||
"userColor": authorColorId,
|
||||
"padId": message.padId,
|
||||
"padOptions": settings.padOptions,
|
||||
"padShortcutEnabled": settings.padShortcutEnabled,
|
||||
"initialTitle": "Pad: " + message.padId,
|
||||
"opts": {},
|
||||
// tell the client the number of the latest chat-message, which will be
|
||||
|
|
|
@ -48,12 +48,6 @@ exports.expressCreateServer = function (hook_name, args, cb) {
|
|||
res.cookie('language', settings.padOptions.lang);
|
||||
}
|
||||
|
||||
// Enable the pad shortcut keys from settings.json
|
||||
if (settings.padShortcutEnabled !== undefined)
|
||||
{
|
||||
res.cookie('padShortcutEnabled', JSON.stringify(settings.padShortcutEnabled));
|
||||
}
|
||||
|
||||
// The below might break for pads being rewritten
|
||||
var isReadOnly = req.url.indexOf("/p/r.") === 0;
|
||||
|
||||
|
|
|
@ -61,7 +61,6 @@ function Ace2Inner(){
|
|||
var SkipList = require('./skiplist');
|
||||
var undoModule = require('./undomodule').undoModule;
|
||||
var AttributeManager = require('./AttributeManager');
|
||||
var readCookie = require('./pad_utils').readCookie;
|
||||
|
||||
var DEBUG = false; //$$ build script replaces the string "var DEBUG=true;//$$" with "var DEBUG=false;"
|
||||
// changed to false
|
||||
|
@ -3641,37 +3640,6 @@ function Ace2Inner(){
|
|||
|
||||
function handleKeyEvent(evt)
|
||||
{
|
||||
// Get the enabled shortcut keys
|
||||
// If it can't find the cookie, use default values
|
||||
// Cookie should normally be set
|
||||
// See settings.json
|
||||
var padShortcutEnabled = JSON.parse(decodeURIComponent(readCookie('padShortcutEnabled')));
|
||||
if (!padShortcutEnabled)
|
||||
{
|
||||
padShortcutEnabled = {
|
||||
"altF9" : true,
|
||||
"altC" : true,
|
||||
"cmdShift2" : true,
|
||||
"delete" : true,
|
||||
"return" : true,
|
||||
"cmdS" : true,
|
||||
"tab" : true,
|
||||
"cmdZ" : true,
|
||||
"cmdY" : true,
|
||||
"cmdI" : true,
|
||||
"cmdB" : true,
|
||||
"cmdU" : true,
|
||||
"cmd5" : true,
|
||||
"cmdShiftL" : true,
|
||||
"cmdShiftN" : true,
|
||||
"cmdShiftC" : true,
|
||||
"cmdH" : true,
|
||||
"ctrlHome" : true,
|
||||
"pageUp" : true,
|
||||
"pageDown" : true,
|
||||
}
|
||||
}
|
||||
|
||||
// if (DEBUG && window.DONT_INCORP) return;
|
||||
if (!isEditable) return;
|
||||
var type = evt.type;
|
||||
|
@ -3755,6 +3723,7 @@ function Ace2Inner(){
|
|||
specialHandled = _.contains(specialHandledInHook, true);
|
||||
}
|
||||
|
||||
var padShortcutEnabled = parent.parent.clientVars.padShortcutEnabled;
|
||||
if ((!specialHandled) && altKey && isTypeForSpecialKey && keyCode == 120 && padShortcutEnabled.altF9){
|
||||
// Alt F9 focuses on the File Menu and/or editbar.
|
||||
// Note that while most editors use Alt F10 this is not desirable
|
||||
|
|
Loading…
Reference in a new issue