make sure operationEnd events are not emitted to wrong session
This commit is contained in:
parent
80f43beb73
commit
4e6d48bf2e
1 changed files with 6 additions and 0 deletions
|
|
@ -278,6 +278,10 @@ var Editor = function(renderer, session) {
|
||||||
this.setSession = function(session) {
|
this.setSession = function(session) {
|
||||||
if (this.session == session)
|
if (this.session == session)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
// make sure operationEnd events are not emitted to wrong session
|
||||||
|
if (this.curOp) this.endOperation();
|
||||||
|
this.curOp = {};
|
||||||
|
|
||||||
var oldSession = this.session;
|
var oldSession = this.session;
|
||||||
if (oldSession) {
|
if (oldSession) {
|
||||||
|
|
@ -377,6 +381,8 @@ var Editor = function(renderer, session) {
|
||||||
oldSession: oldSession
|
oldSession: oldSession
|
||||||
});
|
});
|
||||||
|
|
||||||
|
this.curOp = null;
|
||||||
|
|
||||||
oldSession && oldSession._signal("changeEditor", {oldEditor: this});
|
oldSession && oldSession._signal("changeEditor", {oldEditor: this});
|
||||||
session && session._signal("changeEditor", {editor: this});
|
session && session._signal("changeEditor", {editor: this});
|
||||||
};
|
};
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue