Skip to content

Commit 6c1e8a7

Browse files
committed
Correct range require in editor
1 parent a245c12 commit 6c1e8a7

File tree

2 files changed

+8
-11
lines changed

2 files changed

+8
-11
lines changed

addons/editor/addon-built.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

addons/editor/views/editor.js

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
define([
22
"ace/ace",
3+
"ace/range",
34
"ace/ext/language_tools"
4-
], function(ace) {
5+
], function(ace, CRange) {
56
var _ = codebox.require("underscore");
67
var $ = codebox.require("jQuery");
78
var hr = codebox.require("hr/hr");
@@ -27,9 +28,7 @@ define([
2728
keyboard: "textinput",
2829
readonly: false
2930
},
30-
events: {
31-
32-
},
31+
events: {},
3332

3433
initialize: function(options) {
3534
EditorView.__super__.initialize.apply(this, arguments);
@@ -113,14 +112,12 @@ define([
113112
this.editor.getSession().getSelection().selectTo(cursor_lead.y, cursor_lead.x);
114113
}, this);
115114
this.sync.on("cursor:move", function(cId, c) {
116-
var CRange = ace.require('ace/range').Range;
117-
var range = new CRange(c.y, c.x, c.y, c.x+1);
115+
var range = new CRange.Range(c.y, c.x, c.y, c.x+1);
118116
if (this.markersC[cId]) this.editor.getSession().removeMarker(this.markersC[cId]);
119117
this.markersC[cId] = this.editor.getSession().addMarker(range, "marker-cursor marker-"+c.color.replace("#", ""), "text", true);
120118
}, this);
121119
this.sync.on("selection:move", function(cId, c) {
122-
var CRange = ace.require('ace/range').Range;
123-
var range = new CRange(c.start.y, c.start.x, c.end.y, c.end.x);
120+
var range = new CRange.Range(c.start.y, c.start.x, c.end.y, c.end.x);
124121
if (this.markersS[cId]) this.editor.getSession().removeMarker(this.markersS[cId]);
125122
this.markersS[cId] = this.editor.getSession().addMarker(range, "marker-selection marker-"+c.color.replace("#", ""), "line", false);
126123
}, this);
@@ -133,7 +130,7 @@ define([
133130
name: 'save',
134131
bindKey: {win: 'Ctrl-S', mac: 'Command-S'},
135132
exec: _.bind(function(editor) {
136-
133+
137134
}, this)
138135
});
139136
this.focus();
@@ -290,7 +287,7 @@ define([
290287
this.readonly = b;
291288
this.editor.setReadOnly(b);
292289
return this;
293-
},
290+
}
294291
});
295292

296293
return EditorView;

0 commit comments

Comments
 (0)