v2.15.0

Editor

Редактор форматированного текста на базе TipTap с поддержкой Markdown, HTML и JSON.

Использование

Компонент Editor — мощный редактор форматированного текста на базе TipTap. Он поддерживает несколько форматов содержимого (JSON, HTML, Markdown), настраиваемые панели инструментов, перетаскивание блоков, слэш-команды, упоминания, выбор эмодзи и расширяемую архитектуру для своих возможностей.

В этом примере показан Editor, готовый к использованию в продакшене. Исходный код — на GitHub.
Если при работе с Editor или его расширениями возникают ошибки prosemirror вроде Adding different instances of a keyed plugin, добавьте пакеты prosemirror в список vite.optimizeDeps.include в файле nuxt.config.ts. Тогда Vite предварительно собирает эти зависимости и не загружает несколько экземпляров.
nuxt.config.ts
export default defineNuxtConfig({
  vite: {
    optimizeDeps: {
      include: [
        '@bxshefby/b24ui-nuxt > prosemirror-state',
        '@bxshefby/b24ui-nuxt > prosemirror-transform',
        '@bxshefby/b24ui-nuxt > prosemirror-model',
        '@bxshefby/b24ui-nuxt > prosemirror-view',
        '@bxshefby/b24ui-nuxt > prosemirror-gapcursor'
      ]
    }
  }
})

Содержимое

Директива v-model управляет значением Editor.

<script setup lang="ts">
const value = ref({
  type: 'doc',
  content: [
    {
      type: 'heading',
      attrs: {
        level: 1
      },
      content: [
        {
          type: 'text',
          text: 'Привет, мир'
        }
      ]
    },
    {
      type: 'paragraph',
      content: [
        {
          type: 'text',
          text: 'Это редактор '
        },
        {
          type: 'text',
          marks: [
            {
              type: 'bold'
            }
          ],
          text: 'форматированного текста'
        },
        {
          type: 'text',
          text: '.'
        }
      ]
    }
  ]
})
</script>

<template>
  <B24Editor v-model="value" class="w-full min-h-21" />
</template>
<script setup lang="ts">
import { ref } from 'vue'

const value = ref({
  type: 'doc',
  content: [
    {
      type: 'heading',
      attrs: {
        level: 1
      },
      content: [
        {
          type: 'text',
          text: 'Привет, мир'
        }
      ]
    },
    {
      type: 'paragraph',
      content: [
        {
          type: 'text',
          text: 'Это редактор '
        },
        {
          type: 'text',
          marks: [
            {
              type: 'bold'
            }
          ],
          text: 'форматированного текста'
        },
        {
          type: 'text',
          text: '.'
        }
      ]
    }
  ]
})
</script>

<template>
  <B24Editor v-model="value" class="w-full min-h-21" />
</template>

Тип содержимого

Editor сам определяет формат содержимого по типу v-model: строки считаются html, объекты — json.

Формат можно задать явно пропсом content-type: json, html или markdown.

<script setup lang="ts">
const value = ref(
  '<h1>Привет, мир</h1>\n<p>Это редактор <strong>форматированного текста</strong>.</p>\n'
)
</script>

<template>
  <B24Editor v-model="value" content-type="html" class="w-full min-h-21" />
</template>
<script setup lang="ts">
import { ref } from 'vue'

const value = ref(
  '<h1>Привет, мир</h1>\n<p>Это редактор <strong>форматированного текста</strong>.</p>\n'
)
</script>

<template>
  <B24Editor v-model="value" content-type="html" class="w-full min-h-21" />
</template>

Расширения

В Editor по умолчанию включены расширения:

  • StarterKit — базовые возможности редактирования (жирный, курсив, заголовки, списки и другое);
  • Placeholder — текст плейсхолдера (если задан пропс placeholder);
  • Image — вставка и показ изображений;
  • Mention — поддержка упоминаний через @;
  • Markdown — разбор и сериализация Markdown (если тип содержимого — markdown).
Каждое встроенное расширение настраивается своим пропсом (starter-kit, placeholder, image, mention, markdown) через параметры TipTap.

Пропс extensions добавляет дополнительные расширения TipTap и расширяет возможности Editor:

<script setup lang="ts">
import { Emoji } from '@tiptap/extension-emoji'
import { TextAlign } from '@tiptap/extension-text-align'

const value = ref('<h1>Hello World</h1>\n')
</script>

<template>
  <B24Editor
    v-model="value"
    :extensions="[
      Emoji,
      TextAlign.configure({
        types: ['heading', 'paragraph']
      })
    ]"
  />
</template>
Пример загрузки изображений показывает, как создавать собственные расширения TipTap.

Плейсхолдер

Пропс placeholder задаёт текст плейсхолдера, который показывается в пустых абзацах.

<script setup lang="ts">
const value = ref('')
</script>

<template>
  <B24Editor v-model="value" placeholder="Начните писать..." class="w-full min-h-7" />
</template>
<script setup lang="ts">
import { ref } from 'vue'

const value = ref('')
</script>

<template>
  <B24Editor v-model="value" placeholder="Начните писать..." class="w-full min-h-7" />
</template>
Пропс placeholder принимает строку или объект с PlaceholderOptions и дополнительным свойством mode:
  • everyLine — плейсхолдер в каждой пустой строке при фокусе (по умолчанию);
  • firstLine — плейсхолдер только в первой строке, когда редактор пуст.
<template>
  <B24Editor :placeholder="{ placeholder: 'Start writing...', mode: 'firstLine' }" />
</template>
По умолчанию плейсхолдеры показываются только в пустых узлах верхнего уровня. Чтобы показывать их во вложенных элементах, например в пунктах списка, задайте includeChildren: true:
<template>
  <B24Editor :placeholder="{ placeholder: 'Start writing...', includeChildren: true }" />
</template>
Подробнее о расширении Placeholder — в документации TipTap.

Starter Kit

Пропс starter-kit настраивает встроенное расширение TipTap StarterKit, в которое входят типичные возможности редактора: жирный текст, курсив, заголовки, списки, цитаты, блоки кода и другое.

<script setup lang="ts">
const value = ref('<h1>Hello World</h1>\n')
</script>

<template>
  <B24Editor
    v-model="value"
    :starter-kit="{
      blockquote: false,
      headings: {
        levels: [1, 2, 3, 4]
      },
      dropcursor: {
        color: 'var(--ui-color-accent-main-primary)',
        width: 2
      },
      link: {
        openOnClick: false
      }
    }"
  />
</template>
Значение false у starter-kit превращает Editor в редактор простого текста. Остаются только базовые узлы (абзац, текст, история), а все возможности форматирования отключаются: жирный текст, курсив, заголовки, списки, код, цитаты, ссылки и горизонтальные линии.
Подробнее о расширении StarterKit — в документации TipTap.

Обработчики

Обработчики оборачивают встроенные команды TipTap и дают единый интерфейс для действий редактора. Если элементу EditorToolbar или EditorSuggestionMenu задать свойство kind, соответствующий обработчик выполнит команду TipTap и будет следить за её состоянием (активна, отключена и так далее).

Обработчики по умолчанию

В Editor есть такие обработчики по умолчанию. Их можно указывать в элементах панели инструментов или меню подсказок через свойство kind:

ОбработчикОписаниеИспользование
markПереключает текстовые выделения (жирный, курсив, зачёркнутый, код, подчёркнутый)Нужно свойство mark в элементе
textAlignЗадаёт выравнивание текста (слева, по центру, справа, по ширине)Нужно свойство align в элементе
headingПереключает уровни заголовков (1–6)Нужно свойство level в элементе
linkДобавляет, редактирует или удаляет ссылкиЕсли URL не задан, запрашивает его
imageВставляет изображенияЕсли URL не задан, запрашивает его
blockquoteПереключает цитаты
bulletListПереключает маркированные спискиПреобразует списки
orderedListПереключает нумерованные спискиПреобразует списки
taskListПереключает списки задачПреобразует списки
codeBlockПереключает блоки кода
horizontalRuleВставляет горизонтальные линии
paragraphЗадаёт формат абзаца
undoОтменяет последнее изменение
redoВозвращает отменённое изменение
clearFormattingУбирает всё форматированиеРаботает с выделением или позицией
duplicateДублирует узелНужно свойство pos в элементе
deleteУдаляет узелНужно свойство pos в элементе
moveUpПеремещает узел вверхНужно свойство pos в элементе
moveDownПеремещает узел внизНужно свойство pos в элементе
suggestionВызывает меню подсказокВставляет символ /
mentionВызывает меню упоминанийВставляет символ @
emojiВызывает выбор эмодзиВставляет символ :
Обработчики taskList и textAlign работают, только если установлены соответствующие расширения: в Editor их по умолчанию нет.

Так обработчики по умолчанию используются в элементах панели инструментов или меню подсказок:

<script setup lang="ts">
import type { EditorToolbarItem } from '@bxshefby/b24ui-nuxt'
import BoldIcon from '@bitrix24/b24icons-vue/outline/BoldIcon'
import ItalicIcon from '@bitrix24/b24icons-vue/outline/ItalicIcon'
import AlignLeftIcon from '@bitrix24/b24icons-vue/outline/AlignLeftIcon'
import AlignCenterIcon from '@bitrix24/b24icons-vue/outline/AlignCenterIcon'
import BulletedListIcon from '@bitrix24/b24icons-vue/outline/BulletedListIcon'
import NumberedListIcon from '@bitrix24/b24icons-vue/outline/NumberedListIcon'
import QuoteIcon from '@bitrix24/b24icons-vue/outline/QuoteIcon'
import LinkIcon from '@bitrix24/b24icons-vue/outline/LinkIcon'

const value = ref('<h1>Hello World</h1>\n')

const items: EditorToolbarItem[] = [
  { kind: 'mark', mark: 'bold', icon: BoldIcon },
  { kind: 'mark', mark: 'italic', icon: ItalicIcon },
  { kind: 'heading', level: 1 },
  { kind: 'heading', level: 2 },
  { kind: 'textAlign', align: 'left', icon: AlignLeftIcon },
  { kind: 'textAlign', align: 'center', icon: AlignCenterIcon },
  { kind: 'bulletList', icon: BulletedListIcon },
  { kind: 'orderedList', icon: NumberedListIcon },
  { kind: 'blockquote', icon: QuoteIcon },
  { kind: 'link', icon: LinkIcon }
]
</script>

<template>
  <B24Editor v-slot="{ editor }" v-model="value">
    <B24EditorToolbar :editor="editor" :items="items" />
  </B24Editor>
</template>

Свои обработчики

Пропс handlers расширяет или переопределяет обработчики по умолчанию. Свои обработчики объединяются со стандартными, поэтому можно добавлять новые действия и менять поведение существующих.

Каждый обработчик реализует интерфейс EditorHandler:

interface EditorHandler {
  /* Проверяет, можно ли выполнить команду в текущем состоянии редактора */
  canExecute: (editor: Editor, item?: any) => boolean
  /* Выполняет команду и возвращает цепочку Tiptap */
  execute: (editor: Editor, item?: any) => any
  /* Определяет, выглядит ли элемент активным (для переключателей) */
  isActive: (editor: Editor, item?: any) => boolean
  /* Дополнительная проверка для отключения элемента (объединяется с `canExecute`) */
  isDisabled?: (editor: Editor, item?: any) => boolean
}

Пример собственных обработчиков:

<script setup lang="ts">
import type { Editor } from '@tiptap/vue-3'
import type { EditorCustomHandlers, EditorToolbarItem } from '@bxshefby/b24ui-nuxt'
import BoldIcon from '@bitrix24/b24icons-vue/outline/BoldIcon'
import TextColorIcon from '@bitrix24/b24icons-vue/editor/TextColorIcon'

const value = ref('<h1>Hello World</h1>\n')

const customHandlers = {
  highlight: {
    canExecute: (editor: Editor) => editor.can().toggleHighlight(),
    execute: (editor: Editor) => editor.chain().focus().toggleHighlight(),
    isActive: (editor: Editor) => editor.isActive('highlight'),
    isDisabled: (editor: Editor) => !editor.isEditable
  }
} satisfies EditorCustomHandlers

const items = [
  // Встроенный обработчик
  { kind: 'mark', mark: 'bold', icon: BoldIcon },
  // Свой обработчик
  { kind: 'highlight', icon: TextColorIcon }
] satisfies EditorToolbarItem<typeof customHandlers>[]
</script>

<template>
  <B24Editor v-slot="{ editor }" v-model="value" :handlers="customHandlers">
    <B24EditorToolbar :editor="editor" :items="items" />
  </B24Editor>
</template>
Полный пример с собственными обработчиками показывает загрузка изображений.

Примеры

С панелью инструментов

Компонент EditorToolbar добавляет в Editor панель инструментов fixed, bubble или floating с типичными действиями форматирования.

<script setup lang="ts">
import type { EditorToolbarItem } from '@bxshefby/b24ui-nuxt'
import HeaderIcon from '@bitrix24/b24icons-vue/editor/HeaderIcon'
import BoldIcon from '@bitrix24/b24icons-vue/outline/BoldIcon'
import ItalicIcon from '@bitrix24/b24icons-vue/outline/ItalicIcon'
import UnderlineIcon from '@bitrix24/b24icons-vue/outline/UnderlineIcon'
import StrikethroughIcon from '@bitrix24/b24icons-vue/outline/StrikethroughIcon'
import DeveloperResourcesIcon from '@bitrix24/b24icons-vue/outline/DeveloperResourcesIcon'

const value = ref(`# Панель инструментов

Выделите текст, чтобы над выделением появилась панель форматирования.`)

const items: EditorToolbarItem[][] = [
  [
    {
      icon: HeaderIcon,
      tooltip: { text: 'Заголовки' },
      content: { align: 'start' },
      items: [
        {
          kind: 'heading',
          level: 1,
          label: 'Заголовок 1'
        },
        {
          kind: 'heading',
          level: 2,
          label: 'Заголовок 2'
        },
        {
          kind: 'heading',
          level: 3,
          label: 'Заголовок 3'
        },
        {
          kind: 'heading',
          level: 4,
          label: 'Заголовок 4'
        }
      ]
    }
  ],
  [
    {
      kind: 'mark',
      mark: 'bold',
      icon: BoldIcon,
      tooltip: { text: 'Жирный' }
    },
    {
      kind: 'mark',
      mark: 'italic',
      icon: ItalicIcon,
      tooltip: { text: 'Курсив' }
    },
    {
      kind: 'mark',
      mark: 'underline',
      icon: UnderlineIcon,
      tooltip: { text: 'Подчёркнутый' }
    },
    {
      kind: 'mark',
      mark: 'strike',
      icon: StrikethroughIcon,
      tooltip: { text: 'Зачёркнутый' }
    },
    {
      kind: 'mark',
      mark: 'code',
      icon: DeveloperResourcesIcon,
      tooltip: { text: 'Код' }
    }
  ]
]
</script>

<template>
  <B24Editor v-slot="{ editor }" v-model="value" content-type="markdown" class="w-full min-h-21">
    <B24EditorToolbar :editor="editor" :items="items" layout="bubble" />
  </B24Editor>
</template>
<script setup lang="ts">
import { ref } from 'vue'
import type { EditorToolbarItem } from '@bxshefby/b24ui-nuxt'
import HeaderIcon from '@bitrix24/b24icons-vue/editor/HeaderIcon'
import BoldIcon from '@bitrix24/b24icons-vue/outline/BoldIcon'
import ItalicIcon from '@bitrix24/b24icons-vue/outline/ItalicIcon'
import UnderlineIcon from '@bitrix24/b24icons-vue/outline/UnderlineIcon'
import StrikethroughIcon from '@bitrix24/b24icons-vue/outline/StrikethroughIcon'
import DeveloperResourcesIcon from '@bitrix24/b24icons-vue/outline/DeveloperResourcesIcon'

const value = ref(`# Панель инструментов

Выделите текст, чтобы над выделением появилась панель форматирования.`)

const items: EditorToolbarItem[][] = [
  [
    {
      icon: HeaderIcon,
      tooltip: { text: 'Заголовки' },
      content: { align: 'start' },
      items: [
        {
          kind: 'heading',
          level: 1,
          label: 'Заголовок 1'
        },
        {
          kind: 'heading',
          level: 2,
          label: 'Заголовок 2'
        },
        {
          kind: 'heading',
          level: 3,
          label: 'Заголовок 3'
        },
        {
          kind: 'heading',
          level: 4,
          label: 'Заголовок 4'
        }
      ]
    }
  ],
  [
    {
      kind: 'mark',
      mark: 'bold',
      icon: BoldIcon,
      tooltip: { text: 'Жирный' }
    },
    {
      kind: 'mark',
      mark: 'italic',
      icon: ItalicIcon,
      tooltip: { text: 'Курсив' }
    },
    {
      kind: 'mark',
      mark: 'underline',
      icon: UnderlineIcon,
      tooltip: { text: 'Подчёркнутый' }
    },
    {
      kind: 'mark',
      mark: 'strike',
      icon: StrikethroughIcon,
      tooltip: { text: 'Зачёркнутый' }
    },
    {
      kind: 'mark',
      mark: 'code',
      icon: DeveloperResourcesIcon,
      tooltip: { text: 'Код' }
    }
  ]
]
</script>

<template>
  <B24Editor v-slot="{ editor }" v-model="value" content-type="markdown" class="w-full min-h-21">
    <B24EditorToolbar :editor="editor" :items="items" layout="bubble" />
  </B24Editor>
</template>

С ручкой перетаскивания

Компонент EditorDragHandle добавляет ручку для перетаскивания блоков.

<script setup lang="ts">
const value = ref(`# Ручка перетаскивания

Наведите курсор на левую сторону блока, чтобы появилась ручка перетаскивания, и меняйте порядок блоков.`)
</script>

<template>
  <B24Editor v-slot="{ editor }" v-model="value" content-type="markdown" class="w-full min-h-21">
    <B24EditorDragHandle :editor="editor" />
  </B24Editor>
</template>
<script setup lang="ts">
import { ref } from 'vue'

const value = ref(`# Ручка перетаскивания

Наведите курсор на левую сторону блока, чтобы появилась ручка перетаскивания, и меняйте порядок блоков.`)
</script>

<template>
  <B24Editor v-slot="{ editor }" v-model="value" content-type="markdown" class="w-full min-h-21">
    <B24EditorDragHandle :editor="editor" />
  </B24Editor>
</template>

С меню подсказок

Компонент EditorSuggestionMenu добавляет слэш-команды для быстрого форматирования и вставки.

<script setup lang="ts">
import type { EditorSuggestionMenuItem } from '@bxshefby/b24ui-nuxt'
import TextIcon from '@bitrix24/b24icons-vue/outline/TextIcon'
import BulletedListIcon from '@bitrix24/b24icons-vue/outline/BulletedListIcon'
import NumberedListIcon from '@bitrix24/b24icons-vue/outline/NumberedListIcon'
import QuoteIcon from '@bitrix24/b24icons-vue/outline/QuoteIcon'
import CodeIcon from '@bitrix24/b24icons-vue/common-service/CodeIcon'
import HrIcon from '@bitrix24/b24icons-vue/editor/HrIcon'

const value = ref(`# Меню подсказок

Введите /, чтобы открыть меню подсказок и посмотреть доступные команды форматирования.`)

const items: EditorSuggestionMenuItem[][] = [
  [
    {
      type: 'label',
      label: 'Текст'
    },
    {
      kind: 'paragraph',
      label: 'Абзац',
      icon: TextIcon
    },
    {
      kind: 'heading',
      level: 1,
      label: 'Заголовок 1'
    },
    {
      kind: 'heading',
      level: 2,
      label: 'Заголовок 2'
    },
    {
      kind: 'heading',
      level: 3,
      label: 'Заголовок 3'
    }
  ],
  [
    {
      type: 'label',
      label: 'Списки'
    },
    {
      kind: 'bulletList',
      label: 'Маркированный список',
      icon: BulletedListIcon
    },
    {
      kind: 'orderedList',
      label: 'Нумерованный список',
      icon: NumberedListIcon
    }
  ],
  [
    {
      type: 'label',
      label: 'Вставка'
    },
    {
      kind: 'blockquote',
      label: 'Цитата',
      icon: QuoteIcon
    },
    {
      kind: 'codeBlock',
      label: 'Блок кода',
      icon: CodeIcon
    },
    {
      kind: 'horizontalRule',
      label: 'Разделитель',
      icon: HrIcon
    }
  ]
]

// Безопасная для SSR функция, добавляющая меню в body (чтобы не было проблем с z-index в документации)
const appendToBody = import.meta.client ? () => document.body : undefined
</script>

<template>
  <B24Editor
    v-slot="{ editor }"
    v-model="value"
    content-type="markdown"
    placeholder="Введите / для команд..."
    class="w-full min-h-21"
  >
    <B24EditorSuggestionMenu :editor="editor" :items="items" :append-to="appendToBody" />
  </B24Editor>
</template>
<script setup lang="ts">
import { ref } from 'vue'
import type { EditorSuggestionMenuItem } from '@bxshefby/b24ui-nuxt'
import TextIcon from '@bitrix24/b24icons-vue/outline/TextIcon'
import BulletedListIcon from '@bitrix24/b24icons-vue/outline/BulletedListIcon'
import NumberedListIcon from '@bitrix24/b24icons-vue/outline/NumberedListIcon'
import QuoteIcon from '@bitrix24/b24icons-vue/outline/QuoteIcon'
import CodeIcon from '@bitrix24/b24icons-vue/common-service/CodeIcon'
import HrIcon from '@bitrix24/b24icons-vue/editor/HrIcon'

const value = ref(`# Меню подсказок

Введите /, чтобы открыть меню подсказок и посмотреть доступные команды форматирования.`)

const items: EditorSuggestionMenuItem[][] = [
  [
    {
      type: 'label',
      label: 'Текст'
    },
    {
      kind: 'paragraph',
      label: 'Абзац',
      icon: TextIcon
    },
    {
      kind: 'heading',
      level: 1,
      label: 'Заголовок 1'
    },
    {
      kind: 'heading',
      level: 2,
      label: 'Заголовок 2'
    },
    {
      kind: 'heading',
      level: 3,
      label: 'Заголовок 3'
    }
  ],
  [
    {
      type: 'label',
      label: 'Списки'
    },
    {
      kind: 'bulletList',
      label: 'Маркированный список',
      icon: BulletedListIcon
    },
    {
      kind: 'orderedList',
      label: 'Нумерованный список',
      icon: NumberedListIcon
    }
  ],
  [
    {
      type: 'label',
      label: 'Вставка'
    },
    {
      kind: 'blockquote',
      label: 'Цитата',
      icon: QuoteIcon
    },
    {
      kind: 'codeBlock',
      label: 'Блок кода',
      icon: CodeIcon
    },
    {
      kind: 'horizontalRule',
      label: 'Разделитель',
      icon: HrIcon
    }
  ]
]

// Безопасная для SSR функция, добавляющая меню в body (чтобы не было проблем с z-index в документации)
const appendToBody = import.meta.client ? () => document.body : undefined
</script>

<template>
  <B24Editor
    v-slot="{ editor }"
    v-model="value"
    content-type="markdown"
    placeholder="Введите / для команд..."
    class="w-full min-h-21"
  >
    <B24EditorSuggestionMenu :editor="editor" :items="items" :append-to="appendToBody" />
  </B24Editor>
</template>

С меню упоминаний

Компонент EditorMentionMenu добавляет упоминания через @ для тегов пользователей и других сущностей.

<script setup lang="ts">
import type { EditorMentionMenuItem } from '@bxshefby/b24ui-nuxt'

const value = ref(`# Меню упоминаний

Введите @, чтобы упомянуть пользователя, и выберите его из списка.`)

const items: EditorMentionMenuItem[] = [
  {
    label: 'bitrix24',
    avatar: {
      src: 'https://github.com/bitrix24.png',
      loading: 'lazy' as const
    }
  },
  {
    label: 'Сотрудник',
    avatar: {
      src: '/b24ui/avatar/employee.png',
      loading: 'lazy' as const
    }
  },
  {
    label: 'Ассистент',
    avatar: {
      src: '/b24ui/avatar/assistant.png',
      loading: 'lazy' as const
    }
  }
]

// Безопасная для SSR функция, добавляющая меню в body (чтобы не было проблем с z-index в документации)
const appendToBody = import.meta.client ? () => document.body : undefined
</script>

<template>
  <B24Editor
    v-slot="{ editor }"
    v-model="value"
    content-type="markdown"
    placeholder="Введите @, чтобы упомянуть пользователя..."
    class="w-full min-h-21"
  >
    <B24EditorMentionMenu :editor="editor" :items="items" :append-to="appendToBody" />
  </B24Editor>
</template>
<script setup lang="ts">
import { ref } from 'vue'
import type { EditorMentionMenuItem } from '@bxshefby/b24ui-nuxt'

const value = ref(`# Меню упоминаний

Введите @, чтобы упомянуть пользователя, и выберите его из списка.`)

const items: EditorMentionMenuItem[] = [
  {
    label: 'bitrix24',
    avatar: {
      src: 'https://github.com/bitrix24.png',
      loading: 'lazy' as const
    }
  },
  {
    label: 'Сотрудник',
    avatar: {
      src: '/b24ui/avatar/employee.png',
      loading: 'lazy' as const
    }
  },
  {
    label: 'Ассистент',
    avatar: {
      src: '/b24ui/avatar/assistant.png',
      loading: 'lazy' as const
    }
  }
]

// Безопасная для SSR функция, добавляющая меню в body (чтобы не было проблем с z-index в документации)
const appendToBody = import.meta.client ? () => document.body : undefined
</script>

<template>
  <B24Editor
    v-slot="{ editor }"
    v-model="value"
    content-type="markdown"
    placeholder="Введите @, чтобы упомянуть пользователя..."
    class="w-full min-h-21"
  >
    <B24EditorMentionMenu :editor="editor" :items="items" :append-to="appendToBody" />
  </B24Editor>
</template>

С меню эмодзи

Компонент EditorEmojiMenu добавляет выбор эмодзи.

<script setup lang="ts">
import type { EditorEmojiMenuItem } from '@bxshefby/b24ui-nuxt'
import { Emoji, gitHubEmojis } from '@tiptap/extension-emoji'

const value = ref(`# Меню эмодзи

Введите :, чтобы вставить эмодзи, и выберите нужный из списка.`)

const items: EditorEmojiMenuItem[] = gitHubEmojis.filter(
  (emoji) => !emoji.name.startsWith('regional_indicator_')
)

// Безопасная для SSR функция, добавляющая меню в body (чтобы не было проблем с z-index в документации)
const appendToBody = import.meta.client ? () => document.body : undefined
</script>

<template>
  <B24Editor
    v-slot="{ editor }"
    v-model="value"
    :extensions="[Emoji]"
    content-type="markdown"
    placeholder="Введите : для добавления эмодзи..."
    class="w-full min-h-21"
  >
    <B24EditorEmojiMenu :editor="editor" :items="items" :append-to="appendToBody" />
  </B24Editor>
</template>
<script setup lang="ts">
import { ref } from 'vue'
import type { EditorEmojiMenuItem } from '@bxshefby/b24ui-nuxt'
import { Emoji, gitHubEmojis } from '@tiptap/extension-emoji'

const value = ref(`# Меню эмодзи

Введите :, чтобы вставить эмодзи, и выберите нужный из списка.`)

const items: EditorEmojiMenuItem[] = gitHubEmojis.filter(
  (emoji) => !emoji.name.startsWith('regional_indicator_')
)

// Безопасная для SSR функция, добавляющая меню в body (чтобы не было проблем с z-index в документации)
const appendToBody = import.meta.client ? () => document.body : undefined
</script>

<template>
  <B24Editor
    v-slot="{ editor }"
    v-model="value"
    :extensions="[Emoji]"
    content-type="markdown"
    placeholder="Введите : для добавления эмодзи..."
    class="w-full min-h-21"
  >
    <B24EditorEmojiMenu :editor="editor" :items="items" :append-to="appendToBody" />
  </B24Editor>
</template>

С загрузкой изображений

В этом примере загрузка изображений собрана так: пропс extensions регистрирует свой узел TipTap, а пропс handlers определяет, как кнопка панели запускает загрузку.

  1. Создайте Vue-компонент на основе FileUpload:
EditorImageUploadNode.vue
<script setup lang="ts">
import type { NodeViewProps } from '@tiptap/vue-3'
import { NodeViewWrapper } from '@tiptap/vue-3'
import SpinnerIcon from '@bitrix24/b24icons-vue/specialized/SpinnerIcon'
import ImageIcon from '@bitrix24/b24icons-vue/outline/ImageIcon'

const props = defineProps<NodeViewProps>()

const file = ref<File | null>(null)
const loading = ref(false)

watch(file, async (newFile) => {
  if (!newFile) return

  loading.value = true

  const reader = new FileReader()
  reader.onload = async (e) => {
    const dataUrl = e.target?.result as string
    if (!dataUrl) {
      loading.value = false
      return
    }

    // Имитируем задержку загрузки
    await new Promise(resolve => setTimeout(resolve, 1000))

    const pos = props.getPos()
    if (typeof pos !== 'number') {
      loading.value = false
      return
    }

    props.editor
      .chain()
      .focus()
      .deleteRange({ from: pos, to: pos + 1 })
      .setImage({ src: dataUrl })
      .run()

    loading.value = false
  }
  reader.readAsDataURL(newFile)
})
</script>

<template>
  <NodeViewWrapper>
    <B24FileUpload
      v-model="file"
      accept="image/*"
      label="Загрузите изображение"
      description="SVG, PNG, JPG или GIF (не более 2 МБ)"
      :preview="false"
      class="min-h-48"
    >
      <template #leading>
        <B24Avatar
          :icon="loading ? SpinnerIcon : ImageIcon"
          size="md"
          :b24ui="{ icon: [loading && 'animate-spin'] }"
        />
      </template>
    </B24FileUpload>
  </NodeViewWrapper>
</template>
EditorImageUploadNode.vue
<script setup lang="ts">
import { ref, watch } from 'vue'
import type { NodeViewProps } from '@tiptap/vue-3'
import { NodeViewWrapper } from '@tiptap/vue-3'
import SpinnerIcon from '@bitrix24/b24icons-vue/specialized/SpinnerIcon'
import ImageIcon from '@bitrix24/b24icons-vue/outline/ImageIcon'

const props = defineProps<NodeViewProps>()

const file = ref<File | null>(null)
const loading = ref(false)

watch(file, async (newFile) => {
  if (!newFile) return

  loading.value = true

  const reader = new FileReader()
  reader.onload = async (e) => {
    const dataUrl = e.target?.result as string
    if (!dataUrl) {
      loading.value = false
      return
    }

    // Имитируем задержку загрузки
    await new Promise(resolve => setTimeout(resolve, 1000))

    const pos = props.getPos()
    if (typeof pos !== 'number') {
      loading.value = false
      return
    }

    props.editor
      .chain()
      .focus()
      .deleteRange({ from: pos, to: pos + 1 })
      .setImage({ src: dataUrl })
      .run()

    loading.value = false
  }
  reader.readAsDataURL(newFile)
})
</script>

<template>
  <NodeViewWrapper>
    <B24FileUpload
      v-model="file"
      accept="image/*"
      label="Загрузите изображение"
      description="SVG, PNG, JPG или GIF (не более 2 МБ)"
      :preview="false"
      class="min-h-48"
    >
      <template #leading>
        <B24Avatar
          :icon="loading ? SpinnerIcon : ImageIcon"
          size="md"
          :b24ui="{ icon: [loading && 'animate-spin'] }"
        />
      </template>
    </B24FileUpload>
  </NodeViewWrapper>
</template>
  1. Создайте своё расширение TipTap, которое регистрирует узел:
EditorImageUploadExtension.ts
import { Node, mergeAttributes } from '@tiptap/core'
import type { CommandProps, NodeViewRenderer } from '@tiptap/core'
import { VueNodeViewRenderer } from '@tiptap/vue-3'
import ImageUploadNodeComponent from './EditorImageUploadNode.vue'

declare module '@tiptap/core' {
  interface Commands<ReturnType> {
    imageUpload: {
      insertImageUpload: () => ReturnType
    }
  }
}

export const ImageUpload = Node.create({
  name: 'imageUpload',
  group: 'block',
  atom: true,
  draggable: true,
  addAttributes() {
    return {}
  },
  parseHTML() {
    return [{
      tag: 'div[data-type="image-upload"]'
    }]
  },
  renderHTML({ HTMLAttributes }) {
    return ['div', mergeAttributes(HTMLAttributes, { 'data-type': 'image-upload' })]
  },
  addNodeView(): NodeViewRenderer {
    return VueNodeViewRenderer(ImageUploadNodeComponent)
  },
  addCommands() {
    return {
      insertImageUpload: () => ({ commands }: CommandProps) => {
        return commands.insertContent({ type: this.name })
      }
    }
  }
})

export default ImageUpload
  1. Подключите своё расширение в Editor:
<script setup lang="ts">
import type { EditorCustomHandlers, EditorToolbarItem } from '@bxshefby/b24ui-nuxt'
import type { Editor } from '@tiptap/vue-3'
import { ImageUpload } from './EditorImageUploadExtension'
import HeaderIcon from '@bitrix24/b24icons-vue/editor/HeaderIcon'
import BoldIcon from '@bitrix24/b24icons-vue/outline/BoldIcon'
import ItalicIcon from '@bitrix24/b24icons-vue/outline/ItalicIcon'
import UnderlineIcon from '@bitrix24/b24icons-vue/outline/UnderlineIcon'
import StrikethroughIcon from '@bitrix24/b24icons-vue/outline/StrikethroughIcon'
import DeveloperResourcesIcon from '@bitrix24/b24icons-vue/outline/DeveloperResourcesIcon'
import ImageIcon from '@bitrix24/b24icons-vue/outline/ImageIcon'

const value = ref(`# Загрузка изображений

Этот редактор показывает, как создать собственное расширение TipTap с обработчиками. Нажмите кнопку изображения на панели инструментов, чтобы загрузить файл: перед вставкой изображения откроется собственный интерфейс [FileUpload](/docs/components/file-upload).

Попробуйте загрузить изображение ниже:

`)

const customHandlers = {
  imageUpload: {
    canExecute: (editor: Editor) => editor.can().insertContent({ type: 'imageUpload' }),
    execute: (editor: Editor) => editor.chain().focus().insertContent({ type: 'imageUpload' }),
    isActive: (editor: Editor) => editor.isActive('imageUpload'),
    isDisabled: undefined
  }
} satisfies EditorCustomHandlers

const items = [
  [
    {
      kind: 'imageUpload',
      icon: ImageIcon,
      label: 'Добавить изображение'
    }
  ],
  [
    {
      icon: HeaderIcon,
      content: { align: 'start' },
      items: [
        {
          kind: 'heading',
          level: 1,
          label: 'Заголовок 1'
        },
        {
          kind: 'heading',
          level: 2,
          label: 'Заголовок 2'
        },
        {
          kind: 'heading',
          level: 3,
          label: 'Заголовок 3'
        },
        {
          kind: 'heading',
          level: 4,
          label: 'Заголовок 4'
        }
      ]
    }
  ],
  [
    {
      kind: 'mark',
      mark: 'bold',
      icon: BoldIcon
    },
    {
      kind: 'mark',
      mark: 'italic',
      icon: ItalicIcon
    },
    {
      kind: 'mark',
      mark: 'underline',
      icon: UnderlineIcon
    },
    {
      kind: 'mark',
      mark: 'strike',
      icon: StrikethroughIcon
    },
    {
      kind: 'mark',
      mark: 'code',
      icon: DeveloperResourcesIcon
    }
  ]
] satisfies EditorToolbarItem<typeof customHandlers>[][]
</script>

<template>
  <B24Editor
    v-slot="{ editor }"
    v-model="value"
    :extensions="[ImageUpload]"
    :handlers="customHandlers"
    content-type="markdown"
    :b24ui="{ base: 'p-8 sm:px-16' }"
    class="w-full min-h-74"
  >
    <B24EditorToolbar
      :editor="editor"
      :items="items"
      class="border-b border-muted bg-default py-2 px-8 sm:px-16 overflow-x-auto"
    />
  </B24Editor>
</template>
<script setup lang="ts">
import { ref } from 'vue'
import type { EditorCustomHandlers, EditorToolbarItem } from '@bxshefby/b24ui-nuxt'
import type { Editor } from '@tiptap/vue-3'
import { ImageUpload } from './EditorImageUploadExtension'
import HeaderIcon from '@bitrix24/b24icons-vue/editor/HeaderIcon'
import BoldIcon from '@bitrix24/b24icons-vue/outline/BoldIcon'
import ItalicIcon from '@bitrix24/b24icons-vue/outline/ItalicIcon'
import UnderlineIcon from '@bitrix24/b24icons-vue/outline/UnderlineIcon'
import StrikethroughIcon from '@bitrix24/b24icons-vue/outline/StrikethroughIcon'
import DeveloperResourcesIcon from '@bitrix24/b24icons-vue/outline/DeveloperResourcesIcon'
import ImageIcon from '@bitrix24/b24icons-vue/outline/ImageIcon'

const value = ref(`# Загрузка изображений

Этот редактор показывает, как создать собственное расширение TipTap с обработчиками. Нажмите кнопку изображения на панели инструментов, чтобы загрузить файл: перед вставкой изображения откроется собственный интерфейс [FileUpload](/docs/components/file-upload).

Попробуйте загрузить изображение ниже:

`)

const customHandlers = {
  imageUpload: {
    canExecute: (editor: Editor) => editor.can().insertContent({ type: 'imageUpload' }),
    execute: (editor: Editor) => editor.chain().focus().insertContent({ type: 'imageUpload' }),
    isActive: (editor: Editor) => editor.isActive('imageUpload'),
    isDisabled: undefined
  }
} satisfies EditorCustomHandlers

const items = [
  [
    {
      kind: 'imageUpload',
      icon: ImageIcon,
      label: 'Добавить изображение'
    }
  ],
  [
    {
      icon: HeaderIcon,
      content: { align: 'start' },
      items: [
        {
          kind: 'heading',
          level: 1,
          label: 'Заголовок 1'
        },
        {
          kind: 'heading',
          level: 2,
          label: 'Заголовок 2'
        },
        {
          kind: 'heading',
          level: 3,
          label: 'Заголовок 3'
        },
        {
          kind: 'heading',
          level: 4,
          label: 'Заголовок 4'
        }
      ]
    }
  ],
  [
    {
      kind: 'mark',
      mark: 'bold',
      icon: BoldIcon
    },
    {
      kind: 'mark',
      mark: 'italic',
      icon: ItalicIcon
    },
    {
      kind: 'mark',
      mark: 'underline',
      icon: UnderlineIcon
    },
    {
      kind: 'mark',
      mark: 'strike',
      icon: StrikethroughIcon
    },
    {
      kind: 'mark',
      mark: 'code',
      icon: DeveloperResourcesIcon
    }
  ]
] satisfies EditorToolbarItem<typeof customHandlers>[][]
</script>

<template>
  <B24Editor
    v-slot="{ editor }"
    v-model="value"
    :extensions="[ImageUpload]"
    :handlers="customHandlers"
    content-type="markdown"
    :b24ui="{ base: 'p-8 sm:px-16' }"
    class="w-full min-h-74"
  >
    <B24EditorToolbar
      :editor="editor"
      :items="items"
      class="border-b border-muted bg-default py-2 px-8 sm:px-16 overflow-x-auto"
    />
  </B24Editor>
</template>
Подробнее о создании своих расширений — в документации TipTap.

API

Пропсы

Prop Default Type
as'div'any

The element or component this component should render as.

modelValuenull | string | JSONContent | JSONContent[]
contentType "markdown" | "json" | "html"

The content type the content is provided as. When not specified, it's automatically inferred: strings are treated as 'html', objects as 'json'.

starterKittrueboolean | Partial<StarterKitOptions>

The starter kit options to configure the editor. Set to false for a plain-text editor: keeps the essential nodes (paragraph, text, history) and disables all rich-text formatting.

placeholder{ showOnlyWhenEditable: false, showOnlyCurrent: true, mode: 'everyLine' } string | Partial<PlaceholderOptions> & { mode?: "firstLine" | "everyLine" | undefined; }

The placeholder text to show in empty paragraphs. Can be a string or PlaceholderOptions from @tiptap/extension-placeholder.

markdown{ markedOptions: { gfm: true } } Partial<MarkdownExtensionOptions>

The markdown extension options to configure markdown parsing and serialization.

imagetrueboolean | Partial<ImageOptions>

The image extension options to configure image handling. Set to false to disable the extension.

mentiontrueboolean | Partial<Omit<MentionOptions<any, MentionNodeAttrs>, "suggestion" | "suggestions">>

The mention extension options to configure mention handling. Set to false to disable the extension. The suggestion and suggestions options are omitted as they are managed by the EditorMentionMenu component.

handlers H

Custom item handlers to override or extend the default handlers. These handlers are provided to all child components (toolbar, suggestion menu, etc.).

extensions Extensions

The extensions to use

schemaSpec SchemaSpec<any, any>

A complete ProseMirror specification applied when the editor is created. Its structure replaces local node, mark and attribute definitions. Local extensions retain parsing, rendering, commands and plugins. Every node and mark must have a matching local extension, and vice versa. Changing this option on an existing editor does not rebuild its schema.

injectCSSboolean

Whether to inject base CSS styles

injectNonce string

A nonce to use for CSP while injecting styles

autofocus null | number | false | true | "start" | "end" | "all"

The editor's initial focus position

editableboolean

Whether the editor is editable

textDirection "ltr" | "rtl" | "auto"

The default text direction for all content in the editor. When set to 'ltr' or 'rtl', all nodes will have the corresponding dir attribute. When set to 'auto', the dir attribute will be set based on content detection. When undefined, no dir attribute will be added.

editorProps EditorProps<any>

The editor's props

parseOptionsParseOptions
coreExtensionOptions { clipboardTextSerializer?: { blockSeparator?: string | undefined; } | undefined; tabindex?: { value?: string | undefined; } | undefined; delete?: { async?: boolean | undefined; filterTransaction?: ((transaction: Transaction) => boolean) | undefined; } | undefined; }

The editor's core extension options

enableInputRules false | true | (string | AnyExtension)[]

Whether to enable input rules behavior

enablePasteRules false | true | (string | AnyExtension)[]

Whether to enable paste rules behavior

enableCoreExtensionsboolean | Partial<Record<"editable" | "textDirection" | "clipboardTextSerializer" | "commands" | "focusEvents" | "keymap" | "tabindex" | "drop" | "paste" | "delete", false>>

Determines whether core extensions are enabled.

If set to false, all core extensions will be disabled. To disable specific core extensions, provide an object where the keys are the extension names and the values are false. Extensions not listed in the object will remain enabled.

enableContentCheckboolean

If true, the editor will check the content for errors on initialization. Emitting the contentError event if the content is invalid. Which can be used to show a warning or error message to the user.

emitContentErrorboolean

If true, the editor will emit the contentError event if invalid content is encountered but enableContentCheck is false. This lets you preserve the invalid editor content while still showing a warning or error message to the user.

onBeforeCreate (props: { editor: Editor; }): void

Called before the editor is constructed.

onCreate (props: { editor: Editor; }): void

Called after the editor is constructed.

onMount (props: { editor: Editor; }): void

Called when the editor is mounted.

onUnmount (props: { editor: Editor; }): void

Called when the editor is unmounted.

onContentError (props: { editor: Editor; error: Error; disableCollaboration: () => void; }): void

Called when the editor encounters an error while parsing the content. Only enabled if enableContentCheck is true.

onUpdate (props: { editor: Editor; transaction: Transaction; appendedTransactions: Transaction[]; }): void

Called when the editor's content is updated.

onSelectionUpdate (props: { editor: Editor; transaction: Transaction; }): void

Called when the editor's selection is updated.

onTransaction (props: { editor: Editor; transaction: Transaction; appendedTransactions: Transaction[]; }): void

Called after a transaction is applied to the editor.

onFocus (props: { editor: Editor; event: FocusEvent; transaction: Transaction; }): void

Called on focus events.

onBlur (props: { editor: Editor; event: FocusEvent; transaction: Transaction; }): void

Called on blur events.

onDestroy (props: void): void

Called when the editor is destroyed.

onPaste (e: ClipboardEvent, slice: Slice): void

Called when content is pasted into the editor.

onDrop (e: DragEvent, slice: Slice, moved: boolean): void

Called when content is dropped into the editor.

onDelete (props: { editor: Editor; deletedRange: Range; newRange: Range; transaction: Transaction; combinedTransform: Transform; partial: boolean; from: number; to: number; } & ({ ...; } | { ...; })): void

Called when content is deleted from the editor.

enableExtensionDispatchTransactionboolean

Whether to enable extension-level dispatching of transactions. If false, extensions cannot define their own dispatchTransaction hook.

b24ui { root?: SlotClass; content?: SlotClass; base?: SlotClass; }

Слоты

Slot Type
default{ editor: Editor; handlers: EditorHandlers<H>; }

События

Event Type
update:modelValue[value: T]

Доступ через ref

Через ref шаблона доступно:

NameType
editorRef<Editor | undefined>
Доступный через ref экземпляр — это API редактора TipTap. Все методы и свойства описаны в документации TipTap.

Тема

https://github.com/bx-shef/b24-ui/tree/main/src/theme/editor.ts
export default {
  slots: {
    root: '',
    content: 'relative size-full flex-1',
    base: 'text-label w-full outline-none *:my-5 *:first:mt-0 *:last:mb-0 sm:px-8 selection:bg-(--ui-color-design-selection-bg) [&_p]:leading-7 [&_a]:text-(--ui-color-accent-main-primary) [&_a]:border-b [&_a]:border-transparent [&_a]:hover:border-(--ui-color-accent-main-primary) [&_a]:focus-visible:border-transparent [&_a:has(>code)]:border-b-0 [&_a]:font-(--ui-font-weight-medium) [&_a]:transition-colors [&_a>code]:border-dashed [&_a:hover>code]:border-(--ui-color-accent-soft-element-blue) [&_a:hover>code]:text-(--ui-color-accent-main-primary) [&_a:focus-visible>code]:border-(--ui-color-accent-soft-element-blue) [&_a:focus-visible>code]:text-(--ui-color-accent-main-primary) [&_a>code]:transition-colors [&_.mention]:text-(--ui-color-accent-main-primary) [&_.mention]:font-(--ui-font-weight-medium) [&_:is(h1,h2,h3,h4,h5,h6)]:text-label [&_:is(h1,h2,h3,h4,h5,h6)]:font-(--ui-font-weight-bold) [&_h1]:text-3xl [&_h2]:text-2xl [&_h3]:text-xl [&_h4]:text-lg [&_h5]:text-md [&_h6]:text-md [&_:is(h1,h2,h3,h4,h5,h6)>code]:border-dashed [&_:is(h1,h2,h3,h4,h5,h6)>code]:font-(--ui-font-weight-bold) [&_h2>code]:text-xl/6 [&_h3>code]:text-lg/5 [&_blockquote]:border-s-4 [&_blockquote]:border-(--ui-color-accent-soft-element-blue) [&_blockquote]:ps-4 [&_blockquote]:italic [&_[data-type=horizontalRule]]:my-8 [&_[data-type=horizontalRule]]:py-2 [&_hr]:border-t [&_hr]:border-(--ui-color-divider-default) [&_pre]:text-sm/6 [&_pre]:border [&_pre]:border-(--ui-color-design-tinted-na-stroke) [&_pre]:bg-(--ui-color-design-tinted-na-bg) [&_pre]:rounded-md [&_pre]:px-4 [&_pre]:py-3 [&_pre]:whitespace-pre-wrap [&_pre]:wrap-break-word [&_pre]:overflow-x-auto [&_pre_code]:p-0 [&_pre_code]:text-inherit [&_pre_code]:rounded-none [&_pre_code]:inline [&_pre_code]:border-0 [&_pre_code]:bg-transparent [&_code]:px-1.5 [&_code]:py-0.5 [&_code]:text-sm [&_code]:font-[family-name:var(--ui-font-family-system-mono)] [&_code]:font-(--ui-font-weight-medium) [&_code]:rounded-md [&_code]:inline-block [&_code]:border [&_code]:border-(--ui-color-design-tinted-na-stroke) [&_code]:text-label [&_code]:bg-(--ui-color-design-tinted-na-bg) [&_:is(ul,ol)]:ps-6 [&_ul]:list-disc [&_ul]:marker:text-(--ui-color-accent-soft-element-blue) [&_ol]:list-decimal [&_ol]:marker:text-label [&_li]:my-1.5 [&_li]:ps-1.5 [&_img]:rounded-md [&_img]:block [&_img]:max-w-full [&_img.ProseMirror-selectednode]:outline-2 [&_img.ProseMirror-selectednode]:outline-(--ui-color-accent-main-primary) [&_.ProseMirror-selectednode:not(img):not(pre):not([data-node-view-wrapper])]:bg-(--ui-color-design-selection-bg)'
  },
  variants: {
    placeholderMode: {
      firstLine: {
        base: '[&_:is(p,h1,h2,h3,h4,h5,h6).is-editor-empty:first-child]:before:content-[attr(data-placeholder)] [&_:is(p,h1,h2,h3,h4,h5,h6).is-editor-empty:first-child]:before:text-description [&_:is(p,h1,h2,h3,h4,h5,h6).is-editor-empty:first-child]:before:float-start [&_:is(p,h1,h2,h3,h4,h5,h6).is-editor-empty:first-child]:before:h-0 [&_:is(p,h1,h2,h3,h4,h5,h6).is-editor-empty:first-child]:before:pointer-events-none'
      },
      everyLine: {
        base: '[&_:is(p,h1,h2,h3,h4,h5,h6).is-empty]:before:content-[attr(data-placeholder)] [&_:is(p,h1,h2,h3,h4,h5,h6).is-empty]:before:text-description [&_:is(p,h1,h2,h3,h4,h5,h6).is-empty]:before:float-start [&_:is(p,h1,h2,h3,h4,h5,h6).is-empty]:before:h-0 [&_:is(p,h1,h2,h3,h4,h5,h6).is-empty]:before:pointer-events-none'
      }
    }
  },
  defaultVariants: {
    placeholderMode: 'everyLine'
  }
}