forked from c9/cloud9
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathproxydocument.js
More file actions
91 lines (67 loc) · 2.19 KB
/
proxydocument.js
File metadata and controls
91 lines (67 loc) · 2.19 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
define(function (require, exports, module) {
var oop = require('pilot/oop');
var Document = require('ace/document').Document;
var ProxyDocument = function (document) {
this.$onChange = this.onChange.bind(this);
this.setDocument(document);
};
oop.inherits(ProxyDocument, Document);
(function() {
this.getDocument = function () {
return this.doc;
};
this.setDocument = function (newDocument) {
if (this.doc == newDocument)
return this.doc;
if (this.doc) {
this.doc.removeEventListener("change", this.$onChange);
}
this.doc = newDocument;
this.doc.addEventListener("change", this.$onChange);
return this.doc;
};
this.onChange = function(e) {
this._dispatchEvent("change", e);
};
this.getNewLineCharacter = function () {
return this.doc.getNewLineCharacter();
};
this.getLength = function () {
return this.doc.getLength();
};
this.getLine = function (row) {
return this.doc.getLine(row);
};
this.getLines = function (startRow, endRow) {
return this.doc.getLines(startRow, endRow);
};
this.getTextRange = function (range) {
return this.doc.getTextRange(range);
};
this.insertNewLine = function (position) {
return this.doc.insertNewLine(position);
};
this.insertInLine = function (position, text) {
return this.doc.insertInLine(position, text);
};
this.insertLines = function (row, lines) {
return this.doc.insertLines(row, lines);
};
this.removeNewLine = function (row) {
return this.doc.removeNewLine(row);
};
this.removeInLine = function (row, startColumn, endColumn) {
return this.doc.removeInLine(row, startColumn, endColumn);
};
this.removeLines = function (startRow, endRow) {
return this.doc.removeLines(startRow, endRow);
};
this.applyDeltas = function (deltas) {
return this.doc.applyDeltas(deltas);
};
this.revertDeltas = function (deltas) {
return this.doc.revertDeltas(deltas);
};
}).call(ProxyDocument.prototype);
module.exports = ProxyDocument;
});