Skip to content

Commit

Permalink
Merge pull request #15075 from ckeditor/ck/15074
Browse files Browse the repository at this point in the history
Docs: Changes to the drag and drop behavior in guides. Closes #15074
  • Loading branch information
godai78 authored Sep 27, 2023
2 parents 05ae1ae + ed3d07e commit 2908b1d
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 38 deletions.
3 changes: 2 additions & 1 deletion docs/examples/builds/balloon-block-editor.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@ classes: main__content--no-toc
{@link installation/getting-started/predefined-builds#balloon-block-editor Balloon block editor} lets you create your content directly in its target location with the help of two toolbars:

* a balloon toolbar that appears next to the selected editable document element (offering inline content formatting tools),
* a {@link features/blocktoolbar block toolbar} accessible using a button attached to the editable content area and following the selection in the document (bringing additional block formatting tools).
* a {@link features/blocktoolbar block toolbar} accessible using a button (``) attached to the editable content area and following the selection in the document (bringing additional block formatting tools),
* the `` toolbar is also a handle that can be used to drag and drop blocks around the content.

{@snippet examples/balloon-block-editor}

Expand Down
39 changes: 3 additions & 36 deletions packages/ckeditor5-clipboard/docs/features/drag-drop.md
Original file line number Diff line number Diff line change
Expand Up @@ -57,59 +57,26 @@ The {@link module:clipboard/dragdrop~DragDrop `DragDrop`} plugin will activate a

## Drag and drop of content blocks

In the v38.0.0 release, we introduced plugins that enable dragging 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.
The drag and drop plugin enables dragging 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.

Functions introduced in the initial release include:

* Selection of the text, elements, multiple blocks, and moving these around.
* Placement of blocks inside other blocks such as tables, blockquotes, etc.
* The pilcrow icon {@icon @ckeditor/ckeditor5-core/theme/icons/pilcrow.svg} in the balloon block editor now behaves as a drag handle.

Feedback for the drag and drop of blocks is gathered in [issue #7731](https://github.com/ckeditor/ckeditor5/issues/7731). If you have any thoughts on what should work better, leave us a comment!
* The braille dots panel icon (``) 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.

{@snippet features/block-drag-drop}

#### Installation

<info-box info>
This feature is required by the clipboard plugin and is enabled by default in all {@link installation/getting-started/predefined-builds predefined builds}. These installation instructions are for developers interested in building their own custom rich-text editor.
</info-box>

### 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 pilcrow icon {@icon @ckeditor/ckeditor5-core/theme/icons/pilcrow.svg}.
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 (``).

{@snippet features/block-balloon-drag-drop}

#### Installation

To enable the block drag and drop in a balloon block editor, you need to add the {@link module:clipboard/dragdrop~DragDrop `DragDrop`} and the {@link module:clipboard/dragdropblocktoolbar~DragDropBlockToolbar `DragDropBlockToolbar`} modules to your editor configuration::

```js
import { BalloonEditor } from '@ckeditor/ckeditor5-editor-balloon';
import {
DragDrop,
DragDropBlockToolbar,
} from '@ckeditor/ckeditor5-clipboard';
import { BlockToolbar } from '@ckeditor/ckeditor5-ui';

BalloonEditor.create(document.querySelector( '#editor' ), {
plugins: [
Clipboard,
DragDrop,
DragDropBlockToolbar,
BlockToolbar,
/* ... */
],
})
.then( /* ... */ )
.catch( /* ... */ );
```

## Styling the drag and drop

The drag and drop target line color is managed by CSS variable (`--ck-clipboard-drop-target-color`). You can use the following snippet to change the color of the line:
Expand Down
2 changes: 1 addition & 1 deletion packages/ckeditor5-ui/docs/features/blocktoolbar.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ The block toolbar plugin provides an additional [configurable](#configuration) t
## Demo

<info-box hint>
In the editor below, move the caret around the content. You'll see that the block toolbar button (&#182;) is following your selection. Click the button to show the toolbar.
In the editor below, move the caret around the content. You'll see that the block toolbar button (`⠿`) is following your selection. Click the button to show the toolbar.
</info-box>

{@snippet features/blocktoolbar}
Expand Down

0 comments on commit 2908b1d

Please sign in to comment.