8
0

plugin.js 676 B

1234567891011121314151617181920212223242526272829
  1. /**
  2. * @license Copyright (c) 2003-2015, CKSource - Frederico Knabben. All rights reserved.
  3. * For licensing, see LICENSE.md.
  4. */
  5. /* global define */
  6. 'use strict';
  7. // Plugin for RequireJS to properly load CKEditor plugins through the "plugin!name" scheme:
  8. // "plugin!name" => "node_modules/ckeditor5-plugin-name/name"
  9. define( 'plugin', function() {
  10. return {
  11. load: function( name, require, onload ) {
  12. var path = name.split( '/' );
  13. path.splice( 1, 0, 'src' );
  14. if ( path.length === 2 ) {
  15. path.push( path[ 0 ] );
  16. }
  17. path = '../../ckeditor5-plugin-' + path.join( '/' );
  18. require( [ path ], function( value ) {
  19. onload( value );
  20. } );
  21. }
  22. };
  23. } );