1
1
define ( [
2
2
"ace/ace" ,
3
+ "ace/range" ,
3
4
"ace/ext/language_tools"
4
- ] , function ( ace ) {
5
+ ] , function ( ace , CRange ) {
5
6
var _ = codebox . require ( "underscore" ) ;
6
7
var $ = codebox . require ( "jQuery" ) ;
7
8
var hr = codebox . require ( "hr/hr" ) ;
@@ -27,9 +28,7 @@ define([
27
28
keyboard : "textinput" ,
28
29
readonly : false
29
30
} ,
30
- events : {
31
-
32
- } ,
31
+ events : { } ,
33
32
34
33
initialize : function ( options ) {
35
34
EditorView . __super__ . initialize . apply ( this , arguments ) ;
@@ -113,14 +112,12 @@ define([
113
112
this . editor . getSession ( ) . getSelection ( ) . selectTo ( cursor_lead . y , cursor_lead . x ) ;
114
113
} , this ) ;
115
114
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 ) ;
118
116
if ( this . markersC [ cId ] ) this . editor . getSession ( ) . removeMarker ( this . markersC [ cId ] ) ;
119
117
this . markersC [ cId ] = this . editor . getSession ( ) . addMarker ( range , "marker-cursor marker-" + c . color . replace ( "#" , "" ) , "text" , true ) ;
120
118
} , this ) ;
121
119
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 ) ;
124
121
if ( this . markersS [ cId ] ) this . editor . getSession ( ) . removeMarker ( this . markersS [ cId ] ) ;
125
122
this . markersS [ cId ] = this . editor . getSession ( ) . addMarker ( range , "marker-selection marker-" + c . color . replace ( "#" , "" ) , "line" , false ) ;
126
123
} , this ) ;
@@ -133,7 +130,7 @@ define([
133
130
name : 'save' ,
134
131
bindKey : { win : 'Ctrl-S' , mac : 'Command-S' } ,
135
132
exec : _ . bind ( function ( editor ) {
136
-
133
+
137
134
} , this )
138
135
} ) ;
139
136
this . focus ( ) ;
@@ -290,7 +287,7 @@ define([
290
287
this . readonly = b ;
291
288
this . editor . setReadOnly ( b ) ;
292
289
return this ;
293
- } ,
290
+ }
294
291
} ) ;
295
292
296
293
return EditorView ;
0 commit comments