paste-from-office.js 1.7 KB

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