8
0

index.js 1.0 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. const path = require( 'path' );
  7. const files = [
  8. path.join( __dirname, '../static/extensions.js' )
  9. ];
  10. module.exports = {
  11. name: 'bender-ckeditor5',
  12. attach() {
  13. this.plugins.addFiles( files );
  14. this.on( 'test:created', ( test ) => {
  15. const moduleRegExp = /^([^\/]+)\//;
  16. let name = test.displayName.replace( /^dist\/amd\/tests\//, '' );
  17. let module = name.match( moduleRegExp );
  18. if ( module ) {
  19. test.tags.unshift( 'module!' + module[ 1 ] );
  20. test.displayName = name.replace( moduleRegExp, '$1: ' );
  21. } else {
  22. test.tags.unshift( 'module!ckeditor5' );
  23. test.displayName = 'ckeditor5: ' + name.replace( /^ckeditor5\//, '' );
  24. }
  25. } );
  26. this.pagebuilders.add( 'ckeditor5', build );
  27. function build( data ) {
  28. files.forEach( ( file ) => {
  29. data.addJS( path.join( '/plugins/', file ).split( path.sep ).join( '/' ) );
  30. } );
  31. return data;
  32. }
  33. }
  34. };