@steroidsjs/ckeditor5
Version:
The development environment of CKEditor 5 – the best browser-based rich text editor.
34 lines (24 loc) • 1.16 kB
JavaScript
/**
* @license Copyright (c) 2003-2021, CKSource - Frederico Knabben. All rights reserved.
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
*/
/* globals console, document */
import { getPerformanceData, createPerformanceEditor, renderPerformanceDataButtons } from '../../_utils/utils';
renderPerformanceDataButtons( document.querySelector( '#fixture-buttons' ) );
const fixtures = getPerformanceData();
const buttons = document.querySelectorAll( '#test-controls button' );
for ( const button of buttons ) {
const fixtureName = button.getAttribute( 'data-file-name' );
const content = fixtures[ fixtureName ];
const editorElement = document.querySelector( `#editor_${ fixtureName }` );
// Put the source content in editor-related elements ahead of time, so that potentially
// big `innerHTML` change does not affect the benchmark when pressing the button.
editorElement.innerHTML = content;
button.addEventListener( 'click', function() {
createPerformanceEditor( editorElement )
.catch( err => {
console.error( err.stack );
} );
} );
button.disabled = false;
}