|
|
@@ -86,6 +86,7 @@ export default Document = (function () {
|
|
|
this.wantToBeJoined = false
|
|
|
this._checkAceConsistency = () => this._checkConsistency(this.ace)
|
|
|
this._checkCMConsistency = () => this._checkConsistency(this.cm)
|
|
|
+ this._checkCM6Consistency = () => this._checkConsistency(this.cm6)
|
|
|
this._bindToEditorEvents()
|
|
|
this._bindToSocketEvents()
|
|
|
}
|
|
|
@@ -133,6 +134,27 @@ export default Document = (function () {
|
|
|
return this.ide.$scope.$emit('document:closed', this.doc)
|
|
|
}
|
|
|
|
|
|
+ attachToCM6(cm6) {
|
|
|
+ this.cm6 = cm6
|
|
|
+ if (this.doc != null) {
|
|
|
+ this.doc.attachToCM6(this.cm6)
|
|
|
+ }
|
|
|
+ if (this.cm6 != null) {
|
|
|
+ this.cm6.on('change', this._checkCM6Consistency)
|
|
|
+ }
|
|
|
+ return this.ide.$scope.$emit('document:opened', this.doc)
|
|
|
+ }
|
|
|
+
|
|
|
+ detachFromCM6() {
|
|
|
+ if (this.doc != null) {
|
|
|
+ this.doc.detachFromCM6()
|
|
|
+ }
|
|
|
+ if (this.cm6 != null) {
|
|
|
+ this.cm6.off('change', this._checkCM6Consistency)
|
|
|
+ }
|
|
|
+ return this.ide.$scope.$emit('document:closed', this.doc)
|
|
|
+ }
|
|
|
+
|
|
|
submitOp(...args) {
|
|
|
return this.doc != null
|
|
|
? this.doc.submitOp(...Array.from(args || []))
|