Jelajahi Sumber

Disable automatic inspector attachment in rich editor sample.

Maciej Gołaszewski 6 tahun lalu
induk
melakukan
3f8056c4fc
1 mengubah file dengan 9 tambahan dan 6 penghapusan
  1. 9 6
      tests/manual/performance/richeditor.js

+ 9 - 6
tests/manual/performance/richeditor.js

@@ -3,7 +3,7 @@
  * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
  */
 
-/* globals console, window, document */
+/* globals console, document */
 
 import ClassicEditor from '@ckeditor/ckeditor5-editor-classic/src/classiceditor';
 import ArticlePluginSet from '@ckeditor/ckeditor5-core/tests/_utils/articlepluginset';
@@ -46,6 +46,8 @@ renderPerformanceDataButtons( document.querySelector( '#fixture-buttons' ), {
 	'smallTablesInlineCss': 'text and tables (styled)'
 } );
 
+let editor;
+
 ClassicEditor
 	.create( document.querySelector( '#editor' ), {
 		plugins: [
@@ -126,11 +128,12 @@ ClassicEditor
 			toolbar: [ 'imageStyle:full', 'imageStyle:side', 'imageTextAlternative' ]
 		}
 	} )
-	.then( editor => {
-		window.editor = editor;
+	.then( newEditor => {
+		// Editor is not exposed as window.editor to disable CKEditor5 Inspector for performance tests.
+		editor = newEditor;
 
-		addWordCountListener( editor );
-		addUploadMockAdapter( editor );
+		addWordCountListener( newEditor );
+		addUploadMockAdapter( newEditor );
 	} )
 	.catch( err => {
 		console.error( err.stack );
@@ -170,7 +173,7 @@ for ( const button of buttons ) {
 	button.addEventListener( 'click', function() {
 		const content = fixtures[ this.getAttribute( 'data-file-name' ) ];
 
-		window.editor.setData( content );
+		editor.setData( content );
 	} );
 	button.disabled = false;
 }