mirror of
https://github.com/ether/etherpad-lite.git
synced 2025-04-20 23:46:14 -04:00
better handling for inputs and left and right arrows
This commit is contained in:
parent
37c7c7eabe
commit
48862dac6f
1 changed files with 10 additions and 1 deletions
|
@ -324,7 +324,6 @@ var padeditbar = (function()
|
||||||
$(':focus').blur(); // required to do not try to remove!
|
$(':focus').blur(); // required to do not try to remove!
|
||||||
padeditor.ace.focus(); // Sends focus back to pad
|
padeditor.ace.focus(); // Sends focus back to pad
|
||||||
// The above focus doesn't always work in FF, you have to hit enter afterwards
|
// The above focus doesn't always work in FF, you have to hit enter afterwards
|
||||||
// This still needs fixing cake
|
|
||||||
evt.preventDefault();
|
evt.preventDefault();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -336,13 +335,23 @@ var padeditbar = (function()
|
||||||
|
|
||||||
// On left arrow move to next button in editbar
|
// On left arrow move to next button in editbar
|
||||||
if(evt.keyCode === 37){
|
if(evt.keyCode === 37){
|
||||||
|
// If a dropdown is visible or we're in an input don't move to the next button
|
||||||
|
if($('.popup').is(":visible") || evt.target.localName === "input") return;
|
||||||
|
|
||||||
editbarPosition--;
|
editbarPosition--;
|
||||||
|
// Allow focus to shift back to end of row and start of row
|
||||||
|
if(editbarPosition === -1) editbarPosition = focusItems.length -1;
|
||||||
$(focusItems[editbarPosition]).focus()
|
$(focusItems[editbarPosition]).focus()
|
||||||
}
|
}
|
||||||
|
|
||||||
// On right arrow move to next button in editbar
|
// On right arrow move to next button in editbar
|
||||||
if(evt.keyCode === 39){
|
if(evt.keyCode === 39){
|
||||||
|
// If a dropdown is visible or we're in an input don't move to the next button
|
||||||
|
if($('.popup').is(":visible") || evt.target.localName === "input") return;
|
||||||
|
|
||||||
editbarPosition++;
|
editbarPosition++;
|
||||||
|
// Allow focus to shift back to end of row and start of row
|
||||||
|
if(editbarPosition >= focusItems.length) editbarPosition = 0;
|
||||||
$(focusItems[editbarPosition]).focus();
|
$(focusItems[editbarPosition]).focus();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue