8
0
Просмотр исходного кода

Added manual test and completed the list of p-like elements.

Piotrek Koszuliński 9 лет назад
Родитель
Сommit
6381828dcd

+ 15 - 1
packages/ckeditor5-paragraph/src/paragraph.js

@@ -99,7 +99,21 @@ export default class Paragraph extends Plugin {
  *
  * @member {Set.<String>} module:paragraph/paragraph~Paragraph.paragraphLikeElements
  */
-Paragraph.paragraphLikeElements = new Set( [ 'p', 'h1', 'h2', 'h3', 'h4', 'h5', 'h6', 'td', 'li', 'div', 'dt', 'dd' ] );
+Paragraph.paragraphLikeElements = new Set( [
+	'p',
+	'h1',
+	'h2',
+	'h3',
+	'h4',
+	'h5',
+	'h6',
+	'td',
+	'li',
+	'div',
+	'dt',
+	'dd',
+	'blockquote'
+] );
 
 const paragraphsToMerge = new WeakSet();
 

+ 64 - 0
packages/ckeditor5-paragraph/tests/manual/clipboard-integration.html

@@ -0,0 +1,64 @@
+<head>
+	<link rel="stylesheet" href="/theme/ckeditor.css">
+	<style>
+		#copybin p,
+		#copybin h1,
+		#copybin h2,
+		#copybin h3,
+		#copybin h4,
+		#copybin h5,
+		#copybin h6,
+		#copybin td,
+		#copybin li,
+		#copybin div,
+		#copybin dt,
+		#copybin dd
+		{
+			border: solid 1px blue;
+			padding: 3px;
+		}
+	</style>
+</head>
+
+<div id="editor">
+	<p>Paste here</p>
+</div>
+
+<h2>Copy from here</h2>
+
+<div id=copybin>
+	<h1>Heading 1</h1>
+	<h2><a href="x">Heading</a> 2</h2>
+	<h3><em>Heading</em> 3</h3>
+	<h4>Heading 4</h4>
+	<h5><em>Heading</em> 5</h5>
+	<h6>Heading 6</h6>
+
+	<ul>
+		<li>List item 1</li>
+		<li>List item 2</li>
+		<li>List item 3</li>
+		<li>
+			List item 4
+			<ol>
+				<li>List item 4.1</li>
+				<li>
+					<h1>Bar</h1>
+					<div>Foo</div>
+					<ul>
+						<li>Bom!</li>
+					</ul>
+				</li>
+			</ol>
+		</li>
+	</ul>
+
+	<div>
+		<div>Foo</div>
+		<table>
+			<caption>Foo!</caption>
+			<tr><td><strong>1.1</strong></td><td>1.2</td></tr>
+			<tr><td>2.1</td><td>2.2</td></tr>
+		</table>
+	</div>
+</div>

+ 36 - 0
packages/ckeditor5-paragraph/tests/manual/clipboard-integration.js

@@ -0,0 +1,36 @@
+/**
+ * @license Copyright (c) 2003-2016, CKSource - Frederico Knabben. All rights reserved.
+ * For licensing, see LICENSE.md.
+ */
+
+/* globals console, window, document */
+
+import ClassicEditor from 'ckeditor5/editor-classic/classic.js';
+import Typing from 'ckeditor5/typing/typing.js';
+import Paragraph from 'ckeditor5/paragraph/paragraph.js';
+import Undo from 'ckeditor5/undo/undo.js';
+import Enter from 'ckeditor5/enter/enter.js';
+import Clipboard from 'ckeditor5/clipboard/clipboard.js';
+import Link from 'ckeditor5/link/link.js';
+import Bold from 'ckeditor5/basic-styles/bold.js';
+import Italic from 'ckeditor5/basic-styles/italic.js';
+
+ClassicEditor.create( document.querySelector( '#editor' ), {
+	plugins: [
+		Typing,
+		Paragraph,
+		Undo,
+		Enter,
+		Clipboard,
+		Link,
+		Bold,
+		Italic
+	],
+	toolbar: [ 'bold', 'italic', 'link', 'undo', 'redo' ]
+} )
+.then( editor => {
+	window.editor = editor;
+} )
+.catch( err => {
+	console.error( err.stack );
+} );

+ 7 - 0
packages/ckeditor5-paragraph/tests/manual/clipboard-integration.md

@@ -0,0 +1,7 @@
+## Paragraph – clipboard integration
+
+Check how the paragraph feature handles converting paragraph-like blocks which don't have their own converters.
+
+Such blocks can be copied from the second part of this test. Each of them is marked with blue border.
+
+You can also paste the content of [this article](https://medium.com/content-uneditable/contenteditable-the-good-the-bad-and-the-ugly-261a38555e9c#.k6kcioz51).