@@ -151,6 +151,12 @@ define([
151151 */ theme : 'snow'
152152 } ) ;
153153
154+ this . editor . on ( 'focus' , function ( ) {
155+ if ( that . keyboard_manager ) {
156+ that . keyboard_manager . enable ( ) ;
157+ }
158+ that . code_mirror . setOption ( 'readOnly' , ! that . is_editable ( ) ) ;
159+ } ) ;
154160 //codemirror monkeypatch overrides on calls from notebook
155161 //
156162 //
@@ -171,16 +177,24 @@ define([
171177 this . code_mirror . focus = function ( ) {
172178 this . editor . focus ( ) ;
173179 } ;
174- this . code_mirror . on = function ( param1 , param2 ) {
175- alert ( param1 , param2 ) ;
176- if ( param1 == 'focus' && param2 == null ) {
177- if ( that . keyboard_manager ) {
178- that . keyboard_manager . enable ( ) ;
179- }
180- that . code_mirror . setOption ( 'readOnly' , ! that . is_editable ( ) ) ;
181- }
182-
183- }
180+ this . code_mirror . on = function ( cm , change ) {
181+ alert ( cm , change ) ;
182+ that . editor . on ( 'focus' , function ( cm , change ) {
183+ if ( ! that . selected ) {
184+ that . events . trigger ( 'select.Cell' , { 'cell' :that } ) ;
185+ }
186+ that . events . trigger ( 'edit_mode.Cell' , { cell : that } ) ;
187+ } ) ;
188+
189+ that . editor . on ( "change" , function ( cm , change ) {
190+ that . events . trigger ( "change.Cell" , { cell : that , change : change } ) ;
191+ that . events . trigger ( "set_dirty.Notebook" , { value : true } ) ;
192+ } ) ;
193+ }
194+ that . editor . on ( 'blur' , function ( cm , change ) {
195+ that . events . trigger ( 'command_mode.Cell' , { cell : that } ) ;
196+ } ) ;
197+
184198 //quill.on('editor-change', )
185199
186200 //that.events.trigger("change.Cell", {cell: that, change: change});
0 commit comments