2023-05-04 12:16:39 +00:00
|
|
|
|
import type { Editor } from '@tiptap/core'
|
|
|
|
|
import styles from './ImageBubbleMenu.module.scss'
|
2023-05-04 13:36:53 +00:00
|
|
|
|
import { clsx } from 'clsx'
|
|
|
|
|
import { Icon } from '../../_shared/Icon'
|
2023-05-04 12:16:39 +00:00
|
|
|
|
|
|
|
|
|
type BubbleMenuProps = {
|
|
|
|
|
editor: Editor
|
|
|
|
|
ref: (el: HTMLDivElement) => void
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export const ImageBubbleMenu = (props: BubbleMenuProps) => {
|
|
|
|
|
return (
|
2023-05-04 13:36:53 +00:00
|
|
|
|
<div ref={props.ref} class={styles.ImageBubbleMenu}>
|
2023-05-06 12:38:22 +00:00
|
|
|
|
<button
|
|
|
|
|
type="button"
|
|
|
|
|
class={clsx(styles.bubbleMenuButton)}
|
|
|
|
|
onClick={() => {
|
|
|
|
|
props.editor.chain().focus().setFloat('left').run()
|
|
|
|
|
}}
|
|
|
|
|
>
|
2023-05-04 13:36:53 +00:00
|
|
|
|
<Icon name="editor-image-align-left" />
|
|
|
|
|
</button>
|
2023-05-07 13:16:03 +00:00
|
|
|
|
<button
|
|
|
|
|
type="button"
|
|
|
|
|
class={clsx(styles.bubbleMenuButton)}
|
|
|
|
|
onClick={() => {
|
|
|
|
|
props.editor.chain().focus().setFloat(null).run()
|
|
|
|
|
}}
|
|
|
|
|
>
|
2023-05-04 13:36:53 +00:00
|
|
|
|
<Icon name="editor-image-align-center" />
|
|
|
|
|
</button>
|
2023-05-06 12:38:22 +00:00
|
|
|
|
<button
|
|
|
|
|
type="button"
|
|
|
|
|
class={clsx(styles.bubbleMenuButton)}
|
|
|
|
|
onClick={() => {
|
|
|
|
|
props.editor.chain().focus().setFloat('right').run()
|
|
|
|
|
}}
|
|
|
|
|
>
|
2023-05-04 13:36:53 +00:00
|
|
|
|
<Icon name="editor-image-align-right" />
|
|
|
|
|
</button>
|
|
|
|
|
<div class={styles.delimiter} />
|
2023-05-07 13:16:03 +00:00
|
|
|
|
<button
|
|
|
|
|
type="button"
|
|
|
|
|
class={clsx(styles.bubbleMenuButton)}
|
|
|
|
|
onClick={() => {
|
|
|
|
|
props.editor.chain().focus().imageToFigure().run()
|
|
|
|
|
}}
|
|
|
|
|
>
|
|
|
|
|
<span style={{ color: 'white' }}>Добавить подпись</span>
|
|
|
|
|
</button>
|
|
|
|
|
<div class={styles.delimiter} />
|
2023-05-04 13:36:53 +00:00
|
|
|
|
<button type="button" class={clsx(styles.bubbleMenuButton)}>
|
2023-05-06 12:38:22 +00:00
|
|
|
|
<Icon name="editor-image-add" />
|
2023-05-04 13:36:53 +00:00
|
|
|
|
</button>
|
2023-05-04 12:16:39 +00:00
|
|
|
|
</div>
|
|
|
|
|
)
|
|
|
|
|
}
|