paste-plaintext.js 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  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-plaintext' ), {
  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. 'alignment',
  24. '|',
  25. 'indent',
  26. 'outdent',
  27. '|',
  28. 'undo',
  29. 'redo'
  30. ],
  31. viewportTopOffset: window.getViewportTopOffsetConfig()
  32. },
  33. image: {
  34. styles: [
  35. 'full',
  36. 'alignLeft',
  37. 'alignRight'
  38. ],
  39. toolbar: [
  40. 'imageStyle:alignLeft',
  41. 'imageStyle:full',
  42. 'imageStyle:alignRight',
  43. '|',
  44. 'imageTextAlternative'
  45. ]
  46. },
  47. table: {
  48. contentToolbar: [
  49. 'tableColumn',
  50. 'tableRow',
  51. 'mergeTableCells',
  52. 'tableProperties',
  53. 'tableCellProperties'
  54. ]
  55. },
  56. fontFamily: {
  57. supportAllValues: true
  58. },
  59. fontSize: {
  60. options: [ 10, 12, 14, 'default', 18, 20, 22 ],
  61. supportAllValues: true
  62. },
  63. placeholder: 'Paste the content here to test the feature.',
  64. cloudServices: CS_CONFIG
  65. } )
  66. .then( editor => {
  67. window.editor = editor;
  68. // Prevent showing a warning notification when user is pasting a content from MS Word or Google Docs.
  69. window.preventPasteFromOfficeNotification = true;
  70. } )
  71. .catch( err => {
  72. console.error( err.stack );
  73. } );