mirror of
https://github.com/ether/etherpad-lite.git
synced 2025-04-23 08:56:17 -04:00
Merge pull request #2944 from storytouch/aceRegisterNonScrollableEditEvents
Create hook to register events that won't scroll editor after aceEditEvt
This commit is contained in:
commit
f09e10b122
2 changed files with 30 additions and 3 deletions
|
@ -369,6 +369,19 @@ function Ace2Inner(){
|
|||
return thisAuthor;
|
||||
}
|
||||
|
||||
var _nonScrollableEditEvents = {
|
||||
"applyChangesToBase": 1
|
||||
};
|
||||
|
||||
_.each(hooks.callAll('aceRegisterNonScrollableEditEvents'), function(eventType) {
|
||||
_nonScrollableEditEvents[eventType] = 1;
|
||||
});
|
||||
|
||||
function isScrollableEditEvent(eventType)
|
||||
{
|
||||
return !_nonScrollableEditEvents[eventType];
|
||||
}
|
||||
|
||||
var currentCallStack = null;
|
||||
|
||||
function inCallStack(type, action)
|
||||
|
@ -506,7 +519,7 @@ function Ace2Inner(){
|
|||
{
|
||||
updateBrowserSelectionFromRep();
|
||||
}
|
||||
if ((cs.docTextChanged || cs.userChangedSelection) && cs.type != "applyChangesToBase")
|
||||
if ((cs.docTextChanged || cs.userChangedSelection) && isScrollableEditEvent(cs.type))
|
||||
{
|
||||
scrollSelectionIntoView();
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue