禁用 phpMyAdmin 对 Ctrl+箭头键的覆盖
Disable phpMyAdmin's Overriding of Ctrl+Arrow Keys
在 phpMyAdmin 中,将 Control 键与箭头键(例如 ctrl+right、ctrl+left、ctrl+shift+right 和 ctrl+shift+left)结合使用会导致光标移动到另一个单元格.
如果本能地使用这些组合键在文本中的 and/or select 个单词之间移动,这种行为会非常烦人。
旧版本的 phpMyAdmin,有一个配置设置,$cfg['CtrlArrowsMoving']=false,这将禁用它,但不再支持该设置,而且似乎没有办法不再通过设置或配置禁用它。
当您编辑 table 时,Alt 键的作用完全相同,而 Tab 键可让您按预期从一个单元格移动到另一个单元格,因此没有理由使用 ctrl以这种方式使用密钥,除非用户真的想要。
我喜欢 phpMyAdmin,但是经过多年本能地按 ctrl+shift+left 到 select 一个词只是为了记住它不起作用,我决定搜索代码并弄清楚如何禁用它.
我使用的是 phpMyAdmin 5.0.2 版,不知道其他版本是否为此使用相同的代码,但希望它们足够相似,以便这些信息可以帮助人们修改行为(如果他们愿意)。
有两个不同的函数控制此行为。
当您编辑 table 时控制行为的函数位于 [= 下的 PHPMyAdmin 目录中38=].js
function handleCtrlNavigation (e) {
if ((e.ctrlKey && e.which === 38) || (e.altKey && e.which === 38)) {
g.moveUp(e);
} else if ((e.ctrlKey && e.which === 40) || (e.altKey && e.which === 40)) {
g.moveDown(e);
} else if ((e.ctrlKey && e.which === 37) || (e.altKey && e.which === 37))
g.moveLeft(e);
} else if ((e.ctrlKey && e.which === 39) || (e.altKey && e.which === 39)) {
g.moveRight(e);
}
}
只需删除引用 ctrl 键的部分,或将整个函数替换为:
function handleCtrlNavigation (e) {
if ((e.altKey && e.which === 38)) {
g.moveUp(e);
} else if ((e.altKey && e.which === 40)) {
g.moveDown(e);
} else if ((e.altKey && e.which === 37)) {
g.moveLeft(e);
} else if ((e.altKey && e.which === 39)) {
g.moveRight(e);
}
}
这将保留 alt 键功能。如果你不关心,你也可以在函数声明后添加一个 return 语句:
function handleCtrlNavigation (e) {
return;
((e.ctrlKey && e.which === 38) || (e.altKey && e.which === 38)) {...
控制其他区域行为的函数(比如当您插入新条目时)在文件[中=39=].js 在函数 onKeyDownArrowsHandler 下,它被描述为“允许通过 Ctrl+箭头在 inputs/select 周围移动”。在这里,你可以在函数的顶部放置一个return语句来绕过它:
function onKeyDownArrowsHandler (event) {
return;
在 phpMyAdmin 中,将 Control 键与箭头键(例如 ctrl+right、ctrl+left、ctrl+shift+right 和 ctrl+shift+left)结合使用会导致光标移动到另一个单元格.
如果本能地使用这些组合键在文本中的 and/or select 个单词之间移动,这种行为会非常烦人。
旧版本的 phpMyAdmin,有一个配置设置,$cfg['CtrlArrowsMoving']=false,这将禁用它,但不再支持该设置,而且似乎没有办法不再通过设置或配置禁用它。
当您编辑 table 时,Alt 键的作用完全相同,而 Tab 键可让您按预期从一个单元格移动到另一个单元格,因此没有理由使用 ctrl以这种方式使用密钥,除非用户真的想要。
我喜欢 phpMyAdmin,但是经过多年本能地按 ctrl+shift+left 到 select 一个词只是为了记住它不起作用,我决定搜索代码并弄清楚如何禁用它.
我使用的是 phpMyAdmin 5.0.2 版,不知道其他版本是否为此使用相同的代码,但希望它们足够相似,以便这些信息可以帮助人们修改行为(如果他们愿意)。
有两个不同的函数控制此行为。
当您编辑 table 时控制行为的函数位于 [= 下的 PHPMyAdmin 目录中38=].js
function handleCtrlNavigation (e) {
if ((e.ctrlKey && e.which === 38) || (e.altKey && e.which === 38)) {
g.moveUp(e);
} else if ((e.ctrlKey && e.which === 40) || (e.altKey && e.which === 40)) {
g.moveDown(e);
} else if ((e.ctrlKey && e.which === 37) || (e.altKey && e.which === 37))
g.moveLeft(e);
} else if ((e.ctrlKey && e.which === 39) || (e.altKey && e.which === 39)) {
g.moveRight(e);
}
}
只需删除引用 ctrl 键的部分,或将整个函数替换为:
function handleCtrlNavigation (e) {
if ((e.altKey && e.which === 38)) {
g.moveUp(e);
} else if ((e.altKey && e.which === 40)) {
g.moveDown(e);
} else if ((e.altKey && e.which === 37)) {
g.moveLeft(e);
} else if ((e.altKey && e.which === 39)) {
g.moveRight(e);
}
}
这将保留 alt 键功能。如果你不关心,你也可以在函数声明后添加一个 return 语句:
function handleCtrlNavigation (e) {
return;
((e.ctrlKey && e.which === 38) || (e.altKey && e.which === 38)) {...
控制其他区域行为的函数(比如当您插入新条目时)在文件[中=39=].js 在函数 onKeyDownArrowsHandler 下,它被描述为“允许通过 Ctrl+箭头在 inputs/select 周围移动”。在这里,你可以在函数的顶部放置一个return语句来绕过它:
function onKeyDownArrowsHandler (event) {
return;