Explorar el Código

Feature: Added block quote feature to the article preset. Closes #4.

Piotrek Koszuliński hace 8 años
padre
commit
a9a5e31370

+ 16 - 2
packages/ckeditor5-essentials/src/article.js

@@ -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';
@@ -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
@@ -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
+		];
 	}
 }

+ 10 - 2
packages/ckeditor5-essentials/tests/article.js

@@ -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 =
@@ -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 );
 

+ 8 - 0
packages/ckeditor5-essentials/tests/manual/article.html

@@ -14,4 +14,12 @@
 		<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>

+ 1 - 1
packages/ckeditor5-essentials/tests/manual/article.js

@@ -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;