Update and fix editor might not sync scrolling from edit mode to both mode
This commit is contained in:
		
							parent
							
								
									e9b0ce8e04
								
							
						
					
					
						commit
						d90acf88e3
					
				| @ -721,15 +721,17 @@ function windowResizeInner(callback) { | |||||||
|     //refresh editor
 |     //refresh editor
 | ||||||
|     if (loaded) { |     if (loaded) { | ||||||
|         if (editor.getOption('scrollbarStyle') === 'native') { |         if (editor.getOption('scrollbarStyle') === 'native') { | ||||||
|             clearMap(); |             setTimeout(function () { | ||||||
|             if (editorHasFocus()) { |                 clearMap(); | ||||||
|                 syncScrollToView(); |                 if (editorHasFocus()) { | ||||||
|             } else { |                     syncScrollToView(); | ||||||
|                 syncScrollToEdit(); |                 } else { | ||||||
|             } |                     syncScrollToEdit(); | ||||||
|             updateScrollspy(); |                 } | ||||||
|             if (callback && typeof callback === 'function') |                 updateScrollspy(); | ||||||
|                 callback(); |                 if (callback && typeof callback === 'function') | ||||||
|  |                     callback(); | ||||||
|  |             }, 1); | ||||||
|         } else { |         } else { | ||||||
|             // force it load all docs at once to prevent scroll knob blink
 |             // force it load all docs at once to prevent scroll knob blink
 | ||||||
|             editor.setOption('viewportMargin', Infinity); |             editor.setOption('viewportMargin', Infinity); | ||||||
| @ -1030,6 +1032,11 @@ function changeMode(type) { | |||||||
|         preventSyncScrollToEdit = 2; |         preventSyncScrollToEdit = 2; | ||||||
|         syncScrollToView(); |         syncScrollToView(); | ||||||
|     } |     } | ||||||
|  |      | ||||||
|  |     if (lastMode == modeType.both && currentMode != modeType.both) { | ||||||
|  |         preventSyncScrollToView = false; | ||||||
|  |         preventSyncScrollToEdit = false; | ||||||
|  |     } | ||||||
| 
 | 
 | ||||||
|     if (lastMode != modeType.edit && currentMode == modeType.edit) { |     if (lastMode != modeType.edit && currentMode == modeType.edit) { | ||||||
|         editor.refresh(); |         editor.refresh(); | ||||||
|  | |||||||
| @ -120,11 +120,7 @@ var viewScrollingDebounce = 200; | |||||||
| var editScrolling = false; | var editScrolling = false; | ||||||
| var editScrollingDebounce = 200; | var editScrollingDebounce = 200; | ||||||
| 
 | 
 | ||||||
| if (editor.getOption('scrollbarStyle') === 'native') { | ui.area.codemirrorScroll.on('scroll', _.throttle(syncScrollToView, editScrollThrottle)); | ||||||
|     ui.area.codemirrorScroll.on('scroll', _.throttle(syncScrollToView, editScrollThrottle)); |  | ||||||
| } else { |  | ||||||
|     editor.on('scroll', _.throttle(syncScrollToView, editScrollThrottle)); |  | ||||||
| } |  | ||||||
| ui.area.view.on('scroll', _.throttle(syncScrollToEdit, viewScrollThrottle)); | ui.area.view.on('scroll', _.throttle(syncScrollToEdit, viewScrollThrottle)); | ||||||
| 
 | 
 | ||||||
| var scrollMap, lineHeightMap, viewTop, viewBottom; | var scrollMap, lineHeightMap, viewTop, viewBottom; | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user