Skip to content
This repository has been archived by the owner on Jun 26, 2020. It is now read-only.

Commit

Permalink
Feature: Added block quote feature to the article preset. Closes #4.
Browse files Browse the repository at this point in the history
  • Loading branch information
Reinmar committed Apr 5, 2017
1 parent 1bf7f77 commit 30d7bd5
Show file tree
Hide file tree
Showing 4 changed files with 35 additions and 5 deletions.
18 changes: 16 additions & 2 deletions src/article.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import Plugin from '@ckeditor/ckeditor5-core/src/plugin';

import EssentialsPreset from './essentials';

import Paragraph from '@ckeditor/ckeditor5-paragraph/src/paragraph';
import BlockQuote from '@ckeditor/ckeditor5-block-quote/src/blockquote';
import Bold from '@ckeditor/ckeditor5-basic-styles/src/bold';
import Heading from '@ckeditor/ckeditor5-heading/src/heading';
import Image from '@ckeditor/ckeditor5-image/src/image';
Expand All @@ -21,6 +21,7 @@ import ImageToolbar from '@ckeditor/ckeditor5-image/src/imagetoolbar';
import Italic from '@ckeditor/ckeditor5-basic-styles/src/italic';
import Link from '@ckeditor/ckeditor5-link/src/link';
import List from '@ckeditor/ckeditor5-list/src/list';
import Paragraph from '@ckeditor/ckeditor5-paragraph/src/paragraph';

/**
* Article editor preset. Represents a set of features which enable in the editor
Expand All @@ -31,6 +32,19 @@ import List from '@ckeditor/ckeditor5-list/src/list';
*/
export default class Article extends Plugin {
static get requires() {
return [ EssentialsPreset, Paragraph, Bold, Heading, Image, ImageCaption, ImageStyle, ImageToolbar, Italic, Link, List ];
return [
EssentialsPreset,
BlockQuote,
Bold,
Heading,
Image,
ImageCaption,
ImageStyle,
ImageToolbar,
Italic,
Link,
List,
Paragraph
];
}
}
12 changes: 10 additions & 2 deletions tests/article.js
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,11 @@ describe( 'Article preset', () => {
'<figure class="image image-style-side">' +
'<img alt="bar" src="foo">' +
'<figcaption>Caption</figcaption>' +
'</figure>';
'</figure>' +
'<blockquote>' +
'<p>Quote</p>' +
'<ul><li>Quoted UL List item 1</li></ul>' +
'</blockquote>';

// Can't use data twice due to https://github.com/ckeditor/ckeditor5-utils/issues/128.
const expectedOutput =
Expand All @@ -96,7 +100,11 @@ describe( 'Article preset', () => {
'<figure class="image image-style-side">' +
'<img alt="bar" src="foo"></img>' +
'<figcaption>Caption</figcaption>' +
'</figure>';
'</figure>' +
'<blockquote>' +
'<p>Quote</p>' +
'<ul><li>Quoted UL List item 1</li></ul>' +
'</blockquote>';

editor.setData( data );

Expand Down
8 changes: 8 additions & 0 deletions tests/manual/article.html
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,12 @@ <h2>Heading 1</h2>
<img alt="bar" src="sample.jpg">
<figcaption>Caption</figcaption>
</figure>
<blockquote>
<p>Quote</p>
<ul>
<li>Quoted UL List item 1</li>
<li>Quoted UL List item 2</li>
</ul>
<p>Quote</p>
</blockquote>
</div>
2 changes: 1 addition & 1 deletion tests/manual/article.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import ArticlePreset from '../../src/article';

ClassicEditor.create( document.querySelector( '#editor' ), {
plugins: [ ArticlePreset ],
toolbar: [ 'headings', 'bold', 'italic', 'link', 'unlink', 'bulletedList', 'numberedList', 'undo', 'redo' ]
toolbar: [ 'headings', 'bold', 'italic', 'link', 'unlink', 'blockQuote', 'bulletedList', 'numberedList', 'undo', 'redo' ]
} )
.then( editor => {
window.editor = editor;
Expand Down

0 comments on commit 30d7bd5

Please sign in to comment.