first semi working alt f9 functionality

This commit is contained in:
John McLear 2015-03-25 11:03:45 +00:00
parent a67664055d
commit 5761e998de
4 changed files with 57 additions and 6 deletions

View File

@ -99,7 +99,7 @@ _.extend(Button.prototype, {
}; };
return tag("li", liAttributes, return tag("li", liAttributes,
tag("a", { "class": this.grouping, "data-l10n-id": this.attributes.localizationId }, tag("a", { "class": this.grouping, "data-l10n-id": this.attributes.localizationId },
tag("span", { "class": " "+ this.attributes.class }) tag("button", { "class": " "+ this.attributes.class })
) )
); );
} }

View File

@ -70,10 +70,6 @@ a img {
.toolbar ul li { .toolbar ul li {
float: left; float: left;
margin-left: 2px; margin-left: 2px;
-webkit-user-select: none;
-moz-user-select: none;
-ms-user-select: none;
user-select: none;
height:32px; height:32px;
} }
.toolbar ul li.separator { .toolbar ul li.separator {
@ -197,6 +193,7 @@ li[data-key=showusers] > a #online_count {
#editbar{ #editbar{
display:none; display:none;
} }
#editorcontainer { #editorcontainer {
position: absolute; position: absolute;
top: 37px; /* + 1px border */ top: 37px; /* + 1px border */
@ -742,13 +739,19 @@ table#otheruserstable {
height: 16px; height: 16px;
display: inline-block; display: inline-block;
vertical-align: middle; vertical-align: middle;
border: none;
padding: 0;
background: none;
font-family: "fontawesome-etherpad"; font-family: "fontawesome-etherpad";
font-size: 15px; font-size: 15px;
font-style: normal; font-style: normal;
font-weight: normal; font-weight: normal;
color: #666; color: #666;
} }
.buttonicon:focus{
border: 1px solid #fff;
}
.buttonicon-bold:before { .buttonicon-bold:before {
content: "\e81c"; content: "\e81c";
} }

View File

@ -3707,6 +3707,19 @@ function Ace2Inner(){
evt:evt evt:evt
}); });
specialHandled = (specialHandledInHook&&specialHandledInHook.length>0)?specialHandledInHook[0]:specialHandled; 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) if ((!specialHandled) && isTypeForSpecialKey && keyCode == 8)
{ {
// "delete" key; in mozilla, if we're at the beginning of a line, normalize now, // "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 // a fix: in IE, clicking on a control like a button outside the
// iframe can "blur" the editor, causing it to stop getting // iframe can "blur" the editor, causing it to stop getting
// events, though typing still affects it(!). // events, though typing still affects it(!).
top.console.log("blur handled");
setSelection(null); setSelection(null);
} }
} }

View File

@ -155,6 +155,10 @@ var padeditbar = (function()
}); });
}); });
$('#editbar').on("keyup", function(evt){
editbarKeyEvent(evt);
});
$('#editbar').show(); $('#editbar').show();
this.redrawHeight(); 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) { function aceAttributeCommand(cmd, ace) {
ace.ace_toggleAttributeOnSelection(cmd); ace.ace_toggleAttributeOnSelection(cmd);
} }