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

Merge branch 'master' into t/ckeditor5-engine/660

Aleksander Nowodzinski 8 лет назад
Родитель
Сommit
2a611924b3
29 измененных файлов с 333 добавлено и 235 удалено
  1. 2 1
      packages/ckeditor5-typing/README.md
  2. 1 1
      packages/ckeditor5-typing/package.json
  3. 2 2
      packages/ckeditor5-typing/src/changebuffer.js
  4. 8 1
      packages/ckeditor5-typing/src/deletecommand.js
  5. 8 8
      packages/ckeditor5-typing/src/input.js
  6. 5 5
      packages/ckeditor5-typing/src/inputcommand.js
  7. 1 1
      packages/ckeditor5-typing/src/typing.js
  8. 9 8
      packages/ckeditor5-typing/tests/bogusbr-integration.js
  9. 2 1
      packages/ckeditor5-typing/tests/delete.js
  10. 56 17
      packages/ckeditor5-typing/tests/deletecommand-integration.js
  11. 28 0
      packages/ckeditor5-typing/tests/deletecommand.js
  12. 5 2
      packages/ckeditor5-typing/tests/input.js
  13. 13 12
      packages/ckeditor5-typing/tests/inputcommand-integration.js
  14. 7 6
      packages/ckeditor5-typing/tests/inputcommand.js
  15. 11 10
      packages/ckeditor5-typing/tests/manual/20/1.js
  16. 11 10
      packages/ckeditor5-typing/tests/manual/21/1.js
  17. 11 10
      packages/ckeditor5-typing/tests/manual/40/1.js
  18. 11 10
      packages/ckeditor5-typing/tests/manual/52/1.js
  19. 11 10
      packages/ckeditor5-typing/tests/manual/59/1.js
  20. 11 10
      packages/ckeditor5-typing/tests/manual/82/1.js
  21. 11 10
      packages/ckeditor5-typing/tests/manual/86/1.js
  22. 11 10
      packages/ckeditor5-typing/tests/manual/delete.js
  23. 11 10
      packages/ckeditor5-typing/tests/manual/input.js
  24. 30 29
      packages/ckeditor5-typing/tests/manual/nbsp.js
  25. 21 19
      packages/ckeditor5-typing/tests/manual/rtl.js
  26. 11 10
      packages/ckeditor5-typing/tests/manual/selection.js
  27. 11 10
      packages/ckeditor5-typing/tests/manual/unicode.js
  28. 7 6
      packages/ckeditor5-typing/tests/spellchecking.js
  29. 7 6
      packages/ckeditor5-typing/tests/tickets/59.js

+ 2 - 1
packages/ckeditor5-typing/README.md

@@ -1,6 +1,7 @@
-CKEditor 5 Typing Feature
+CKEditor 5 typing feature
 ========================================
 
+[![Join the chat at https://gitter.im/ckeditor/ckeditor5](https://badges.gitter.im/ckeditor/ckeditor5.svg)](https://gitter.im/ckeditor/ckeditor5?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
 [![npm version](https://badge.fury.io/js/%40ckeditor%2Fckeditor5-typing.svg)](https://www.npmjs.com/package/@ckeditor/ckeditor5-typing)
 [![Build Status](https://travis-ci.org/ckeditor/ckeditor5-typing.svg?branch=master)](https://travis-ci.org/ckeditor/ckeditor5-typing)
 [![Test Coverage](https://codeclimate.com/github/ckeditor/ckeditor5-typing/badges/coverage.svg)](https://codeclimate.com/github/ckeditor/ckeditor5-typing/coverage)

+ 1 - 1
packages/ckeditor5-typing/package.json

@@ -18,7 +18,7 @@
     "@ckeditor/ckeditor5-paragraph": "^0.8.0",
     "@ckeditor/ckeditor5-undo": "^0.8.1",
     "@ckeditor/ckeditor5-presets": "^0.2.2",
-    "eslint-config-ckeditor5": "^1.0.0",
+    "eslint-config-ckeditor5": "^1.0.5",
     "gulp": "^3.9.1",
     "guppy-pre-commit": "^0.4.0"
   },

+ 2 - 2
packages/ckeditor5-typing/src/changebuffer.js

@@ -61,7 +61,7 @@ export default class ChangeBuffer {
 		this.limit = limit;
 
 		/**
-		 * Whether the buffer is locked. The locked buffer cannot be reset unless it gets unlocked.
+		 * Whether the buffer is locked. A locked buffer cannot be reset unless it gets unlocked.
 		 *
 		 * @readonly
 		 * @member {Boolean} #isLocked
@@ -97,7 +97,7 @@ export default class ChangeBuffer {
 		 */
 
 		/**
-		 * The callback to document selection change:attribute and change:range events which resets the buffer.
+		 * The callback to document selection `change:attribute` and `change:range` events which resets the buffer.
 		 *
 		 * @private
 		 * @member #_selectionChangeCallback

+ 8 - 1
packages/ckeditor5-typing/src/deletecommand.js

@@ -66,6 +66,13 @@ export default class DeleteCommand extends Command {
 
 			const selection = Selection.createFromSelection( doc.selection );
 
+			// Do not replace the whole selected content if selection was collapsed.
+			// This prevents such situation:
+			//
+			// <h1></h1><p>[]</p>	-->  <h1>[</h1><p>]</p> 		-->  <p></p>
+			// starting content		-->   after `modifySelection`	-->  after `deleteContent`.
+			const doNotResetEntireContent = selection.isCollapsed;
+
 			// Try to extend the selection in the specified direction.
 			if ( selection.isCollapsed ) {
 				dataController.modifySelection( selection, { direction: this.direction, unit: options.unit } );
@@ -84,7 +91,7 @@ export default class DeleteCommand extends Command {
 				);
 			} );
 
-			dataController.deleteContent( selection, this._buffer.batch );
+			dataController.deleteContent( selection, this._buffer.batch, { doNotResetEntireContent } );
 			this._buffer.input( changeCount );
 
 			doc.selection.setRanges( selection.getRanges(), selection.isBackward );

+ 8 - 8
packages/ckeditor5-typing/src/input.js

@@ -156,15 +156,15 @@ class MutationHandler {
 
 	/**
 	 * Handles situations when container's children mutated during input. This can happen when
-	 * browser is trying to "fix" DOM in certain situations. For example, when user starts to type
-	 * in `<p><a href=""><i>Link{}</i></a></p>` browser might change order of elements
-	 * to `<p><i><a href="">Link</a>x{}</i></p>`. Similar situation happens when spell checker
-	 * replaces a word wrapped with `<strong>` to a word wrapped with `<b>` element.
+	 * the browser is trying to "fix" DOM in certain situations. For example, when the user starts to type
+	 * in `<p><a href=""><i>Link{}</i></a></p>`, the browser might change the order of elements
+	 * to `<p><i><a href="">Link</a>x{}</i></p>`. A similar situation happens when the spell checker
+	 * replaces a word wrapped with `<strong>` with a word wrapped with a `<b>` element.
 	 *
-	 * To handle such situations, DOM common ancestor of all mutations is converted to the model representation
-	 * and then compared with current model to calculate proper text change.
+	 * To handle such situations, the common DOM ancestor of all mutations is converted to the model representation
+	 * and then compared with the current model to calculate the proper text change.
 	 *
-	 * NOTE: Single text node insertion is handled in {@link #_handleTextNodeInsertion} and text node mutation is handled
+	 * Note: Single text node insertion is handled in {@link #_handleTextNodeInsertion} and text node mutation is handled
 	 * in {@link #_handleTextMutation}).
 	 *
 	 * @private
@@ -311,7 +311,7 @@ const safeKeycodes = [
 	getCode( 'arrowRight' ),
 	getCode( 'arrowDown' ),
 	getCode( 'arrowLeft' ),
-	9,  // Tab
+	9, // Tab
 	16, // Shift
 	17, // Ctrl
 	18, // Alt

+ 5 - 5
packages/ckeditor5-typing/src/inputcommand.js

@@ -56,15 +56,15 @@ export default class InputCommand extends Command {
 
 	/**
 	 * Executes the input command. It replaces the content within the given range with the given text.
-	 * Replacing is a two step process, first content within the range is removed and then new text is inserted
-	 * on the beginning of the range (which after removal is a collapsed range).
+	 * Replacing is a two step process, first the content within the range is removed and then the new text is inserted
+	 * at the beginning of the range (which after the removal is a collapsed range).
 	 *
 	 * @fires execute
 	 * @param {Object} [options] The command options.
-	 * @param {String} [options.text=''] Text to be inserted.
-	 * @param {module:engine/model/range~Range} [options.range] Range in which the text is inserted. Defaults
+	 * @param {String} [options.text=''] The text to be inserted.
+	 * @param {module:engine/model/range~Range} [options.range] The range in which the text is inserted. Defaults
 	 * to the first range in the current selection.
-	 * @param {module:engine/model/range~Range} [options.resultRange] Range at which the selection
+	 * @param {module:engine/model/range~Range} [options.resultRange] The range where the selection
 	 * should be placed after the insertion. If not specified, the selection will be placed right after
 	 * the inserted text.
 	 */

+ 1 - 1
packages/ckeditor5-typing/src/typing.js

@@ -12,7 +12,7 @@ import Input from './input';
 import Delete from './delete';
 
 /**
- * The typing feature. Handles typing.
+ * The typing feature. It handles typing.
  *
  * @extends module:core/plugin~Plugin
  */

+ 9 - 8
packages/ckeditor5-typing/tests/bogusbr-integration.js

@@ -22,14 +22,15 @@ describe( 'Bogus BR integration', () => {
 		editorElement = document.createElement( 'div' );
 		document.body.appendChild( editorElement );
 
-		return ClassicTestEditor.create( editorElement, {
-			plugins: [ Typing, Paragraph, Bold ]
-		} )
-		.then( newEditor => {
-			editor = newEditor;
-			domRoot = editor.editing.view.getDomRoot();
-			mutationObserver = editor.editing.view.getObserver( MutationObserver );
-		} );
+		return ClassicTestEditor
+			.create( editorElement, {
+				plugins: [ Typing, Paragraph, Bold ]
+			} )
+			.then( newEditor => {
+				editor = newEditor;
+				domRoot = editor.editing.view.getDomRoot();
+				mutationObserver = editor.editing.view.getObserver( MutationObserver );
+			} );
 	} );
 
 	afterEach( () => {

+ 2 - 1
packages/ckeditor5-typing/tests/delete.js

@@ -11,7 +11,8 @@ describe( 'Delete feature', () => {
 	let editor, editingView;
 
 	beforeEach( () => {
-		return VirtualTestEditor.create( { plugins: [ Delete ] } )
+		return VirtualTestEditor
+			.create( { plugins: [ Delete ] } )
 			.then( newEditor => {
 				editor = newEditor;
 				editingView = editor.editing.view;

+ 56 - 17
packages/ckeditor5-typing/tests/deletecommand-integration.js

@@ -12,7 +12,13 @@ describe( 'DeleteCommand integration', () => {
 	let editor, doc;
 
 	beforeEach( () => {
-		return ModelTestEditor.create( { plugins: [ UndoEngine ], typing: { undoStep: 3 } } )
+		return ModelTestEditor
+			.create( {
+				plugins: [ UndoEngine ],
+				typing: {
+					undoStep: 3
+				}
+			} )
 			.then( newEditor => {
 				editor = newEditor;
 				doc = editor.document;
@@ -20,7 +26,10 @@ describe( 'DeleteCommand integration', () => {
 				const command = new DeleteCommand( editor, 'backward' );
 				editor.commands.add( 'delete', command );
 
-				doc.schema.registerItem( 'p', '$block' );
+				// Mock paragraph feature.
+				doc.schema.registerItem( 'paragraph', '$block' );
+				doc.schema.allow( { name: 'paragraph', inside: '$block' } );
+
 				doc.schema.registerItem( 'img', '$inline' );
 				doc.schema.allow( { name: '$text', inside: 'img' } );
 
@@ -36,9 +45,9 @@ describe( 'DeleteCommand integration', () => {
 		expect( getData( doc ) ).to.equal( output );
 	}
 
-	describe( 'DeleteCommand integration', () => {
+	describe( 'with undo', () => {
 		it( 'deletes characters (and group changes in batches) and rollbacks', () => {
-			setData( doc, '<p>123456789[]</p>' );
+			setData( doc, '<paragraph>123456789[]</paragraph>' );
 
 			for ( let i = 0; i < 3; ++i ) {
 				editor.execute( 'delete' );
@@ -46,11 +55,11 @@ describe( 'DeleteCommand integration', () => {
 
 			editor.execute( 'undo' );
 
-			assertOutput( '<p>123456789[]</p>' );
+			assertOutput( '<paragraph>123456789[]</paragraph>' );
 		} );
 
 		it( 'deletes characters (and group changes in batches) and rollbacks - test step', () => {
-			setData( doc, '<p>123456789[]</p>' );
+			setData( doc, '<paragraph>123456789[]</paragraph>' );
 
 			for ( let i = 0; i < 6; ++i ) {
 				editor.execute( 'delete' );
@@ -58,15 +67,15 @@ describe( 'DeleteCommand integration', () => {
 
 			editor.execute( 'undo' );
 
-			assertOutput( '<p>123456[]</p>' );
+			assertOutput( '<paragraph>123456[]</paragraph>' );
 
 			editor.execute( 'undo' );
 
-			assertOutput( '<p>123456789[]</p>' );
+			assertOutput( '<paragraph>123456789[]</paragraph>' );
 		} );
 
 		it( 'deletes elements (and group changes in batches) and rollbacks', () => {
-			setData( doc, '<p><img>1</img><img>2</img><img>3</img><img>4</img><img>5</img><img>6</img>[]</p>' );
+			setData( doc, '<paragraph><img>1</img><img>2</img><img>3</img><img>4</img><img>5</img><img>6</img>[]</paragraph>' );
 
 			for ( let i = 0; i < 3; ++i ) {
 				editor.execute( 'delete' );
@@ -74,11 +83,11 @@ describe( 'DeleteCommand integration', () => {
 
 			editor.execute( 'undo' );
 
-			assertOutput( '<p><img>1</img><img>2</img><img>3</img><img>4</img><img>5</img><img>6</img>[]</p>' );
+			assertOutput( '<paragraph><img>1</img><img>2</img><img>3</img><img>4</img><img>5</img><img>6</img>[]</paragraph>' );
 		} );
 
 		it( 'merges elements (and group changes in batches) and rollbacks', () => {
-			setData( doc, '<p>123456</p><p>[]78</p>' );
+			setData( doc, '<paragraph>123456</paragraph><paragraph>[]78</paragraph>' );
 
 			for ( let i = 0; i < 6; ++i ) {
 				editor.execute( 'delete' );
@@ -86,19 +95,19 @@ describe( 'DeleteCommand integration', () => {
 
 			editor.execute( 'undo' );
 
-			// Deleted 6,5,4, <P> does not count.
+			// Deleted 6,5,4, <paragraph> does not count.
 			// It's not the most elegant solution, but is the best if we don't want to make complicated algorithm.
-			assertOutput( '<p>123[]78</p>' );
+			assertOutput( '<paragraph>123[]78</paragraph>' );
 
 			editor.execute( 'undo' );
 
 			// Selection restoing in undo is not 100% correct so slight miss-settings are expected as long as
 			// the selection makes any sense and is near the correct position.
-			assertOutput( '<p>123456</p><p>78[]</p>' );
+			assertOutput( '<paragraph>123456</paragraph><paragraph>78[]</paragraph>' );
 		} );
 
 		it( 'merges elements (and group changes in batches) and rollbacks - non-collapsed selection', () => {
-			setData( doc, '<p>12345[6</p><p>7]8</p>' );
+			setData( doc, '<paragraph>12345[6</paragraph><paragraph>7]8</paragraph>' );
 
 			editor.execute( 'delete' );
 			editor.execute( 'delete' );
@@ -106,11 +115,41 @@ describe( 'DeleteCommand integration', () => {
 
 			editor.execute( 'undo' );
 
-			assertOutput( '<p>1234[]8</p>' );
+			assertOutput( '<paragraph>1234[]8</paragraph>' );
 
 			editor.execute( 'undo' );
 
-			assertOutput( '<p>12345[6</p><p>7]8</p>' );
+			assertOutput( '<paragraph>12345[6</paragraph><paragraph>7]8</paragraph>' );
+		} );
+	} );
+
+	describe( 'with DataController.deleteContent', () => {
+		beforeEach( () => {
+			doc.schema.registerItem( 'h1', '$block' );
+		} );
+
+		it( 'should replace content with paragraph - if whole content is selected', () => {
+			setData( doc, '<h1>[foo</h1><paragraph>bar]</paragraph>' );
+
+			editor.execute( 'delete' );
+
+			assertOutput( '<paragraph>[]</paragraph>' );
+		} );
+
+		it( 'should not replace content with paragraph - if not whole content is selected', () => {
+			setData( doc, '<h1>f[oo</h1><paragraph>bar]</paragraph>' );
+
+			editor.execute( 'delete' );
+
+			assertOutput( '<h1>f[]</h1>' );
+		} );
+
+		it( 'should not replace content with paragraph - if selection was collapsed', () => {
+			setData( doc, '<h1></h1><paragraph>[]</paragraph>' );
+
+			editor.execute( 'delete' );
+
+			assertOutput( '<h1>[]</h1>' );
 		} );
 	} );
 } );

+ 28 - 0
packages/ckeditor5-typing/tests/deletecommand.js

@@ -112,5 +112,33 @@ describe( 'DeleteCommand', () => {
 			expect( modifyOpts ).to.have.property( 'direction', 'forward' );
 			expect( modifyOpts ).to.have.property( 'unit', 'word' );
 		} );
+
+		it( 'passes options to deleteContent #1', () => {
+			const spy = sinon.spy();
+
+			editor.data.on( 'deleteContent', spy );
+			setData( doc, '<p>foo[]bar</p>' );
+
+			editor.execute( 'delete' );
+
+			expect( spy.callCount ).to.equal( 1 );
+
+			const deleteOpts = spy.args[ 0 ][ 1 ][ 2 ];
+			expect( deleteOpts ).to.have.property( 'doNotResetEntireContent', true );
+		} );
+
+		it( 'passes options to deleteContent #2', () => {
+			const spy = sinon.spy();
+
+			editor.data.on( 'deleteContent', spy );
+			setData( doc, '<p>[foobar]</p>' );
+
+			editor.execute( 'delete' );
+
+			expect( spy.callCount ).to.equal( 1 );
+
+			const deleteOpts = spy.args[ 0 ][ 1 ][ 2 ];
+			expect( deleteOpts ).to.have.property( 'doNotResetEntireContent', false );
+		} );
 	} );
 } );

+ 5 - 2
packages/ckeditor5-typing/tests/input.js

@@ -39,7 +39,10 @@ describe( 'Input feature', () => {
 	before( () => {
 		listenter = Object.create( EmitterMixin );
 
-		return VirtualTestEditor.create( { plugins: [ Input, Paragraph ] } )
+		return VirtualTestEditor
+			.create( {
+				plugins: [ Input, Paragraph ]
+			} )
 			.then( newEditor => {
 				// Mock image feature.
 				newEditor.document.schema.registerItem( 'image', '$inline' );
@@ -428,7 +431,7 @@ describe( 'Input feature', () => {
 					ModelRange.createFromParentsAndOffsets( modelRoot.getChild( 0 ), 2, modelRoot.getChild( 0 ), 4 ) ] );
 			} );
 
-			view.fire( 'keydown', { keyCode: getCode( 'arrowright' ) } );
+			view.fire( 'keydown', { keyCode: getCode( 'arrowdown' ) } );
 
 			expect( getModelData( model ) ).to.equal( '<paragraph>fo[ob]ar</paragraph>' );
 		} );

+ 13 - 12
packages/ckeditor5-typing/tests/inputcommand-integration.js

@@ -27,18 +27,19 @@ describe( 'InputCommand integration', () => {
 		editorElement = document.createElement( 'div' );
 		document.body.appendChild( editorElement );
 
-		return ClassicTestEditor.create( editorElement, {
-			plugins: [ Typing, Paragraph, Undo, Bold, Italic, Enter ],
-			typing: { undoStep: 3 }
-		} )
-		.then( newEditor => {
-			editor = newEditor;
-			doc = editor.document;
-			viewDocument = editor.editing.view;
-
-			boldView = editor.ui.componentFactory.create( 'bold' );
-			italicView = editor.ui.componentFactory.create( 'italic' );
-		} );
+		return ClassicTestEditor
+			.create( editorElement, {
+				plugins: [ Typing, Paragraph, Undo, Bold, Italic, Enter ],
+				typing: { undoStep: 3 }
+			} )
+			.then( newEditor => {
+				editor = newEditor;
+				doc = editor.document;
+				viewDocument = editor.editing.view;
+
+				boldView = editor.ui.componentFactory.create( 'bold' );
+				italicView = editor.ui.componentFactory.create( 'italic' );
+			} );
 	} );
 
 	afterEach( () => {

+ 7 - 6
packages/ckeditor5-typing/tests/inputcommand.js

@@ -52,12 +52,13 @@ describe( 'InputCommand', () => {
 		} );
 
 		it( 'has a buffer configured to config.typing.undoStep', () => {
-			return VirtualTestEditor.create( {
-				plugins: [ Input ],
-				typing: {
-					undoStep: 5
-				}
-			} )
+			return VirtualTestEditor
+				.create( {
+					plugins: [ Input ],
+					typing: {
+						undoStep: 5
+					}
+				} )
 				.then( editor => {
 					expect( editor.commands.get( 'input' )._buffer ).to.have.property( 'limit', 5 );
 				} );

+ 11 - 10
packages/ckeditor5-typing/tests/manual/20/1.js

@@ -12,13 +12,14 @@ import Bold from '@ckeditor/ckeditor5-basic-styles/src/bold';
 import Italic from '@ckeditor/ckeditor5-basic-styles/src/italic';
 import EssentialsPreset from '@ckeditor/ckeditor5-presets/src/essentials';
 
-ClassicEditor.create( document.querySelector( '#editor' ), {
-	plugins: [ EssentialsPreset, Paragraph, Bold, Italic, Heading ],
-	toolbar: [ 'headings', 'bold', 'italic', 'undo', 'redo' ]
-} )
-.then( editor => {
-	window.editor = editor;
-} )
-.catch( err => {
-	console.error( err.stack );
-} );
+ClassicEditor
+	.create( document.querySelector( '#editor' ), {
+		plugins: [ EssentialsPreset, Paragraph, Bold, Italic, Heading ],
+		toolbar: [ 'headings', 'bold', 'italic', 'undo', 'redo' ]
+	} )
+	.then( editor => {
+		window.editor = editor;
+	} )
+	.catch( err => {
+		console.error( err.stack );
+	} );

+ 11 - 10
packages/ckeditor5-typing/tests/manual/21/1.js

@@ -12,13 +12,14 @@ import Bold from '@ckeditor/ckeditor5-basic-styles/src/bold';
 import Italic from '@ckeditor/ckeditor5-basic-styles/src/italic';
 import EssentialsPreset from '@ckeditor/ckeditor5-presets/src/essentials';
 
-ClassicEditor.create( document.querySelector( '#editor' ), {
-	plugins: [ EssentialsPreset, Paragraph, Bold, Italic, Heading ],
-	toolbar: [ 'headings', 'bold', 'italic', 'undo', 'redo' ]
-} )
-.then( editor => {
-	window.editor = editor;
-} )
-.catch( err => {
-	console.error( err.stack );
-} );
+ClassicEditor
+	.create( document.querySelector( '#editor' ), {
+		plugins: [ EssentialsPreset, Paragraph, Bold, Italic, Heading ],
+		toolbar: [ 'headings', 'bold', 'italic', 'undo', 'redo' ]
+	} )
+	.then( editor => {
+		window.editor = editor;
+	} )
+	.catch( err => {
+		console.error( err.stack );
+	} );

+ 11 - 10
packages/ckeditor5-typing/tests/manual/40/1.js

@@ -10,13 +10,14 @@ import Enter from '@ckeditor/ckeditor5-enter/src/enter';
 import Typing from '../../../src/typing';
 import Heading from '@ckeditor/ckeditor5-heading/src/heading';
 
-ClassicEditor.create( document.querySelector( '#editor' ), {
-	plugins: [ Enter, Typing, Heading ],
-	toolbar: [ 'headings' ]
-} )
-.then( editor => {
-	window.editor = editor;
-} )
-.catch( err => {
-	console.error( err.stack );
-} );
+ClassicEditor
+	.create( document.querySelector( '#editor' ), {
+		plugins: [ Enter, Typing, Heading ],
+		toolbar: [ 'headings' ]
+	} )
+	.then( editor => {
+		window.editor = editor;
+	} )
+	.catch( err => {
+		console.error( err.stack );
+	} );

+ 11 - 10
packages/ckeditor5-typing/tests/manual/52/1.js

@@ -17,13 +17,14 @@ window.setInterval( function() {
 	console.log( getData( window.editor.document ) );
 }, 3000 );
 
-ClassicEditor.create( document.querySelector( '#editor' ), {
-	plugins: [ EssentialsPreset, Paragraph, Bold, Italic, Heading ],
-	toolbar: [ 'headings', 'bold', 'italic', 'undo', 'redo' ]
-} )
-.then( editor => {
-	window.editor = editor;
-} )
-.catch( err => {
-	console.error( err.stack );
-} );
+ClassicEditor
+	.create( document.querySelector( '#editor' ), {
+		plugins: [ EssentialsPreset, Paragraph, Bold, Italic, Heading ],
+		toolbar: [ 'headings', 'bold', 'italic', 'undo', 'redo' ]
+	} )
+	.then( editor => {
+		window.editor = editor;
+	} )
+	.catch( err => {
+		console.error( err.stack );
+	} );

+ 11 - 10
packages/ckeditor5-typing/tests/manual/59/1.js

@@ -10,13 +10,14 @@ import Typing from '../../../src/typing';
 import Paragraph from '@ckeditor/ckeditor5-paragraph/src/paragraph';
 import Bold from '@ckeditor/ckeditor5-basic-styles/src/bold';
 
-ClassicEditor.create( document.querySelector( '#editor' ), {
-	plugins: [ Typing, Paragraph, Bold ],
-	toolbar: [ 'bold' ]
-} )
-.then( editor => {
-	window.editor = editor;
-} )
-.catch( err => {
-	console.error( err.stack );
-} );
+ClassicEditor
+	.create( document.querySelector( '#editor' ), {
+		plugins: [ Typing, Paragraph, Bold ],
+		toolbar: [ 'bold' ]
+	} )
+	.then( editor => {
+		window.editor = editor;
+	} )
+	.catch( err => {
+		console.error( err.stack );
+	} );

+ 11 - 10
packages/ckeditor5-typing/tests/manual/82/1.js

@@ -15,13 +15,14 @@ window.setInterval( function() {
 	console.log( getData( window.editor.document ) );
 }, 3000 );
 
-ClassicEditor.create( document.querySelector( '#editor' ), {
-	plugins: [ EssentialsPreset, Paragraph, Heading ],
-	toolbar: [ 'headings', 'undo', 'redo' ]
-} )
-.then( editor => {
-	window.editor = editor;
-} )
-.catch( err => {
-	console.error( err.stack );
-} );
+ClassicEditor
+	.create( document.querySelector( '#editor' ), {
+		plugins: [ EssentialsPreset, Paragraph, Heading ],
+		toolbar: [ 'headings', 'undo', 'redo' ]
+	} )
+	.then( editor => {
+		window.editor = editor;
+	} )
+	.catch( err => {
+		console.error( err.stack );
+	} );

+ 11 - 10
packages/ckeditor5-typing/tests/manual/86/1.js

@@ -14,13 +14,14 @@ window.setInterval( function() {
 	console.log( getData( window.editor.document ) );
 }, 3000 );
 
-ClassicEditor.create( document.querySelector( '#editor' ), {
-	plugins: [ EssentialsPreset, Paragraph ],
-	toolbar: [ 'undo', 'redo' ]
-} )
-.then( editor => {
-	window.editor = editor;
-} )
-.catch( err => {
-	console.error( err.stack );
-} );
+ClassicEditor
+	.create( document.querySelector( '#editor' ), {
+		plugins: [ EssentialsPreset, Paragraph ],
+		toolbar: [ 'undo', 'redo' ]
+	} )
+	.then( editor => {
+		window.editor = editor;
+	} )
+	.catch( err => {
+		console.error( err.stack );
+	} );

+ 11 - 10
packages/ckeditor5-typing/tests/manual/delete.js

@@ -19,13 +19,14 @@ window.setInterval( function() {
 	console.log( getData( window.editor.document ) );
 }, 3000 );
 
-ClassicEditor.create( document.querySelector( '#editor' ), {
-	plugins: [ EssentialsPreset, Paragraph, Bold, Italic, Heading ],
-	toolbar: [ 'headings', 'bold', 'italic', 'undo', 'redo' ]
-} )
-.then( editor => {
-	window.editor = editor;
-} )
-.catch( err => {
-	console.error( err.stack );
-} );
+ClassicEditor
+	.create( document.querySelector( '#editor' ), {
+		plugins: [ EssentialsPreset, Paragraph, Bold, Italic, Heading ],
+		toolbar: [ 'headings', 'bold', 'italic', 'undo', 'redo' ]
+	} )
+	.then( editor => {
+		window.editor = editor;
+	} )
+	.catch( err => {
+		console.error( err.stack );
+	} );

+ 11 - 10
packages/ckeditor5-typing/tests/manual/input.js

@@ -17,13 +17,14 @@ window.setInterval( function() {
 	console.log( getData( window.editor.document ) );
 }, 3000 );
 
-ClassicEditor.create( document.querySelector( '#editor' ), {
-	plugins: [ EssentialsPreset, Paragraph, Bold, Italic, Heading ],
-	toolbar: [ 'headings', 'bold', 'italic', 'undo', 'redo' ]
-} )
-.then( editor => {
-	window.editor = editor;
-} )
-.catch( err => {
-	console.error( err.stack );
-} );
+ClassicEditor
+	.create( document.querySelector( '#editor' ), {
+		plugins: [ EssentialsPreset, Paragraph, Bold, Italic, Heading ],
+		toolbar: [ 'headings', 'bold', 'italic', 'undo', 'redo' ]
+	} )
+	.then( editor => {
+		window.editor = editor;
+	} )
+	.catch( err => {
+		console.error( err.stack );
+	} );

+ 30 - 29
packages/ckeditor5-typing/tests/manual/nbsp.js

@@ -12,37 +12,38 @@ import Paragraph from '@ckeditor/ckeditor5-paragraph/src/paragraph';
 import { getData as getModelData } from '@ckeditor/ckeditor5-engine/src/dev-utils/model';
 import { getData as getViewData } from '@ckeditor/ckeditor5-engine/src/dev-utils/view';
 
-ClassicEditor.create( document.querySelector( '#editor' ), {
-	plugins: [ Enter, Typing, Paragraph ],
-	toolbar: []
-} )
-.then( editor => {
-	window.editor = editor;
-
-	editor.document.schema.allow( { name: '$text', inside: '$root' } );
-
-	const editable = editor.ui.view.editableElement;
-
-	document.querySelector( '#nbsp' ).addEventListener( 'click', () => {
-		editor.document.enqueueChanges( () => {
-			editor.document.selection.collapseToStart();
-			editor.document.batch().weakInsert( editor.document.selection.getFirstPosition(), '\u00A0' );
+ClassicEditor
+	.create( document.querySelector( '#editor' ), {
+		plugins: [ Enter, Typing, Paragraph ],
+		toolbar: []
+	} )
+	.then( editor => {
+		window.editor = editor;
+
+		editor.document.schema.allow( { name: '$text', inside: '$root' } );
+
+		const editable = editor.ui.view.editableElement;
+
+		document.querySelector( '#nbsp' ).addEventListener( 'click', () => {
+			editor.document.enqueueChanges( () => {
+				editor.document.selection.collapseToStart();
+				editor.document.batch().weakInsert( editor.document.selection.getFirstPosition(), '\u00A0' );
+			} );
 		} );
-	} );
 
-	editor.document.on( 'changesDone', () => {
-		console.clear();
+		editor.document.on( 'changesDone', () => {
+			console.clear();
 
-		const modelData = getModelData( editor.document, { withoutSelection: true } );
-		console.log( 'model:', modelData.replace( /\u00A0/g, '&nbsp;' ) );
+			const modelData = getModelData( editor.document, { withoutSelection: true } );
+			console.log( 'model:', modelData.replace( /\u00A0/g, '&nbsp;' ) );
 
-		const viewData = getViewData( editor.editing.view, { withoutSelection: true } );
-		console.log( 'view:', viewData.replace( /\u00A0/g, '&nbsp;' ) );
+			const viewData = getViewData( editor.editing.view, { withoutSelection: true } );
+			console.log( 'view:', viewData.replace( /\u00A0/g, '&nbsp;' ) );
 
-		console.log( 'dom:', editable.innerHTML );
-		console.log( 'editor.getData', editor.getData() );
-	}, { priority: 'lowest' } );
-} )
-.catch( err => {
-	console.error( err.stack );
-} );
+			console.log( 'dom:', editable.innerHTML );
+			console.log( 'editor.getData', editor.getData() );
+		}, { priority: 'lowest' } );
+	} )
+	.catch( err => {
+		console.error( err.stack );
+	} );

+ 21 - 19
packages/ckeditor5-typing/tests/manual/rtl.js

@@ -85,22 +85,24 @@ window.setInterval( function() {
 	}
 }, 3000 );
 
-ClassicEditor.create( document.querySelector( '#editor1' ), config )
-.then( editor => {
-	window.editor1 = editor;
-
-	// Editable doesn't automatically get this attribute right now.
-	// https://github.com/ckeditor/ckeditor5-editor-classic/issues/32
-	editor.editing.view.getDomRoot().setAttribute( 'dir', 'rtl' );
-} )
-.catch( err => {
-	console.error( err.stack );
-} );
-
-ClassicEditor.create( document.querySelector( '#editor2' ), config )
-.then( editor => {
-	window.editor2 = editor;
-} )
-.catch( err => {
-	console.error( err.stack );
-} );
+ClassicEditor
+	.create( document.querySelector( '#editor1' ), config )
+	.then( editor => {
+		window.editor1 = editor;
+
+		// Editable doesn't automatically get this attribute right now.
+		// https://github.com/ckeditor/ckeditor5-editor-classic/issues/32
+		editor.editing.view.getDomRoot().setAttribute( 'dir', 'rtl' );
+	} )
+	.catch( err => {
+		console.error( err.stack );
+	} );
+
+ClassicEditor
+	.create( document.querySelector( '#editor2' ), config )
+	.then( editor => {
+		window.editor2 = editor;
+	} )
+	.catch( err => {
+		console.error( err.stack );
+	} );

+ 11 - 10
packages/ckeditor5-typing/tests/manual/selection.js

@@ -10,13 +10,14 @@ import Paragraph from '@ckeditor/ckeditor5-paragraph/src/paragraph';
 import Bold from '@ckeditor/ckeditor5-basic-styles/src/bold';
 import EssentialsPreset from '@ckeditor/ckeditor5-presets/src/essentials';
 
-ClassicEditor.create( document.querySelector( '#editor' ), {
-	plugins: [ EssentialsPreset, Paragraph, Bold ],
-	toolbar: [ 'bold' ]
-} )
-.then( editor => {
-	window.editor = editor;
-} )
-.catch( err => {
-	console.error( err.stack );
-} );
+ClassicEditor
+	.create( document.querySelector( '#editor' ), {
+		plugins: [ EssentialsPreset, Paragraph, Bold ],
+		toolbar: [ 'bold' ]
+	} )
+	.then( editor => {
+		window.editor = editor;
+	} )
+	.catch( err => {
+		console.error( err.stack );
+	} );

+ 11 - 10
packages/ckeditor5-typing/tests/manual/unicode.js

@@ -10,13 +10,14 @@ import Enter from '@ckeditor/ckeditor5-enter/src/enter';
 import Typing from '../../src/typing';
 import Paragraph from '@ckeditor/ckeditor5-paragraph/src/paragraph';
 
-ClassicEditor.create( document.querySelector( '#editor' ), {
-	plugins: [ Enter, Typing, Paragraph ],
-	toolbar: []
-} )
-.then( editor => {
-	window.editor = editor;
-} )
-.catch( err => {
-	console.error( err.stack );
-} );
+ClassicEditor
+	.create( document.querySelector( '#editor' ), {
+		plugins: [ Enter, Typing, Paragraph ],
+		toolbar: []
+	} )
+	.then( editor => {
+		window.editor = editor;
+	} )
+	.catch( err => {
+		console.error( err.stack );
+	} );

+ 7 - 6
packages/ckeditor5-typing/tests/spellchecking.js

@@ -26,12 +26,13 @@ describe( 'Spellchecking integration', () => {
 		container = document.createElement( 'div' );
 		document.body.appendChild( container );
 
-		return ClassicEditor.create( container, {
-			plugins: [ Enter, Typing, Paragraph, Bold, Undo ]
-		} )
-		.then( newEditor => {
-			editor = newEditor;
-		} );
+		return ClassicEditor
+			.create( container, {
+				plugins: [ Enter, Typing, Paragraph, Bold, Undo ]
+			} )
+			.then( newEditor => {
+				editor = newEditor;
+			} );
 	} );
 
 	after( () => {

+ 7 - 6
packages/ckeditor5-typing/tests/tickets/59.js

@@ -19,12 +19,13 @@ describe( 'Bug ckeditor5-typing#59', () => {
 		container = document.createElement( 'div' );
 		document.body.appendChild( container );
 
-		return ClassicEditor.create( container, {
-			plugins: [ Typing, Paragraph, Bold ]
-		} )
-		.then( newEditor => {
-			editor = newEditor;
-		} );
+		return ClassicEditor
+			.create( container, {
+				plugins: [ Typing, Paragraph, Bold ]
+			} )
+			.then( newEditor => {
+				editor = newEditor;
+			} );
 	} );
 
 	afterEach( () => {