mirror of
https://github.com/ether/etherpad-lite.git
synced 2025-04-22 00:16:15 -04:00
first semi working alt f9 functionality
This commit is contained in:
parent
a67664055d
commit
5761e998de
4 changed files with 57 additions and 6 deletions
|
@ -3707,6 +3707,19 @@ function Ace2Inner(){
|
|||
evt:evt
|
||||
});
|
||||
specialHandled = (specialHandledInHook&&specialHandledInHook.length>0)?specialHandledInHook[0]:specialHandled;
|
||||
if ((!specialHandled) && isTypeForSpecialKey && keyCode == 120){
|
||||
// Alt F9 focuses on the File Menu and/or editbar.
|
||||
// Note that while most editors use Alt F10 this is not desirable
|
||||
// As ubuntu cannot use Alt F10....
|
||||
evt.preventDefault();
|
||||
// Focus on the editbar.
|
||||
top.console.log("focusing on first child in menu");
|
||||
var firstEditbarElement = parent.parent.$('#editbar').children("ul").first().children().first().children().first().children().first();
|
||||
firstEditbarElement.focus();
|
||||
top.console.log(firstEditbarElement);
|
||||
top.console.log(parent.parent.$(':focus'));
|
||||
$(this).blur();
|
||||
}
|
||||
if ((!specialHandled) && isTypeForSpecialKey && keyCode == 8)
|
||||
{
|
||||
// "delete" key; in mozilla, if we're at the beginning of a line, normalize now,
|
||||
|
@ -4951,6 +4964,7 @@ function Ace2Inner(){
|
|||
// a fix: in IE, clicking on a control like a button outside the
|
||||
// iframe can "blur" the editor, causing it to stop getting
|
||||
// events, though typing still affects it(!).
|
||||
top.console.log("blur handled");
|
||||
setSelection(null);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -155,6 +155,10 @@ var padeditbar = (function()
|
|||
});
|
||||
});
|
||||
|
||||
$('#editbar').on("keyup", function(evt){
|
||||
editbarKeyEvent(evt);
|
||||
});
|
||||
|
||||
$('#editbar').show();
|
||||
|
||||
this.redrawHeight();
|
||||
|
@ -300,6 +304,36 @@ var padeditbar = (function()
|
|||
}
|
||||
};
|
||||
|
||||
function editbarKeyEvent(evt){
|
||||
// On arrow keys go to next/previous button item in editbar
|
||||
if(evt.keyCode !== 39 && evt.keyCode !== 37) return;
|
||||
|
||||
// Get our current Focus (Which editbar icon we're currently on)
|
||||
var currentFocus = $(':focus');
|
||||
|
||||
// On left arrow move to next button in editbar
|
||||
if(evt.keyCode === 37){
|
||||
var nextFocus = $(currentFocus).parent().parent().prev();
|
||||
// No button in this focus so move on
|
||||
if(nextFocus.find("button").length === 0){
|
||||
$(nextFocus).prev().find("button").focus();
|
||||
}else{
|
||||
$(currentFocus).parent().parent().prev().find("button").focus();
|
||||
}
|
||||
}
|
||||
|
||||
// On right arrow move to next button in editbar
|
||||
if(evt.keyCode === 39){
|
||||
var nextFocus = $(currentFocus).parent().parent().next();
|
||||
// No button in this focus so move on
|
||||
if(nextFocus.find("button").length === 0){
|
||||
$(nextFocus).next().find("button").focus();
|
||||
}else{
|
||||
$(currentFocus).parent().parent().next().find("button").focus();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function aceAttributeCommand(cmd, ace) {
|
||||
ace.ace_toggleAttributeOnSelection(cmd);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue