Skip to content
This repository has been archived by the owner on Jun 26, 2020. It is now read-only.

Commit

Permalink
Check if context plugins requires only context plugins.
Browse files Browse the repository at this point in the history
  • Loading branch information
Piotr Jasiun authored and oskarwrobel committed Dec 2, 2019
1 parent 8abffb3 commit 11f35e4
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion src/plugincollection.js
Original file line number Diff line number Diff line change
Expand Up @@ -281,6 +281,14 @@ export default class PluginCollection {
PluginConstructor.requires.forEach( RequiredPluginConstructorOrName => {
const RequiredPluginConstructor = getPluginConstructor( RequiredPluginConstructorOrName );

if ( PluginConstructor.isContextPlugin && !RequiredPluginConstructor.isContextPlugin ) {
throw new CKEditorError(
'plugincollection-context-required: Context plugin can not require plugin which is not context plugin',
null,
{ plugin: RequiredPluginConstructor.name, requiredBy: PluginConstructor.name }
);
}

if ( removePlugins.includes( RequiredPluginConstructor ) ) {
/**
* Cannot load a plugin because one of its dependencies is listed in the `removePlugins` option.
Expand All @@ -293,7 +301,7 @@ export default class PluginCollection {
'plugincollection-required: Cannot load a plugin because one of its dependencies is listed in' +
'the `removePlugins` option.',
editor,
{ plugin: RequiredPluginConstructor, requiredBy: PluginConstructor }
{ plugin: RequiredPluginConstructor.name, requiredBy: PluginConstructor.name }
);
}

Expand Down

0 comments on commit 11f35e4

Please sign in to comment.