8
0

setdata.js 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. /**
  2. * @license Copyright (c) 2003-2020, CKSource - Frederico Knabben. All rights reserved.
  3. * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
  4. */
  5. /* globals console, window, document */
  6. import ClassicEditor from '@ckeditor/ckeditor5-editor-classic/src/classiceditor';
  7. import ArticlePluginSet from '@ckeditor/ckeditor5-core/tests/_utils/articlepluginset';
  8. import { loadPerformanceData } from '../../_utils/utils';
  9. ClassicEditor
  10. .create( document.querySelector( '#editor' ), {
  11. plugins: [ ArticlePluginSet ],
  12. toolbar: [
  13. 'heading',
  14. '|',
  15. 'bold',
  16. 'italic',
  17. 'link',
  18. 'bulletedList',
  19. 'numberedList',
  20. '|',
  21. 'outdent',
  22. 'indent',
  23. '|',
  24. 'blockQuote',
  25. 'insertTable',
  26. 'mediaEmbed',
  27. 'undo',
  28. 'redo'
  29. ]
  30. } )
  31. .then( editor => {
  32. window.editor = editor;
  33. } )
  34. .catch( err => {
  35. console.error( err.stack );
  36. } );
  37. loadPerformanceData()
  38. .then( fixtures => {
  39. const buttons = document.querySelectorAll( '#test-controls button' );
  40. for ( const button of buttons ) {
  41. button.addEventListener( 'click', function() {
  42. const content = fixtures[ this.getAttribute( 'data-file-name' ) ];
  43. window.editor.setData( content );
  44. } );
  45. button.disabled = false;
  46. }
  47. } );