mirror of
				https://github.com/go-gitea/gitea.git
				synced 2025-11-03 21:16:26 +01:00 
			
		
		
		
	Disable enter key for accepting code completion in Monaco (#30548)
Fixes https://github.com/go-gitea/gitea/issues/28114 and behaviour matches vscode on desktop as well. Co-authored-by: Giteabot <teabot@gitea.io>
This commit is contained in:
		
							parent
							
								
									2da1dcfc21
								
							
						
					
					
						commit
						49b80f8ac1
					
				@ -112,6 +112,10 @@ export async function createMonaco(textarea, filename, editorOpts) {
 | 
				
			|||||||
    ...other,
 | 
					    ...other,
 | 
				
			||||||
  });
 | 
					  });
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  monaco.editor.addKeybindingRules([
 | 
				
			||||||
 | 
					    {keybinding: monaco.KeyCode.Enter, command: null}, // disable enter from accepting code completion
 | 
				
			||||||
 | 
					  ]);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  const model = editor.getModel();
 | 
					  const model = editor.getModel();
 | 
				
			||||||
  model.onDidChangeContent(() => {
 | 
					  model.onDidChangeContent(() => {
 | 
				
			||||||
    textarea.value = editor.getValue({preserveBOM: true});
 | 
					    textarea.value = editor.getValue({preserveBOM: true});
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user