Backport #26510 by @wxiaoguang The editor usually is in a form, so the buttons should have "type=button", avoid conflicting with the form's submit. Co-authored-by: wxiaoguang <wxiaoguang@gmail.com> (cherry picked from commit 31208fe9a138ae29a114a28155e73b3e9b259ce3)
This commit is contained in:
parent
622ec5c79f
commit
5289619383
1 changed files with 2 additions and 0 deletions
|
@ -78,6 +78,8 @@ class ComboMarkdownEditor {
|
||||||
for (const el of this.textareaMarkdownToolbar.querySelectorAll('.markdown-toolbar-button')) {
|
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
|
// upstream bug: The role code is never executed in base MarkdownButtonElement https://github.com/github/markdown-toolbar-element/issues/70
|
||||||
el.setAttribute('role', 'button');
|
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');
|
const monospaceButton = this.container.querySelector('.markdown-switch-monospace');
|
||||||
|
|
Loading…
Reference in a new issue