Avoid submitting forms with MarkdownButton

Add type="button" to the component so that it won't submit if placed inside a form.

Fixes https://github.com/flarum/core/issues/2875
This commit is contained in:
Alexander Skvortsov 2021-05-18 01:19:52 -04:00
parent f9d97b60d5
commit 7f37e36241

View File

@ -11,6 +11,7 @@ export default class MarkdownButton extends Component {
const button = ( const button = (
<button <button
className="Button Button--icon Button--link" className="Button Button--icon Button--link"
type="button"
data-hotkey={this.attrs.hotkey} data-hotkey={this.attrs.hotkey}
onkeydown={this.keydown.bind(this)} onkeydown={this.keydown.bind(this)}
onclick={this.attrs.onclick} onclick={this.attrs.onclick}