add command.scrollIntoView
This commit is contained in:
parent
d689636771
commit
5a26604657
1 changed files with 21 additions and 0 deletions
|
|
@ -170,12 +170,33 @@ var Editor = function(renderer, session) {
|
||||||
command: commadEvent.command || {},
|
command: commadEvent.command || {},
|
||||||
args: commadEvent.args
|
args: commadEvent.args
|
||||||
};
|
};
|
||||||
|
|
||||||
|
var command = this.curOp.command;
|
||||||
|
if (command && command.scrollIntoView)
|
||||||
|
this.$blockScrolling++;
|
||||||
|
|
||||||
this.selections.push(this.selection.toJSON());
|
this.selections.push(this.selection.toJSON());
|
||||||
};
|
};
|
||||||
|
|
||||||
this.endOperation = function() {
|
this.endOperation = function() {
|
||||||
if (this.curOp) {
|
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.prevOp = this.curOp;
|
||||||
this.curOp = null;
|
this.curOp = null;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue