index.js 1.2 KB

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