word-count.js 899 B

123456789101112131415161718192021222324252627282930313233343536373839
  1. /**
  2. * @license Copyright (c) 2003-2019, CKSource - Frederico Knabben. All rights reserved.
  3. * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
  4. */
  5. /* global document, window, console, ClassicEditor */
  6. ClassicEditor
  7. .create( document.querySelector( '#demo-editor' ), {
  8. toolbar: {
  9. items: [
  10. 'heading',
  11. 'bold',
  12. 'italic',
  13. 'bulletedList',
  14. 'numberedList',
  15. 'blockQuote',
  16. 'link',
  17. '|',
  18. 'mediaEmbed',
  19. 'insertTable',
  20. '|',
  21. 'undo',
  22. 'redo'
  23. ],
  24. viewportTopOffset: window.getViewportTopOffsetConfig()
  25. },
  26. table: {
  27. contentToolbar: [ 'tableColumn', 'tableRow', 'mergeTableCells' ]
  28. }
  29. } )
  30. .then( editor => {
  31. window.editor = editor;
  32. document.getElementById( 'demo-word-counter' ).appendChild( editor.plugins.get( 'WordCount' ).wordCountContainer );
  33. } )
  34. .catch( err => {
  35. console.error( err.stack );
  36. } );