article.js 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  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. /* globals console, window, document */
  6. import ClassicEditor from '@ckeditor/ckeditor5-editor-classic/src/classiceditor';
  7. import ArticlePluginSet from '../_utils/articlepluginset';
  8. import MultiCommand from '../../src/multicommand';
  9. import Plugin from '../../src/plugin';
  10. class IndentOutdent extends Plugin {
  11. afterInit() {
  12. const editor = this.editor;
  13. const indentCommand = new MultiCommand( editor );
  14. indentCommand.registerChildCommand( editor.commands.get( 'indentList' ) );
  15. editor.commands.add( 'indent', indentCommand );
  16. const outdentCommand = new MultiCommand( editor );
  17. outdentCommand.registerChildCommand( editor.commands.get( 'outdentList' ) );
  18. editor.commands.add( 'outdent', outdentCommand );
  19. }
  20. }
  21. ClassicEditor
  22. .create( document.querySelector( '#editor' ), {
  23. plugins: [ ArticlePluginSet, IndentOutdent ],
  24. toolbar: [
  25. 'heading',
  26. '|',
  27. 'bold',
  28. 'italic',
  29. 'link',
  30. 'bulletedList',
  31. 'numberedList',
  32. 'blockQuote',
  33. 'insertTable',
  34. 'mediaEmbed',
  35. 'undo',
  36. 'redo'
  37. ],
  38. image: {
  39. toolbar: [ 'imageStyle:full', 'imageStyle:side', '|', 'imageTextAlternative' ]
  40. },
  41. table: {
  42. contentToolbar: [
  43. 'tableColumn',
  44. 'tableRow',
  45. 'mergeTableCells'
  46. ]
  47. }
  48. } )
  49. .then( editor => {
  50. window.editor = editor;
  51. } )
  52. .catch( err => {
  53. console.error( err.stack );
  54. } );