mirror of
				https://gitee.com/gitea/gitea
				synced 2025-11-04 08:30:25 +08:00 
			
		
		
		
	Enable Monaco automaticLayout (#21515)
Enable [`automaticLayout`](https://microsoft.github.io/monaco-editor/api/interfaces/monaco.editor.IDiffEditorOptions.html#automaticLayout) for monaco so it can reflow itself. Fixes: https://github.com/go-gitea/gitea/issues/21508
This commit is contained in:
		@@ -17,6 +17,7 @@ const baseOptions = {
 | 
				
			|||||||
  rulers: false,
 | 
					  rulers: false,
 | 
				
			||||||
  scrollbar: {horizontalScrollbarSize: 6, verticalScrollbarSize: 6},
 | 
					  scrollbar: {horizontalScrollbarSize: 6, verticalScrollbarSize: 6},
 | 
				
			||||||
  scrollBeyondLastLine: false,
 | 
					  scrollBeyondLastLine: false,
 | 
				
			||||||
 | 
					  automaticLayout: true,
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
function getEditorconfig(input) {
 | 
					function getEditorconfig(input) {
 | 
				
			||||||
@@ -111,10 +112,6 @@ export async function createMonaco(textarea, filename, editorOpts) {
 | 
				
			|||||||
    textarea.dispatchEvent(new Event('change')); // seems to be needed for jquery-are-you-sure
 | 
					    textarea.dispatchEvent(new Event('change')); // seems to be needed for jquery-are-you-sure
 | 
				
			||||||
  });
 | 
					  });
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  window.addEventListener('resize', () => {
 | 
					 | 
				
			||||||
    editor.layout();
 | 
					 | 
				
			||||||
  });
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  exportEditor(editor);
 | 
					  exportEditor(editor);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  const loading = document.querySelector('.editor-loading');
 | 
					  const loading = document.querySelector('.editor-loading');
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user