mirror of
				https://github.com/go-gitea/gitea
				synced 2025-11-04 05:18:25 +00:00 
			
		
		
		
	Set "type=button" for editor's toolbar buttons (#26510)
The editor usually is in a form, so the buttons should have "type=button", avoid conflicting with the form's submit.
This commit is contained in:
		@@ -79,6 +79,8 @@ class ComboMarkdownEditor {
 | 
			
		||||
    for (const el of this.textareaMarkdownToolbar.querySelectorAll('.markdown-toolbar-button')) {
 | 
			
		||||
      // upstream bug: The role code is never executed in base MarkdownButtonElement https://github.com/github/markdown-toolbar-element/issues/70
 | 
			
		||||
      el.setAttribute('role', 'button');
 | 
			
		||||
      // the editor usually is in a form, so the buttons should have "type=button", avoiding conflicting with the form's submit.
 | 
			
		||||
      if (el.nodeName === 'BUTTON' && !el.getAttribute('type')) el.setAttribute('type', 'button');
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    const monospaceButton = this.container.querySelector('.markdown-switch-monospace');
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user