Usage
The EditorDragHandle component provides drag-and-drop functionality for reordering editor blocks using the @tiptap/extension-drag-handle-vue-3 package.
It extends the Button component, so you can pass any property such as color, size, etc.
Icon
Use the icon prop to customize the drag handle icon.
<script setup lang="ts">
import DragLIcon from '@bitrix24/b24icons-vue/outline/DragLIcon'
</script>
<template>
<B24Editor v-slot="{ editor }">
<B24EditorDragHandle :editor="editor" :icon="DragLIcon" />
</B24Editor>
</template>
Options
Use the options prop to customize the positioning behavior using Floating UI options.
<template>
<B24Editor v-slot="{ editor }">
<B24EditorDragHandle
:editor="editor"
:options="{
placement: 'left'
}"
/>
</B24Editor>
</template>
Examples
With dropdown menu
Use the default slot to add a DropdownMenu with block-level actions like duplicate, delete, move up/down, or transform blocks into different types.
Listen to the @node-change event to track the currently hovered node and its position, then use editor.chain().setMeta('lockDragHandle', open).run() to lock the handle position while the menu is open.
mapEditorItems utility from @bitrix24/b24ui-nuxt/utils/editor to automatically map handler kinds (like duplicate, delete, moveUp, etc.) to their corresponding editor commands with proper state management.With suggestion menu
Use the default slot to add a Button next to the drag handle to open the EditorSuggestionMenu.
Call the onClick slot function to get the current node position, then use handlers.suggestion?.execute(editor, { pos: node?.pos }).run() to insert new blocks at that position.
API
Props
Slots
Emits
Theme
export default defineAppConfig({
b24ui: {
editorDragHandle: {
slots: {
root: 'hidden sm:flex items-center justify-center transition-all duration-200 ease-out',
handle: 'cursor-grab px-1'
}
}
}
})
import { defineConfig } from 'vite'
import vue from '@vitejs/plugin-vue'
import bitrix24UIPluginVite from '@bitrix24/b24ui-nuxt/vite'
export default defineConfig({
plugins: [
vue(),
bitrix24UIPluginVite({
b24ui: {
editorDragHandle: {
slots: {
root: 'hidden sm:flex items-center justify-center transition-all duration-200 ease-out',
handle: 'cursor-grab px-1'
}
}
}
})
]
})