Browse Source

Minor code style and comments improvements.

Piotrek Koszuliński 8 years ago
parent
commit
25f6145ea3

+ 2 - 0
packages/ckeditor5-paragraph/src/paragraph.js

@@ -75,6 +75,8 @@ export default class Paragraph extends Plugin {
 		editor.commands.set( 'paragraph', new ParagraphCommand( editor ) );
 
 		// Post-fixer that takes care of adding empty paragraph elements to empty roots.
+		// Besides fixing content on #changesDone we also need to handle #dataReady because
+		// if initial data is empty or setData() wasn't even called there will be no #change fired.
 		doc.on( 'change', ( evt, type, changes, batch ) => findEmptyRoots( doc, batch ) );
 		doc.on( 'changesDone', autoparagraphEmptyRoots, { priority: 'lowest' } );
 		editor.on( 'dataReady', () => {

+ 4 - 4
packages/ckeditor5-paragraph/tests/paragraph-intergration.js

@@ -150,8 +150,8 @@ describe( 'Paragraph feature – integration', () => {
 	describe( 'with undo', () => {
 		it( 'fixing empty roots should be transparent to undo', () => {
 			return VirtualTestEditor.create( {
-				plugins: [ Paragraph, UndoEngine ]
-			} )
+					plugins: [ Paragraph, UndoEngine ]
+				} )
 				.then( newEditor => {
 					const editor = newEditor;
 					const doc = editor.document;
@@ -184,8 +184,8 @@ describe( 'Paragraph feature – integration', () => {
 
 		it( 'fixing empty roots should be transparent to undo - multiple roots', () => {
 			return VirtualTestEditor.create( {
-				plugins: [ Paragraph, UndoEngine ]
-			} )
+					plugins: [ Paragraph, UndoEngine ]
+				} )
 				.then( newEditor => {
 					const editor = newEditor;
 					const doc = editor.document;