File tree Expand file tree Collapse file tree 2 files changed +10
-0
lines changed
Expand file tree Collapse file tree 2 files changed +10
-0
lines changed Original file line number Diff line number Diff line change @@ -1222,10 +1222,12 @@ var CodeMirror = (function() {
12221222 }
12231223 function highlightWorker ( ) {
12241224 var end = + new Date + options . workTime ;
1225+ var didSomething = false ;
12251226 while ( work . length ) {
12261227 if ( ! lines [ showingFrom ] . stateAfter ) var task = showingFrom ;
12271228 else var task = work . pop ( ) ;
12281229 if ( task >= lines . length ) continue ;
1230+ didSomething = true ;
12291231 var start = findStartLine ( task ) , state = start && lines [ start - 1 ] . stateAfter ;
12301232 if ( state ) state = copyState ( mode , state ) ;
12311233 else state = startState ( mode ) ;
@@ -1244,6 +1246,8 @@ var CodeMirror = (function() {
12441246 }
12451247 changes . push ( { from : task , to : i } ) ;
12461248 }
1249+ if ( didSomething && options . onHighlightComplete )
1250+ options . onHighlightComplete ( instance ) ;
12471251 }
12481252 function startWorker ( time ) {
12491253 if ( ! work . length ) return ;
@@ -1416,6 +1420,7 @@ var CodeMirror = (function() {
14161420 onChange : null ,
14171421 onCursorActivity : null ,
14181422 onGutterClick : null ,
1423+ onHighlightComplete : null ,
14191424 onFocus : null , onBlur : null , onScroll : null ,
14201425 matchBrackets : false ,
14211426 workTime : 100 ,
Original file line number Diff line number Diff line change @@ -217,6 +217,11 @@ <h2 id="config">Configuration</h2>
217217 < dd > When given, will be called whenever the editor is
218218 scrolled.</ dd >
219219
220+ < dt id ="option_onHighlightComplete "> < code > onHighlightComplete (function)</ code > </ dt >
221+ < dd > Whenever the editor's content has been fully highlighted,
222+ this function (if given) will be called. It'll be given a single
223+ argument, the editor instance.</ dd >
224+
220225 < dt id ="option_matchBrackets "> < code > matchBrackets (boolean)</ code > </ dt >
221226 < dd > Determines whether brackets are matched whenever the cursor
222227 is moved next to a bracket.</ dd >
You can’t perform that action at this time.
0 commit comments