https://ace.c9.io/
https://github.com/ajaxorg/ace
Source
| 1
2
3
4
5
6
7
 | // ace.js
function edit(el, options): Editor {
  // ...
  var editor = new Editor(new Renderer(el), doc, options);
  // env 可用于调试
  editor.container.env = editor.env = env;
}
 | 
| 1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
 | // vertual_renderer.js
var VirtualRenderer = function(container, theme) {
  this.container = container || dom.createElement("div");
  this.$gutter = dom.createElement("div");
  this.scroller = dom.createElement("div");
  this.content = dom.createElement("div");
  this.$gutterLayer = new GutterLayer(this.$gutter);
  this.$markerBack = new MarkerLayer(this.content);
  this.$textLayer = new TextLayer(this.content);
  this.$markerFront = new MarkerLayer(this.content);
  this.$cursorLayer = new CursorLayer(this.content);
}
(function() {
  // ...
}).call(VirtualRenderer.prototype);
config.defineOptions(VirtualRenderer.prototype, "renderer", {
  // ...
});
 |