File tree Expand file tree Collapse file tree 1 file changed +3
-2
lines changed Expand file tree Collapse file tree 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[] {
6262function keydown ( fn : ( event : KeyboardEvent ) => void ) : ( event : KeyboardEvent ) => void {
6363 return function ( event : KeyboardEvent ) {
6464 if ( event . key === ' ' || event . key === 'Enter' ) {
65- event . preventDefault ( )
6665 fn ( event )
6766 }
6867 }
@@ -121,9 +120,10 @@ const manualStyles = {
121120class MarkdownButtonElement extends HTMLElement {
122121 constructor ( ) {
123122 super ( )
124- const apply = ( ) => {
123+ const apply = ( event : Event ) => {
125124 const style = styles . get ( this )
126125 if ( ! style ) return
126+ event . preventDefault ( )
127127 applyStyle ( this , style )
128128 }
129129 this . addEventListener ( 'keydown' , keydown ( apply ) )
@@ -316,6 +316,7 @@ function applyFromToolbar(event: Event) {
316316 const mdButtonStyle = target . getAttribute ( 'data-md-button' )
317317 const style = manualStyles [ mdButtonStyle as keyof typeof manualStyles ]
318318 if ( ! style ) return
319+ event . preventDefault ( )
319320 applyStyle ( target , style )
320321}
321322
You can’t perform that action at this time.
0 commit comments