File tree 1 file changed +3
-2
lines changed
1 file changed +3
-2
lines changed Original file line number Diff line number Diff line change @@ -62,7 +62,6 @@ function getButtons(toolbar: Element): HTMLElement[] {
62
62
function keydown ( fn : ( event : KeyboardEvent ) => void ) : ( event : KeyboardEvent ) => void {
63
63
return function ( event : KeyboardEvent ) {
64
64
if ( event . key === ' ' || event . key === 'Enter' ) {
65
- event . preventDefault ( )
66
65
fn ( event )
67
66
}
68
67
}
@@ -121,9 +120,10 @@ const manualStyles = {
121
120
class MarkdownButtonElement extends HTMLElement {
122
121
constructor ( ) {
123
122
super ( )
124
- const apply = ( ) => {
123
+ const apply = ( event : Event ) => {
125
124
const style = styles . get ( this )
126
125
if ( ! style ) return
126
+ event . preventDefault ( )
127
127
applyStyle ( this , style )
128
128
}
129
129
this . addEventListener ( 'keydown' , keydown ( apply ) )
@@ -316,6 +316,7 @@ function applyFromToolbar(event: Event) {
316
316
const mdButtonStyle = target . getAttribute ( 'data-md-button' )
317
317
const style = manualStyles [ mdButtonStyle as keyof typeof manualStyles ]
318
318
if ( ! style ) return
319
+ event . preventDefault ( )
319
320
applyStyle ( target , style )
320
321
}
321
322
You can’t perform that action at this time.
0 commit comments