在我的工作中,我们使用 Confluence。我需要在编辑页面上进行等宽格式设置的快捷方式。本机快捷键是 CTRL+SHIFT+M。它是由 MyFlow 功能在 Opera 中获取的,无法更改。
是否可以选择使用 Javascript 代码来制作它?
(我可以在浏览器扩展中进行 JS 注入。)
用于快捷方式的常规 JS 代码,它可以正常工作,但不能在 Confluence 编辑页面上使用:
// define a handler
function monospaceKeyTrigger(e) {
// this would test for whichever key is 40 and the ctrl key at the same time
if (e.ctrlKey && e.shiftKey && e.keyCode == 90) {
// trigger click on monospace button
//document.getElementById("rte-monospace").click();
alert('!!monospace!!');
}
}
// register the handler
document.addEventListener('keyup', monospaceKeyTrigger, false);
那么,我错过了什么?
我想,由于编辑器 JS 功能,它根本不会触发......有
什么建议吗?
HUWWW
相关分类