twostepscarret.js 950 B

1234567891011121314151617181920212223242526
  1. /**
  2. * @license Copyright (c) 2003-2018, CKSource - Frederico Knabben. All rights reserved.
  3. * For licensing, see LICENSE.md.
  4. */
  5. /* global console, document */
  6. import ClassicEditor from '@ckeditor/ckeditor5-editor-classic/src/classiceditor';
  7. import Essentials from '@ckeditor/ckeditor5-essentials/src/essentials';
  8. import Paragraph from '@ckeditor/ckeditor5-paragraph/src/paragraph';
  9. import Underline from '@ckeditor/ckeditor5-basic-styles/src/underline';
  10. import Bold from '@ckeditor/ckeditor5-basic-styles/src/bold';
  11. import bindTwoStepCaretToAttribute from '@ckeditor/ckeditor5-engine/src/utils/bindtwostepcarettoattribute';
  12. ClassicEditor
  13. .create( document.querySelector( '#editor' ), {
  14. plugins: [ Essentials, Paragraph, Underline, Bold ],
  15. toolbar: [ 'undo', 'redo', '|', 'bold', 'underline' ]
  16. } )
  17. .then( editor => {
  18. bindTwoStepCaretToAttribute( editor, editor, 'underline' );
  19. } )
  20. .catch( err => {
  21. console.error( err.stack );
  22. } );