Browse Source

Unified use of the 'post-fixer' term across the code.

Piotrek Koszuliński 7 years ago
parent
commit
19dbe76502

File diff suppressed because it is too large
+ 1 - 1
packages/ckeditor5-engine/CHANGELOG.md


+ 1 - 1
packages/ckeditor5-engine/src/model/document.js

@@ -155,7 +155,7 @@ export default class Document {
 		} );
 
 		// Wait for `_change` event from model, which signalizes that outermost change block has finished.
-		// When this happens, check if there were any changes done on document, and if so, call post fixers,
+		// When this happens, check if there were any changes done on document, and if so, call post-fixers,
 		// fire `change` event for features and conversion and then reset the differ.
 		// Fire `change:data` event when at least one operation or buffered marker changes the data.
 		this.listenTo( model, '_change', ( evt, writer ) => {

+ 1 - 1
packages/ckeditor5-engine/src/model/model.js

@@ -26,7 +26,7 @@ import insertContent from './utils/insertcontent';
 import deleteContent from './utils/deletecontent';
 import modifySelection from './utils/modifyselection';
 import getSelectedContent from './utils/getselectedcontent';
-import { injectSelectionPostFixer } from './utils/selection-postfixer';
+import { injectSelectionPostFixer } from './utils/selection-post-fixer';
 
 /**
  * Editor's data model. Read about the model in the

+ 1 - 1
packages/ckeditor5-engine/src/model/utils/insertcontent.js

@@ -145,7 +145,7 @@ class Insertion {
 			} );
 		}
 
-		// TMP this will become a postfixer.
+		// TMP this will become a post-fixer.
 		this.schema.removeDisallowedAttributes( this._filterAttributesOf, this.writer );
 		this._filterAttributesOf = [];
 	}

+ 4 - 4
packages/ckeditor5-engine/src/model/utils/selection-postfixer.js

@@ -4,16 +4,16 @@
  */
 
 /**
- * @module engine/mode/utils/selection-postfixer
+ * @module engine/mode/utils/selection-post-fixer
  */
 
 import Range from '../range';
 import Position from '../position';
 
 /**
- * Injects selection post fixer to the model.
+ * Injects selection post-fixer to the model.
  *
- * The selection post fixer checks if nodes with `isLimit` property in schema are properly selected.
+ * The selection post-fixer checks if nodes with `isLimit` property in schema are properly selected.
  *
  * See as an example selection that starts in P1 element and ends inside text of TD element
  * (`[` and `]` are range boundaries and `(l)` denotes element defines as `isLimit=true`):
@@ -52,7 +52,7 @@ export function injectSelectionPostFixer( model ) {
 	model.document.registerPostFixer( writer => selectionPostFixer( writer, model ) );
 }
 
-// The selection post fixer.
+// The selection post-fixer.
 //
 // @param {module:engine/model/writer~Writer} writer
 // @param {module:engine/model/model~Model} model

+ 1 - 1
packages/ckeditor5-engine/src/view/placeholder.js

@@ -29,7 +29,7 @@ export function attachPlaceholder( view, element, placeholderText, checkFunction
 	if ( !documentPlaceholders.has( document ) ) {
 		documentPlaceholders.set( document, new Map() );
 
-		// Create view post fixer that will add placeholder where needed.
+		// Create view post-fixer that will add placeholder where needed.
 		document.registerPostFixer( writer => updateAllPlaceholders( document, writer ) );
 	}
 

+ 8 - 7
packages/ckeditor5-engine/src/view/view.js

@@ -325,13 +325,14 @@ export default class View {
 			 * Thrown when there is an attempt to make changes to the view tree when it is in incorrect state. This may
 			 * cause some unexpected behaviour and inconsistency between the DOM and the view.
 			 * This may be caused by:
-			 *   * calling {@link #change} or {@link #render} during rendering process,
-			 *   * calling {@link #change} or {@link #render} inside of
-			 *   {@link module:engine/view/document~Document#registerPostFixer post fixer function}.
+			 *
+			 * * calling {@link #change} or {@link #render} during rendering process,
+			 * * calling {@link #change} or {@link #render} inside of
+			 *   {@link module:engine/view/document~Document#registerPostFixer post-fixer function}.
 			 */
 			throw new CKEditorError(
 				'cannot-change-view-tree: ' +
-				'Attempting to make changes to the view when it is in incorrect state: rendering or post fixers are in progress. ' +
+				'Attempting to make changes to the view when it is in incorrect state: rendering or post-fixers are in progress. ' +
 				'This may cause some unexpected behaviour and inconsistency between the DOM and the view.'
 			);
 		}
@@ -349,7 +350,7 @@ export default class View {
 		callback( this._writer );
 		this._ongoingChange = false;
 
-		// Execute all document post fixers after the change.
+		// Execute all document post-fixers after the change.
 		this._postFixersInProgress = true;
 		this.document._callPostFixers( this._writer );
 		this._postFixersInProgress = false;
@@ -395,7 +396,7 @@ export default class View {
 
 	/**
 	 * Fired after a topmost {@link module:engine/view/view~View#change change block} and all
-	 * {@link module:engine/view/document~Document#registerPostFixer post fixers} are executed.
+	 * {@link module:engine/view/document~Document#registerPostFixer post-fixers} are executed.
 	 *
 	 * Actual rendering is performed as a first listener on 'normal' priority.
 	 *
@@ -405,7 +406,7 @@ export default class View {
 	 *
 	 * This event is useful when you want to update interface elements after the rendering, e.g. position of the
 	 * balloon panel. If you wants to change view structure use
-	 * {@link module:engine/view/document~Document#registerPostFixer post fixers}.
+	 * {@link module:engine/view/document~Document#registerPostFixer post-fixers}.
 	 *
 	 * @event module:engine/view/view~View#event:render
 	 */

+ 10 - 2
packages/ckeditor5-engine/tests/model/utils/selection-postfixer.js

@@ -7,10 +7,18 @@ import Model from '../../../src/model/model';
 import ModelPosition from '../../../src/model/position';
 import ModelRange from '../../../src/model/range';
 
+import { injectSelectionPostFixer } from '../../../src/model/utils/selection-post-fixer';
+
 import { getData as getModelData, setData as setModelData } from '../../../src/dev-utils/model';
 
-describe( 'Selection post fixer', () => {
-	describe( 'selectionPostFixer()', () => {
+describe( 'Selection post-fixer', () => {
+	describe( 'injectSelectionPostFixer()', () => {
+		it( 'is a function', () => {
+			expect( injectSelectionPostFixer ).to.be.a( 'function' );
+		} );
+	} );
+
+	describe( 'injected behavior', () => {
 		let model, modelRoot;
 
 		beforeEach( () => {

+ 2 - 2
packages/ckeditor5-engine/tests/view/document.js

@@ -59,7 +59,7 @@ describe( 'Document', () => {
 		} );
 	} );
 
-	describe( 'post fixers', () => {
+	describe( 'post-fixers', () => {
 		it( 'should add a callback that is called on _callPostFixers', () => {
 			const spy1 = sinon.spy();
 			const spy2 = sinon.spy();
@@ -77,7 +77,7 @@ describe( 'Document', () => {
 			sinon.assert.calledWithExactly( spy2, writerMock );
 		} );
 
-		it( 'should call post fixer until all returns false', () => {
+		it( 'should call post-fixer until all returns false', () => {
 			let calls = 0;
 
 			const spy1 = sinon.spy( () => calls++ < 2 );

+ 3 - 3
packages/ckeditor5-engine/tests/view/view/view.js

@@ -471,7 +471,7 @@ describe( 'view', () => {
 			domDiv.remove();
 		} );
 
-		it( 'should throw when someone tries to use change() method in post fixer', () => {
+		it( 'should throw when someone tries to use change() method in post-fixer', () => {
 			const domDiv = document.createElement( 'div' );
 			createViewRoot( viewDocument, 'div', 'main' );
 			view.attachDomRoot( domDiv );
@@ -536,7 +536,7 @@ describe( 'view', () => {
 			sinon.assert.callOrder( renderSpy, eventSpy );
 		} );
 
-		it( 'should call post fixers after change but before rendering', () => {
+		it( 'should call post-fixers after change but before rendering', () => {
 			const postFixer1 = sinon.spy( () => false );
 			const postFixer2 = sinon.spy( () => false );
 			const changeSpy = sinon.spy();
@@ -556,7 +556,7 @@ describe( 'view', () => {
 			sinon.assert.callOrder( changeSpy, postFixer1, postFixer2, eventSpy );
 		} );
 
-		it( 'should call post fixers until all are done', () => {
+		it( 'should call post-fixers until all are done', () => {
 			let called = false;
 			const postFixer1 = sinon.spy();
 			const postFixer2 = sinon.spy();