@@ -122,7 +122,6 @@ define(function (require, exports, module) {
122122 */
123123 function showGutters ( editor , _results , update = false ) {
124124 if ( editor && enabled ) {
125- const cm = editor . _codeMirror ;
126125 // if the file is updated we don't need to clear the gutter
127126 // as it will clear all the existing markers.
128127 if ( ! update ) {
@@ -132,9 +131,9 @@ define(function (require, exports, module) {
132131
133132 // Only add markers if enabled
134133 if ( enabled ) {
135- cm . colorGutters = _ . sortBy ( _results , "lineNumber" ) ;
134+ const colorGutters = _ . sortBy ( _results , "lineNumber" ) ;
136135
137- cm . colorGutters . forEach ( function ( obj ) {
136+ colorGutters . forEach ( function ( obj ) {
138137 let $marker ;
139138 if ( obj . colorValues . length === 1 ) {
140139 // Single color preview
@@ -213,18 +212,10 @@ define(function (require, exports, module) {
213212 newEditor . on ( "cursorActivity.colorPreview" , _cursorActivity ) ;
214213 // Unbind the previous editor's change event if it exists
215214 if ( oldEditor ) {
216- const oldCM = oldEditor . _codeMirror ;
217- if ( oldCM ) {
218- oldCM . off ( "change" , onChanged ) ;
219- }
220- }
221-
222- // Bind change event to the new editor
223- const cm = newEditor . _codeMirror ;
224- if ( cm ) {
225- cm . on ( "change" , onChanged ) ;
215+ oldEditor . off ( "change" , onChanged ) ;
226216 }
227-
217+ newEditor . off ( "change" , onChanged ) ;
218+ newEditor . on ( "change" , onChanged ) ;
228219 showColorMarks ( ) ;
229220 _cursorActivity ( null , newEditor ) ;
230221 }
@@ -233,13 +224,11 @@ define(function (require, exports, module) {
233224 // Handle the currently active editor at initialization
234225 const activeEditor = EditorManager . getActiveEditor ( ) ;
235226 if ( activeEditor ) {
236- const cm = activeEditor . _codeMirror ;
237- if ( cm ) {
238- cm . on ( "change" , onChanged ) ;
239- }
227+ activeEditor . off ( "change" , onChanged ) ;
228+ activeEditor . on ( "change" , onChanged ) ;
240229 showColorMarks ( ) ;
230+ _cursorActivity ( null , activeEditor ) ;
241231 }
242-
243232 }
244233
245234 /**
0 commit comments