Skip to content

Commit

Permalink
fix: bubble menu
Browse files Browse the repository at this point in the history
close #11
  • Loading branch information
gbicou committed Mar 31, 2023
1 parent 90f3e05 commit 82d40a6
Showing 1 changed file with 24 additions and 1 deletion.
25 changes: 24 additions & 1 deletion src/tiptap-editor.vue
Original file line number Diff line number Diff line change
@@ -1,5 +1,17 @@
<template>
<div class="tiptap-editor" :class="{ disabled: props.disabled }">
<bubble-menu class="tiptap-editor__bubble" :editor="editor" :tippy-options="{ duration: 100 }">
<v-chip x-small @click="editor.chain().focus().toggleBold().run()" :outlined="!editor.isActive('bold')">
{{ t("wysiwyg_options.bold").toLowerCase() }}
</v-chip>
<v-chip x-small @click="editor.chain().focus().toggleItalic().run()" :outlined="!editor.isActive('italic')">
{{ t("wysiwyg_options.italic").toLowerCase() }}
</v-chip>
<v-chip x-small @click="editor.chain().focus().toggleStrike().run()" :outlined="!editor.isActive('strike')">
{{ t("wysiwyg_options.strikethrough").toLowerCase() }}
</v-chip>
</bubble-menu>

<div class="tiptap-editor__toolbar">
<!-- marks -->

Expand Down Expand Up @@ -269,6 +281,17 @@
}
}
&__bubble {
.v-chip {
margin-left: 2px;
cursor: pointer;
&.outlined {
background-color: var(--background-page);
}
}
}
&__content {
font-family: var(--family-sans-serif);
font-weight: 400;
Expand All @@ -291,7 +314,7 @@
</style>

<script setup lang="ts">
import { Editor, EditorContent } from "@tiptap/vue-3";
import { Editor, EditorContent, BubbleMenu } from "@tiptap/vue-3";
import { onBeforeUnmount, watch } from "vue";
import { useI18n } from "vue-i18n";
import { translateShortcut } from "./utils/translate-shortcut";
Expand Down

0 comments on commit 82d40a6

Please sign in to comment.