Explorar el Código

Added manual tests.

Piotrek Koszuliński hace 8 años
padre
commit
86789d869d

+ 1 - 5
packages/ckeditor5-clipboard/package.json

@@ -13,12 +13,8 @@
     "@ckeditor/ckeditor5-block-quote": "^0.1.1",
     "@ckeditor/ckeditor5-editor-classic": "^0.7.3",
     "@ckeditor/ckeditor5-paragraph": "^0.8.0",
-    "@ckeditor/ckeditor5-enter": "^0.9.1",
-    "@ckeditor/ckeditor5-heading": "^0.9.1",
+    "@ckeditor/ckeditor5-presets": "^0.2.2",
     "@ckeditor/ckeditor5-link": "^0.7.0",
-    "@ckeditor/ckeditor5-list": "^0.6.1",
-    "@ckeditor/ckeditor5-typing": "^0.9.1",
-    "@ckeditor/ckeditor5-undo": "^0.8.1",
     "eslint-config-ckeditor5": "^1.0.0",
     "gulp": "^3.9.1",
     "guppy-pre-commit": "^0.4.0"

+ 2 - 22
packages/ckeditor5-clipboard/tests/manual/copycut.js

@@ -6,32 +6,12 @@
 /* globals console, window, document */
 
 import ClassicEditor from '@ckeditor/ckeditor5-editor-classic/src/classiceditor';
-import Typing from '@ckeditor/ckeditor5-typing/src/typing';
-import Paragraph from '@ckeditor/ckeditor5-paragraph/src/paragraph';
-import Undo from '@ckeditor/ckeditor5-undo/src/undo';
-import Enter from '@ckeditor/ckeditor5-enter/src/enter';
-import Clipboard from '../../src/clipboard';
-import Link from '@ckeditor/ckeditor5-link/src/link';
-import List from '@ckeditor/ckeditor5-list/src/list';
-import Heading from '@ckeditor/ckeditor5-heading/src/heading';
-import Bold from '@ckeditor/ckeditor5-basic-styles/src/bold';
-import Italic from '@ckeditor/ckeditor5-basic-styles/src/italic';
+import ArticlePreset from '@ckeditor/ckeditor5-presets/src/article';
 
 import { stringify as stringifyView } from '@ckeditor/ckeditor5-engine/src/dev-utils/view';
 
 ClassicEditor.create( document.querySelector( '#editor' ), {
-	plugins: [
-		Typing,
-		Paragraph,
-		Undo,
-		Enter,
-		Clipboard,
-		Link,
-		List,
-		Heading,
-		Bold,
-		Italic
-	],
+	plugins: [ ArticlePreset ],
 	toolbar: [ 'headings', 'bold', 'italic', 'link', 'bulletedList', 'numberedList', 'undo', 'redo' ]
 } )
 .then( editor => {

+ 39 - 0
packages/ckeditor5-clipboard/tests/manual/dropping.html

@@ -0,0 +1,39 @@
+<div id="editor">
+	<h2>About CKEditor&nbsp;5, v0.3.0</h2>
+
+	<p>This is the <a href="http://ckeditor.com/blog/Third-Developer-Preview-of-CKEditor-5-Available">third developer preview</a> of <a href="https://ckeditor5.github.io">CKEditor&nbsp;5</a>.</p>
+
+	<p>After 2 years of work, building the next generation editor from scratch and closing over 670 tickets, we created a highly <strong>extensible and flexible architecture</strong> which consists of an <strong>amazing editing framework</strong> and <strong>editing solutions</strong> that will be built on top of it.</p>
+
+	<h3>Notes</h3>
+
+	<p><a href="https://ckeditor5.github.io">CKEditor&nbsp;5</a> is <i>under heavy development</i> and this demo is not production-ready software. For example:</p>
+
+	<ul>
+		<li><strong>only Chrome, Opera and Safari are supported</strong>,</li>
+		<li>Firefox requires enabling the <a href="https://developer.mozilla.org/en-US/docs/Web/API/Document/onselectionchange">&ldquo;dom.select_events.enabled&rdquo;</a> option,</li>
+		<li><a href="https://github.com/ckeditor/ckeditor5/issues/342">support for pasting</a> is under development.</li>
+	</ul>
+
+	<p>It has <em>bugs</em> that we are aware of – and that we will be working on in the next few iterations of the project. Stay tuned for some updates soon!</p>
+</div>
+
+<h2 style="margin-top: 100px">Some rich content to copy</h2>
+
+<p>Copy also this content to check how pasting from outside of the editor works. Feel free to also use content from other websites.</p>
+
+<p>This is the <a href="http://ckeditor.com/blog/Third-Developer-Preview-of-CKEditor-5-Available">third developer preview</a> of <strong>CKEditor&nbsp;5</strong>.</p>
+
+<p>After 2 years of work, building the next generation editor from scratch and closing over 670 tickets, we created a highly <strong>extensible and flexible architecture</strong> which consists of an <strong>amazing editing framework</strong> and <strong>editing solutions</strong> that will be built on top of it.</p>
+
+<h3>Notes</h3>
+
+<p><a href="https://ckeditor5.github.io">CKEditor&nbsp;5</a> is <i>under heavy development</i> and this demo is not production-ready software. For example:</p>
+
+<ul>
+	<li><strong>only Chrome, Opera and Safari are supported</strong>,</li>
+	<li>Firefox requires enabling the <a href="https://developer.mozilla.org/en-US/docs/Web/API/Document/onselectionchange">&ldquo;dom.select_events.enabled&rdquo;</a> option,</li>
+	<li><a href="https://github.com/ckeditor/ckeditor5/issues/342">support for pasting</a> is under development.</li>
+</ul>
+
+<p>It has <em>bugs</em> that we are aware of – and that we will be working on in the next few iterations of the project. Stay tuned for some updates soon!</p>

+ 50 - 0
packages/ckeditor5-clipboard/tests/manual/dropping.js

@@ -0,0 +1,50 @@
+/**
+ * @license Copyright (c) 2003-2017, CKSource - Frederico Knabben. All rights reserved.
+ * For licensing, see LICENSE.md.
+ */
+
+/* globals console, window, document */
+
+import ClassicEditor from '@ckeditor/ckeditor5-editor-classic/src/classiceditor';
+import ArticlePreset from '@ckeditor/ckeditor5-presets/src/article';
+
+import Text from '@ckeditor/ckeditor5-engine/src/model/text';
+import Selection from '@ckeditor/ckeditor5-engine/src/model/selection';
+
+// import { stringify as stringifyView } from '@ckeditor/ckeditor5-engine/src/dev-utils/view';
+
+ClassicEditor.create( document.querySelector( '#editor' ), {
+	plugins: [ ArticlePreset ],
+	toolbar: [ 'headings', 'bold', 'italic', 'link', 'bulletedList', 'numberedList', 'undo', 'redo' ]
+} )
+.then( editor => {
+	window.editor = editor;
+	// const clipboard = editor.plugins.get( 'Clipboard' );
+
+	editor.editing.view.on( 'drop', ( evt, data ) => {
+		console.clear();
+
+		console.log( '----- drop -----' );
+		console.log( data );
+		console.log( 'text/html\n', data.dataTransfer.getData( 'text/html' ) );
+		console.log( 'text/plain\n', data.dataTransfer.getData( 'text/plain' ) );
+
+		data.preventDefault();
+		evt.stop();
+
+		editor.document.enqueueChanges( () => {
+			const insertAtSelection = new Selection( [ editor.editing.mapper.toModelRange( data.dropRange ) ] );
+			editor.data.insertContent( new Text( '@' ), insertAtSelection );
+			editor.document.selection.setTo( insertAtSelection );
+		} );
+	} );
+
+	// Waiting until a real dropping support...
+	// clipboard.on( 'inputTransformation', ( evt, data ) => {
+	// 	console.log( '----- clipboardInput -----' );
+	// 	console.log( 'stringify( data.dataTransfer )\n', stringifyView( data.content ) );
+	// } );
+} )
+.catch( err => {
+	console.error( err.stack );
+} );

+ 11 - 0
packages/ckeditor5-clipboard/tests/manual/dropping.md

@@ -0,0 +1,11 @@
+## Dropping
+
+**Note:** There's no real drag&drop support yet. This test is only supposed to check if the drop position is calculated correctly.
+
+Expected: At the precise drop position (where you see the caret before releasing the mouse button) a "@" should be inserted.
+
+Notes:
+
+* It may all not work in Edge (because it's focused on file support now).
+* Drop position is not the same as selection before drop (which is not that aprarent if you drop something from outside but it's obvious if you d&d content within the editor).
+* It's a known bug that after dropping content from outside the editor there's no focus in the editor.

+ 2 - 22
packages/ckeditor5-clipboard/tests/manual/pasting.js

@@ -6,32 +6,12 @@
 /* globals console, window, document */
 
 import ClassicEditor from '@ckeditor/ckeditor5-editor-classic/src/classiceditor';
-import Typing from '@ckeditor/ckeditor5-typing/src/typing';
-import Paragraph from '@ckeditor/ckeditor5-paragraph/src/paragraph';
-import Undo from '@ckeditor/ckeditor5-undo/src/undo';
-import Enter from '@ckeditor/ckeditor5-enter/src/enter';
-import Clipboard from '../../src/clipboard';
-import Link from '@ckeditor/ckeditor5-link/src/link';
-import List from '@ckeditor/ckeditor5-list/src/list';
-import Heading from '@ckeditor/ckeditor5-heading/src/heading';
-import Bold from '@ckeditor/ckeditor5-basic-styles/src/bold';
-import Italic from '@ckeditor/ckeditor5-basic-styles/src/italic';
+import ArticlePreset from '@ckeditor/ckeditor5-presets/src/article';
 
 import { stringify as stringifyView } from '@ckeditor/ckeditor5-engine/src/dev-utils/view';
 
 ClassicEditor.create( document.querySelector( '#editor' ), {
-	plugins: [
-		Typing,
-		Paragraph,
-		Undo,
-		Enter,
-		Clipboard,
-		Link,
-		List,
-		Heading,
-		Bold,
-		Italic
-	],
+	plugins: [ ArticlePreset ],
 	toolbar: [ 'headings', 'bold', 'italic', 'link', 'bulletedList', 'numberedList', 'undo', 'redo' ]
 } )
 .then( editor => {