|
@@ -9,21 +9,28 @@
|
|
|
|
|
|
|
|
// Plugin for RequireJS to properly load CKEditor plugins through the "plugin!name" scheme:
|
|
// Plugin for RequireJS to properly load CKEditor plugins through the "plugin!name" scheme:
|
|
|
// "plugin!name" => "node_modules/ckeditor5-plugin-name/name"
|
|
// "plugin!name" => "node_modules/ckeditor5-plugin-name/name"
|
|
|
-define( 'plugin', function() {
|
|
|
|
|
- return {
|
|
|
|
|
- load: function( name, require, onload ) {
|
|
|
|
|
- var path = name.split( '/' );
|
|
|
|
|
- path.splice( 1, 0, 'src' );
|
|
|
|
|
|
|
+//
|
|
|
|
|
+// Due to name conflict with the "ckeditor5-core/plugin" module, a workaround was needed. In this case, we extend the
|
|
|
|
|
+// core Plugin class with the necessary RequireJS plugin methods. This should have no harm on the use of the Plugin
|
|
|
|
|
+// class.
|
|
|
|
|
|
|
|
- if ( path.length === 2 ) {
|
|
|
|
|
- path.push( path[ 0 ] );
|
|
|
|
|
- }
|
|
|
|
|
|
|
+define( 'plugin', [ 'plugin-core' ], function( CorePlugin ) {
|
|
|
|
|
+ // Called when a "plugin!" module is to be loaded.
|
|
|
|
|
+ // http://requirejs.org/docs/plugins.html#apiload
|
|
|
|
|
+ CorePlugin.load = function( name, require, onload ) {
|
|
|
|
|
+ var path = name.split( '/' );
|
|
|
|
|
+ path.splice( 1, 0, 'src' );
|
|
|
|
|
|
|
|
- path = '../../ckeditor5-plugin-' + path.join( '/' );
|
|
|
|
|
-
|
|
|
|
|
- require( [ path ], function( value ) {
|
|
|
|
|
- onload( value );
|
|
|
|
|
- } );
|
|
|
|
|
|
|
+ if ( path.length === 2 ) {
|
|
|
|
|
+ path.push( path[ 0 ] );
|
|
|
}
|
|
}
|
|
|
|
|
+
|
|
|
|
|
+ path = '../../ckeditor5-plugin-' + path.join( '/' );
|
|
|
|
|
+
|
|
|
|
|
+ require( [ path ], function( value ) {
|
|
|
|
|
+ onload( value );
|
|
|
|
|
+ } );
|
|
|
};
|
|
};
|
|
|
|
|
+
|
|
|
|
|
+ return CorePlugin;
|
|
|
} );
|
|
} );
|