Skip to content

Commit

Permalink
fix: button actions
Browse files Browse the repository at this point in the history
  • Loading branch information
adamdehaven committed Dec 20, 2023
1 parent 4fe8a14 commit abd5085
Showing 1 changed file with 17 additions and 7 deletions.
24 changes: 17 additions & 7 deletions src/components/MarkdownToolbar.vue
Original file line number Diff line number Diff line change
Expand Up @@ -8,19 +8,22 @@
<button
:class="{ 'active': mode === 'edit' }"
:disabled="mode === 'edit'"
@mousedown.prevent="changeMode('edit')"
:tabindex="0"
@click.prevent="changeMode('edit')"
>
Edit
</button>
<button
:class="{ 'active': mode === 'split' }"
@mousedown.prevent="changeMode('split')"
:tabindex="0"
@click.prevent="changeMode('split')"
>
Split
</button>
<button
:class="{ 'active': mode === 'preview' }"
@mousedown.prevent="changeMode('preview')"
:tabindex="0"
@click.prevent="changeMode('preview')"
>
Preview
</button>
Expand All @@ -34,7 +37,8 @@
:key="option.label"
:aria-label="option.label"
:data-testid="`format-option-${option.action}`"
@mousedown.prevent="emit('format-selection', option.action)"
:tabindex="0"
@click.prevent="emit('format-selection', option.action)"
>
{{ option.label }}
</button>
Expand All @@ -46,7 +50,8 @@
:key="option.label"
:aria-label="option.label"
:data-testid="`template-option-${option.action}`"
@mousedown.prevent="emit('insert-template', option.action)"
:tabindex="0"
@click.prevent="emit('insert-template', option.action)"
>
{{ option.label }}
</button>
Expand All @@ -60,14 +65,16 @@
<button
v-if="mode !== 'read'"
data-testid="toggle-fullscreen"
@mousedown.prevent="emit('toggle-fullscreen')"
:tabindex="0"
@click.prevent="emit('toggle-fullscreen')"
>
Toggle Fullscreen
</button>
<button
v-if="['split', 'preview'].includes(mode)"
data-testid="toggle-html-preview"
@mousedown.prevent="emit('toggle-html-preview')"
:tabindex="0"
@click.prevent="emit('toggle-html-preview')"
>
Toggle HTML Preview
</button>
Expand All @@ -76,6 +83,7 @@
<template v-if="editable && mode === 'read'">
<button
data-testid="edit"
:tabindex="0"
@click="determineEditMode"
>
Edit
Expand All @@ -86,12 +94,14 @@
>
<button
data-testid="cancel"
:tabindex="0"
@click="cancelEdit"
>
Cancel
</button>
<button
data-testid="save"
:tabindex="0"
@click="saveChanges"
>
Save
Expand Down

0 comments on commit abd5085

Please sign in to comment.