Procházet zdrojové kódy

Renamed isCreatedByEditor to wasCreatedByEditor.

Oskar Wróbel před 6 roky
rodič
revize
6b695e9893

+ 5 - 6
packages/ckeditor5-core/src/context.js

@@ -60,13 +60,12 @@ export default class Context {
 		this.t = this.locale.t;
 
 		/**
-		 * When the context is created by an editor then the editor instance is
-		 * stored as an owner of this context.
+		 * `true` when the context is created by an editor `false` otherwise.
 		 *
 		 * @readonly
 		 * @type {Boolean}
 		 */
-		this.isCreatedByEditor = false;
+		this.wasCreatedByEditor = false;
 
 		/**
 		 * List of editors to which this context instance is injected.
@@ -81,14 +80,14 @@ export default class Context {
 	 * Adds a reference to the editor which is used with this context.
 	 *
 	 * When the context is created by the editor it is additionally
-	 * marked as a {@link ~Context#isCreatedByEditor} what is used
+	 * marked as a {@link ~Context#wasCreatedByEditor} what is used
 	 * in the destroy chain.
 	 *
 	 * @param {module:core/editor/editor~Editor} editor
 	 * @param {Boolean} isContextOwner
 	 */
 	addEditor( editor, isContextOwner ) {
-		if ( this.isCreatedByEditor ) {
+		if ( this.wasCreatedByEditor ) {
 			/**
 			 * Cannot add multiple editors to the context which is created by the editor.
 			 *
@@ -102,7 +101,7 @@ export default class Context {
 		this._editors.add( editor );
 
 		if ( isContextOwner ) {
-			this.isCreatedByEditor = true;
+			this.wasCreatedByEditor = true;
 		}
 	}
 

+ 1 - 1
packages/ckeditor5-core/src/editor/editor.js

@@ -258,7 +258,7 @@ export default class Editor {
 
 				// When the editor was an owner of the context then
 				// the context should be destroyed along with the editor.
-				if ( this._context.isCreatedByEditor ) {
+				if ( this._context.wasCreatedByEditor ) {
 					return this._context.destroy();
 				}
 			} ).then( () => {

+ 2 - 2
packages/ckeditor5-core/tests/editor/editor.js

@@ -186,7 +186,7 @@ describe( 'Editor', () => {
 			const editor = new TestEditor();
 
 			expect( editor._context ).to.be.an.instanceof( Context );
-			expect( editor._context.isCreatedByEditor ).to.true;
+			expect( editor._context.wasCreatedByEditor ).to.true;
 		} );
 
 		it( 'should use context given through configuration when is defined', async () => {
@@ -194,7 +194,7 @@ describe( 'Editor', () => {
 			const editor = new TestEditor( { context } );
 
 			expect( editor._context ).to.equal( context );
-			expect( editor._context.isCreatedByEditor ).to.false;
+			expect( editor._context.wasCreatedByEditor ).to.false;
 		} );
 
 		it( 'should throw when try to use context created by one editor with the other editor', () => {