inline-filler.js 1007 B

1234567891011121314151617181920212223242526272829303132
  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 document */
  6. import View from '../../../src/view/view';
  7. import createViewRoot from '../_utils/createroot';
  8. import { setData } from '../../../src/dev-utils/view';
  9. import { StylesProcessor } from '../../../src/view/stylesmap';
  10. const view = new View( new StylesProcessor() );
  11. const viewDocument = view.document;
  12. createViewRoot( viewDocument );
  13. view.attachDomRoot( document.getElementById( 'editor' ) );
  14. setData(
  15. view,
  16. '<container:p><attribute:strong>foo</attribute:strong>[]<attribute:strong>bar</attribute:strong></container:p>'
  17. );
  18. view.focus();
  19. viewDocument.on( 'selectionChange', ( evt, data ) => {
  20. view.change( writer => {
  21. // Re-render view selection each time selection is changed.
  22. // See https://github.com/ckeditor/ckeditor5-engine/issues/796.
  23. writer.setSelection( data.newSelection );
  24. } );
  25. } );