8
0

virtualtesteditor.js 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. /**
  2. * @license Copyright (c) 2003-2016, CKSource - Frederico Knabben. All rights reserved.
  3. * For licensing, see LICENSE.md.
  4. */
  5. 'use strict';
  6. import Editor from '/ckeditor5/editor/editor.js';
  7. import VirtualEditingController from './virtualeditingcontroller.js';
  8. import HtmlDataProcessor from '/ckeditor5/engine/dataprocessor/htmldataprocessor.js';
  9. /**
  10. * A simple editor implementation which features a {@link tests.ckeditor5._utils.VirtualEditingController}.
  11. * Useful for testing engine parts of features.
  12. *
  13. * Should work in Node.js. If not now, then in the future :).
  14. *
  15. * @memberOf tests.ckeditor5._utils
  16. */
  17. export default class VirtualTestEditor extends Editor {
  18. constructor( config ) {
  19. super( config );
  20. this.editing = new VirtualEditingController( this.document );
  21. this.data.processor = new HtmlDataProcessor();
  22. }
  23. /**
  24. * Sets the data in the editor's main root.
  25. *
  26. * @param {*} data The data to load.
  27. */
  28. setData( data ) {
  29. this.data.set( data );
  30. }
  31. /**
  32. * Gets the data from the editor's main root.
  33. */
  34. getData() {
  35. return this.data.get();
  36. }
  37. }