index.js 1.2 KB

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