index.js 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. /**
  2. * @license Copyright (c) 2003-2015, CKSource - Frederico Knabben. All rights reserved.
  3. * For licensing, see LICENSE.md.
  4. */
  5. 'use strict';
  6. const path = require( 'path' );
  7. const files = [
  8. path.join( __dirname, '../static/extensions.js' ),
  9. path.join( __dirname, '../static/tools.js' )
  10. ];
  11. module.exports = {
  12. name: 'bender-ckeditor5',
  13. attach() {
  14. this.plugins.addFiles( files );
  15. this.on( 'test:created', ( test ) => {
  16. let name = test.displayName;
  17. name = name.replace( /node_modules\/ckeditor5-core/, 'core: ' );
  18. name = name.replace( /node_modules\/ckeditor5-plugin-([^\/]+)/, 'plugin!$1: ' );
  19. test.displayName = name;
  20. } );
  21. // Add this plugins' scripts before the includes pagebuilder (which handles bender-include directives), so
  22. // the main tools file is loaded before tools included in the core or in the plugins.
  23. this.pagebuilders.add( 'ckeditor5', build, this.pagebuilders.getPriority( 'includes' ) - 1 );
  24. function build( data ) {
  25. files.forEach( ( file ) => {
  26. data.addJS( path.join( '/plugins/', file ).split( path.sep ).join( '/' ) );
  27. } );
  28. return data;
  29. }
  30. }
  31. };