paste-plain-text.js 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  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 ClassicEditor, console, window, document */
  6. import { CS_CONFIG } from '@ckeditor/ckeditor5-cloud-services/tests/_utils/cloud-services-config';
  7. ClassicEditor
  8. .create( document.querySelector( '#snippet-paste-plain-text' ), {
  9. toolbar: {
  10. items: [
  11. 'heading',
  12. '|',
  13. 'fontSize',
  14. 'fontFamily',
  15. 'fontColor',
  16. 'fontBackgroundColor',
  17. '|',
  18. 'bold',
  19. 'italic',
  20. 'underline',
  21. 'strikethrough',
  22. '|',
  23. 'undo',
  24. 'redo'
  25. ],
  26. viewportTopOffset: window.getViewportTopOffsetConfig()
  27. },
  28. fontFamily: {
  29. supportAllValues: true
  30. },
  31. fontSize: {
  32. options: [ 10, 12, 14, 'default', 18, 20, 22 ],
  33. supportAllValues: true
  34. },
  35. placeholder: 'Paste the content here to test the feature.',
  36. cloudServices: CS_CONFIG
  37. } )
  38. .then( editor => {
  39. window.editor = editor;
  40. // Prevent showing a warning notification when user is pasting a content from MS Word or Google Docs.
  41. window.preventPasteFromOfficeNotification = false;
  42. } )
  43. .catch( err => {
  44. console.error( err.stack );
  45. } );