Skip to content

Commit

Permalink
Merge pull request #1437 from ckeditor/t/ckeditor5-build-balloon-block/1
Browse files Browse the repository at this point in the history
Feature: Introduced the balloon block editor build. See ckeditor/ckeditor5-build-balloon-block#1.
  • Loading branch information
Reinmar authored Feb 18, 2019
2 parents 4ec0e26 + 8c2fa14 commit ae00556
Show file tree
Hide file tree
Showing 8 changed files with 148 additions and 0 deletions.
13 changes: 13 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ The following CKEditor 5 Builds are currently available:
* [Classic editor](https://ckeditor.com/docs/ckeditor5/latest/builds/guides/overview.html#classic-editor)
* [Inline editor](https://ckeditor.com/docs/ckeditor5/latest/builds/guides/overview.html#inline-editor)
* [Balloon editor](https://ckeditor.com/docs/ckeditor5/latest/builds/guides/overview.html#balloon-editor)
* [Balloon block editor](https://ckeditor.com/docs/ckeditor5/latest/builds/guides/overview.html#balloon-block-editor)
* [Document editor](https://ckeditor.com/docs/ckeditor5/latest/builds/guides/overview.html#document-editor)

#### Example
Expand Down Expand Up @@ -283,6 +284,18 @@ See CKEditor 5 release blog posts [on the CKEditor blog](https://ckeditor.com/bl
</td>
</tr>

<tr>
<td>
<a href="https://github.com/ckeditor/ckeditor5-build-balloon-block"><code>@ckeditor/ckeditor5-build-balloon-block</code></a>
</td>
<td>
<a href="https://www.npmjs.com/package/@ckeditor/ckeditor5-build-balloon-block"><img src="https://img.shields.io/npm/v/@ckeditor/ckeditor5-build-balloon-block.svg" alt="@ckeditor/ckeditor5-build-balloon-block npm package badge"></a>
</td>
<td>
The balloon editor with a block toolbar (Slack–like) build.
</td>
</tr>

<tr>
<td>
<a href="https://github.com/ckeditor/ckeditor5-build-decoupled-document"><code>@ckeditor/ckeditor5-build-decoupled-document</code></a>
Expand Down
37 changes: 37 additions & 0 deletions docs/_snippets/examples/balloon-block-editor.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
<div id="snippet-balloon-block-editor">
<h2>Walking the capitals of Europe: Warsaw</h2>

<figure class="media">
<oembed url="https://www.youtube.com/watch?v=WmWFwGLA1kQ"></oembed>
</figure>

<p>If you enjoyed my previous articles in which we discussed wandering around <a href="https://en.wikipedia.org/wiki/Copenhagen">Copenhagen</a> and <a href="https://en.wikipedia.org/wiki/Vilnius">Vilnius</a>, you’ll definitely love exploring <a href="https://en.wikipedia.org/wiki/Warsaw">Warsaw</a>.</p>

<h3>Time to put comfy sandals on!</h3>

<p>Best time to visit the city is July and August, when it’s cool enough to not break a sweat and hot enough to enjoy summer. The city which has quite a combination of both old and modern textures is located by the river of Vistula.</p>

<p>The historic <strong>Old Town</strong>, which was reconstructed after the World War II, with its late 18th century characteristics, is a must-see. You can start your walk from the <strong>Nowy Świat Street</strong> which will take you straight to the Old Town.</p>

<p>Then you can go to the <strong>Powiśle</strong> area and take a walk on the newly renovated promenade on the riverfront. There are also lots of cafes, bars and restaurants where you can shake off the exhaustion of the day. On Sundays, there are many parks where you can enjoy nature or listen to pianists from around the world playing Chopin.</p>

<p>For museum lovers, you can add these to your list:</p>

<ul>
<li><a href="http://www.polin.pl/en">POLIN</a></li>
<li><a href="http://www.1944.pl/en">Warsaw Uprising Museum</a></li>
<li><a href="http://chopin.museum/en">Fryderyk Chopin Museum</a></li>
</ul>

<h3>Next destination</h3>

<p>We will go to Berlin and have a night's walk in the city that never sleeps! Make sure you subscribe to our newsletter!</p>
</div>

<style>
/* Restrict the width of the editor to isolate it from the content of the guide. */
#snippet-balloon-block-editor {
margin-left: 5%;
margin-right: 5%;
}
</style>
21 changes: 21 additions & 0 deletions docs/_snippets/examples/balloon-block-editor.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
/**
* @license Copyright (c) 2003-2018, CKSource - Frederico Knabben. All rights reserved.
* For licensing, see LICENSE.md.
*/

/* globals console, window, document */

import BalloonEditor from '@ckeditor/ckeditor5-build-balloon-block/src/ckeditor';

import { CS_CONFIG } from '@ckeditor/ckeditor5-cloud-services/tests/_utils/cloud-services-config';

BalloonEditor
.create( document.querySelector( '#snippet-balloon-block-editor' ), {
cloudServices: CS_CONFIG
} )
.then( editor => {
window.editor = editor;
} )
.catch( err => {
console.error( err );
} );
Binary file added docs/assets/img/editor-balloon-block.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 2 additions & 0 deletions docs/builds/guides/integration/installation.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,8 @@ npm install --save @ckeditor/ckeditor5-build-inline
# Or:
npm install --save @ckeditor/ckeditor5-build-balloon
# Or:
npm install --save @ckeditor/ckeditor5-build-balloon-block
# Or:
npm install --save @ckeditor/ckeditor5-build-decoupled-document
```

Expand Down
8 changes: 8 additions & 0 deletions docs/builds/guides/overview.md
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,14 @@ Balloon editor is very similar to inline editor. The difference between them is

To try it out online, check the {@link examples/builds/balloon-editor balloon editor example}. Jump to {@link builds/guides/quick-start#balloon-editor Quick start} to start using it.

### Balloon block editor

Balloon block is essentially the [balloon editor](#balloon-editor) with an extra block toolbar which can be accessed using the button attached to the editable content area and following the selection in the document. The toolbar gives an access to additional, block–level editing features.

{@img assets/img/editor-balloon-block.png 813 Screenshot of a balloon block toolbar editor.}

To try it out online, check the {@link examples/builds/balloon-block-editor balloon block editor example}. Jump to {@link builds/guides/quick-start#balloon-block-editor Quick start} to start using it.

### Document editor

The document editor is focused on rich text editing experience similar to the native word processors. It works best for creating documents which are usually later printed or exported to PDF files.
Expand Down
54 changes: 54 additions & 0 deletions docs/builds/guides/quick-start.md
Original file line number Diff line number Diff line change
Expand Up @@ -173,6 +173,60 @@ Call the {@link module:editor-balloon/ballooneditor~BalloonEditor#create `Balloo
</html>
```

## Balloon block editor

In your HTML page add an element that CKEditor should make editable:

```html
<div id="editor"></div>
```

Load the balloon block editor build (here [CDN](https://cdn.ckeditor.com/) location is used):

```html
<script src="https://cdn.ckeditor.com/ckeditor5/{@var ckeditor5-version}/balloon-block/ckeditor.js"></script>
```

Call the {@link module:editor-balloon/ballooneditor~BalloonEditor#create `BalloonEditor.create()`} method.

```html
<script>
BalloonEditor
.create( document.querySelector( '#editor' ) )
.catch( error => {
console.error( error );
} );
</script>
```

**Note:** You can configure the block toolbar items using the {@link module:core/editor/editorconfig~EditorConfig#blockToolbar `config.blockToolbar`} option.

### Example

```html
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>CKEditor 5 – Balloon block editor</title>
<script src="https://cdn.ckeditor.com/ckeditor5/{@var ckeditor5-version}/balloon-block/ckeditor.js"></script>
</head>
<body>
<h1>Balloon editor</h1>
<div id="editor">
<p>This is some sample content.</p>
</div>
<script>
BalloonEditor
.create( document.querySelector( '#editor' ) )
.catch( error => {
console.error( error );
} );
</script>
</body>
</html>
```

## Document editor

Load the document editor build (here [CDN](https://cdn.ckeditor.com/) location is used):
Expand Down
13 changes: 13 additions & 0 deletions docs/examples/builds/balloon-block-editor.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
---
category: examples-builds
order: 30
---

# Balloon block editor

{@link builds/guides/overview#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).

{@snippet examples/balloon-block-editor}

0 comments on commit ae00556

Please sign in to comment.