add command.scrollIntoView

This commit is contained in:
nightwing 2013-11-05 20:44:27 +04:00
commit 5a26604657

View file

@ -170,12 +170,33 @@ var Editor = function(renderer, session) {
command: commadEvent.command || {},
args: commadEvent.args
};
var command = this.curOp.command;
if (command && command.scrollIntoView)
this.$blockScrolling++;
this.selections.push(this.selection.toJSON());
};
this.endOperation = function() {
if (this.curOp) {
var command = this.curOp.command;
if (command && command.scrollIntoView) {
this.$blockScrolling--;
switch (command.scrollIntoView) {
case "center":
this.renderer.scrollCursorIntoView(null, 0.5);
break;
case "cursor":
this.renderer.scrollCursorIntoView();
break;
case "selectionPart":
this.renderer.scrollCursorIntoView();
break;
default:
break;
}
}
this.prevOp = this.curOp;
this.curOp = null;
}