Contribute to this guide

guideDrag and drop

The drag and drop feature lets you drag and drop both text and content blocks such as paragraphs, tables, or lists inside the editor. This allows you to select an entire block or multiple blocks, and move them before or after other blocks. You can also drag and drop HTML and plain text content from outside the editor and use it to upload images.

# Demo

The demo below lets you drag contacts from the list to the editor. The contacts are inserted into the editor as custom widgets representing the h-card microformat. You can also select and drag around existing content inside the editor.

List of contacts

    The Annual Meeting of Fictional Characters

    Announcement

    It is with great pleasure that we hereby announce that the theme of this year’s meeting is “E-ink Technology and Classic Fairy Tales”. As every year, the event will be hosted in The Wonderland by Alice +20 4345 234 235, starting tomorrow at 8:00 GMT.

    Speakers and agenda

    TBA.

    Venue

    For detailed information, please contact Huckleberry Finn +48 1345 234 235.

    Accommodation

    Many thanks to Robinson Crusoe +45 2345 234 235 who kindly offered his island to the guests of the annual meeting.


    Little Red Riding Hood +45 2345 234 235

    Photos: Wikipedia.org.

    This demo presents a limited set of features. Visit the feature-rich editor example to see more in action.

    The source code of the above snippet is available here: drag-drop.js, drag-drop.html. You can find the configuration of the editor used in the demo here: build-drag-drop-source.js. The code for the custom plugin responsible for handling the h-cards is available here: hcard.js.

    # File upload via drag and drop

    When the CKBox file manager is enabled in your CKEditor 5 integration, you can upload files and images using the drag and drop mechanism. You can test this solution in the CKBox demo.

    # Drag and drop of content blocks

    Since v40.0.0, the drag and drop plugin fully supports dragging content blocks such as paragraphs, tables, or lists inside the editor by default. This allows you to select an entire block or multiple blocks, and move them before or after other blocks.

    The drag and drop functions include:

    • Selection of the text, elements, multiple blocks, and moving these around.
    • Placement of blocks inside other blocks such as tables, blockquotes, etc.
    • The braille dots panel icon Drag indicator in the balloon block editor now behaves as a drag handle.

    # Classic editor demo

    Select a block or blocks, and drag them across the document. You can place blocks inside other blocks, such as tables and blockquotes.

    The Flavorful Tuscany Meetup

    Welcome letter

    Dear Guest,

    We are delighted to welcome you to the annual Flavorful Tuscany Meetup. We hope you will enjoy the program as well as your stay at the Bilancino Hotel.

    Bilancino Hotel
    Bilancino Hotel

    Please find below the full schedule of the event.

    Saturday, July 14
    9:30 AM - 11:30 AM

    Americano vs. Brewed - “know your coffee” with: 

    • Giulia Orlanda
    • Stefano Garau
    • Giuseppe Russo
    1:00 PM - 3:00 PM

    Regional delicacies of Tuscany - live cooking

    Incorporate the freshest ingredients 
    with Rita Fresco

    5:00 PM - 8:00 PM Tuscan vineyards at a glance - wine-tasting 
    with Frederico Riscoli

    The annual Flavorful Tuscany meetups are always a culinary discovery. You get the best of Tuscan flavors during an intense one-day stay at one of the top hotels in the region. All the sessions are led by top chefs passionate about their profession. I would recommend saving the date in your calendar for this one!

    Angelina Calvino, food journalist

    Please arrive at the Bilancino Hotel reception desk at least half an hour earlier to ensure that the registration process goes as smoothly as possible.

    We look forward to welcoming you to the event.

    Victoria Valc signature

    Victoria Valc

    Event Manager

    Bilancino Hotel

    # Balloon block editor demo

    In the balloon block editor, you can also drag content blocks using the drag handle. Select or focus on the block, and then drag the block with the braille dots panel icon Drag indicator.

    The Flavorful Tuscany Meetup

    Welcome letter

    Dear Guest,

    We are delighted to welcome you to the annual Flavorful Tuscany Meetup. We hope you will enjoy the program as well as your stay at the Bilancino Hotel.

    Bilancino Hotel
    Bilancino Hotel

    Please find below the full schedule of the event.

    Saturday, July 14
    9:30 AM - 11:30 AM

    Americano vs. Brewed - “know your coffee” with: 

    • Giulia Orlanda
    • Stefano Garau
    • Giuseppe Russo
    1:00 PM - 3:00 PM

    Regional delicacies of Tuscany - live cooking

    Incorporate the freshest ingredients 
    with Rita Fresco

    5:00 PM - 8:00 PM Tuscan vineyards at a glance - wine-tasting 
    with Frederico Riscoli

    The annual Flavorful Tuscany meetups are always a culinary discovery. You get the best of Tuscan flavors during an intense one-day stay at one of the top hotels in the region. All the sessions are led by top chefs passionate about their profession. I would recommend saving the date in your calendar for this one!

    Angelina Calvino, food journalist

    Please arrive at the Bilancino Hotel reception desk at least half an hour earlier to ensure that the registration process goes as smoothly as possible.

    We look forward to welcoming you to the event.

    Victoria Valc signature

    Victoria Valc

    Event Manager

    Bilancino Hotel

    # Installation

    This feature is required by the clipboard plugin and is enabled by default in all predefined builds. These installation instructions are for developers interested in building their own custom rich-text editor.

    To add this feature to your rich-text editor, install the @ckeditor/ckeditor5-clipboard package:

    npm install --save @ckeditor/ckeditor5-clipboard
    

    Then add the Clipboard plugin to your plugin list:

    import { Clipboard } from '@ckeditor/ckeditor5-clipboard';
    
    ClassicEditor.create( document.querySelector( '#editor' ), {
        plugins: [ Clipboard, Bold, /* ... */ ],
    })
        .then( /* ... */ )
        .catch( /* ... */ );
    

    The DragDrop plugin will activate along with the clipboard plugin.

    # Styling the drag and drop

    The drag and drop target line color is managed by the CSS variable (--ck-clipboard-drop-target-color). You can use the following snippet to change the color of the line:

    :root {
        --ck-clipboard-drop-target-color: green;
    }
    
    • CKEditor 5 supports dropping images from the file system thanks to the image upload feature.

    # Contribute

    The source code of the feature is available on GitHub at https://github.com/ckeditor/ckeditor5/tree/master/packages/ckeditor5-clipboard.