Browse Source

Do not expose window.editor to prevent CKEditorInspector automatic attachment.

Maciej Gołaszewski 6 years ago
parent
commit
e443b0c98e
1 changed files with 6 additions and 4 deletions
  1. 6 4
      packages/ckeditor5-editor-classic/tests/manual/memory.js

+ 6 - 4
packages/ckeditor5-editor-classic/tests/manual/memory.js

@@ -3,7 +3,7 @@
  * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
  */
 
-/* globals console:false, document, window */
+/* globals console, document */
 
 import ClassicEditor from '../../src/classiceditor';
 import ArticlePluginSet from '@ckeditor/ckeditor5-core/tests/_utils/articlepluginset';
@@ -15,6 +15,8 @@ import ArticlePluginSet from '@ckeditor/ckeditor5-core/tests/_utils/articleplugi
  * - add event listeners with () => {} methods which reference other
  */
 function initEditor() {
+	let editor;
+
 	ClassicEditor
 		.create( document.querySelector( '#editor' ), {
 			plugins: [ ArticlePluginSet ],
@@ -51,7 +53,7 @@ function initEditor() {
 			}
 		} )
 		.then( newEditor => {
-			window.editor = newEditor;
+			editor = newEditor;
 
 			document.getElementById( 'destroyEditor' ).addEventListener( 'click', destroyEditor );
 		} )
@@ -60,8 +62,8 @@ function initEditor() {
 		} );
 
 	function destroyEditor() {
-		window.editor.destroy().then( () => console.log( 'Editor was destroyed' ) );
-		window.editor = null;
+		editor.destroy().then( () => console.log( 'Editor was destroyed' ) );
+		editor = null;
 		document.getElementById( 'destroyEditor' ).removeEventListener( 'click', destroyEditor );
 	}
 }