init.js 655 B

123456789101112131415161718192021222324
  1. /**
  2. * @license Copyright (c) 2003-2015, CKSource - Frederico Knabben. All rights reserved.
  3. * For licensing, see LICENSE.md.
  4. */
  5. /* global console:false */
  6. 'use strict';
  7. import TreeView from '/ckeditor5/core/treeview/treeview.js';
  8. import Element from '/ckeditor5/core/treeview/element.js';
  9. import Text from '/ckeditor5/core/treeview/text.js';
  10. const treeView = new TreeView();
  11. treeView.createRoot( document.getElementById( 'editor' ), 'editor' );
  12. treeView.viewRoots.get( 'editor' ).appendChildren( [
  13. new Element( 'p', [], [ new Text( 'New' ) ] ),
  14. new Element( 'p', [], [ new Text( 'Content' ) ] )
  15. ] );
  16. treeView.render();
  17. console.log( treeView );