2023-02-06 01:11:09 +09:00
|
|
|
<script setup lang="ts">
|
|
|
|
import type { Editor } from '@tiptap/core'
|
2023-04-12 00:04:22 +09:00
|
|
|
|
2023-02-06 01:11:09 +09:00
|
|
|
const { editor } = defineProps<{
|
|
|
|
editor: Editor
|
|
|
|
}>()
|
|
|
|
</script>
|
|
|
|
|
|
|
|
<template>
|
|
|
|
<CommonTooltip placement="top" :content="$t('tooltip.open_editor_tools')">
|
2024-02-11 15:39:45 +09:00
|
|
|
<VDropdown v-if="editor" placement="bottom">
|
2023-02-06 01:11:09 +09:00
|
|
|
<button
|
|
|
|
btn-action-icon
|
2023-08-12 19:26:37 +09:00
|
|
|
:aria-label="$t('tooltip.open_editor_tools')"
|
2023-02-06 01:11:09 +09:00
|
|
|
>
|
|
|
|
<div i-ri:font-size-2 />
|
|
|
|
</button>
|
|
|
|
<template #popper>
|
|
|
|
<div flex gap-1>
|
|
|
|
<CommonTooltip placement="top" :content="$t('tooltip.toggle_code_block')">
|
|
|
|
<button
|
|
|
|
btn-action-icon
|
|
|
|
:aria-label="$t('tooltip.toggle_code_block')"
|
|
|
|
:class="editor.isActive('codeBlock') ? 'text-primary' : ''"
|
|
|
|
@click="editor?.chain().focus().toggleCodeBlock().run()"
|
|
|
|
>
|
|
|
|
<div i-ri:code-s-slash-line />
|
|
|
|
</button>
|
|
|
|
</CommonTooltip>
|
|
|
|
<CommonTooltip placement="top" :content="$t('tooltip.toggle_bold')">
|
|
|
|
<button
|
|
|
|
btn-action-icon
|
|
|
|
:aria-label="$t('tooltip.toggle_bold')"
|
|
|
|
:class="editor.isActive('bold') ? 'text-primary' : ''"
|
|
|
|
@click="editor?.chain().focus().toggleBold().run()"
|
|
|
|
>
|
|
|
|
<div i-ri:bold />
|
|
|
|
</button>
|
|
|
|
</CommonTooltip>
|
|
|
|
<CommonTooltip placement="top" :content="$t('tooltip.toggle_italic')">
|
|
|
|
<button
|
|
|
|
btn-action-icon
|
|
|
|
:aria-label="$t('tooltip.toggle_italic')"
|
|
|
|
:class="editor.isActive('italic') ? 'text-primary' : ''"
|
|
|
|
@click="editor?.chain().focus().toggleItalic().run()"
|
|
|
|
>
|
|
|
|
<div i-ri:italic />
|
|
|
|
</button>
|
|
|
|
</CommonTooltip>
|
|
|
|
</div>
|
|
|
|
</template>
|
|
|
|
</VDropdown>
|
|
|
|
</CommonTooltip>
|
|
|
|
</template>
|