-
-
Notifications
You must be signed in to change notification settings - Fork 3.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Affect plugins loading order without creating strict requirements #2907
Comments
Yeah, I think I discussed this recently with someone. A different option appeared, AFAIR, but in general, the same concept. So 👍 for doing this. I think the other option could be to have all in the |
OK, @pjasiun reminded me that in https://github.com/ckeditor/ckeditor5-core/issues/148 we already added "by name" support in So, I'm actually hesitating now. If the order of plugins is the only problem here, then until we really see a need for something more I'd use Of course, this mechanism must not be abused because you can create chains of "do X if Y", "do Y if Z", etc., but this is usually easy – you can postpone making decisions how your feature should behave to later stages (e.g. command's refresh logic) and then you completely untangle two features. Also, a completely extreme version of a chain is a loop of requirements and even soft requires would not be a solution here. You need to make reasonable decisions when implementing relations between features. Finally, I think that the "soft requirement" mechanism has a very narrow application – only to cases where a dependent plugin knows precisely with which other plugins it should work. In most cases this isn't true – e.g. So, let's wait for a clear signal that we miss something. |
Plot twist: I've been analysing https://github.com/ckeditor/ckeditor5-core/issues/148 and I was right by thinking we don't support string requirements. This ticket didn't actually introduce them :D I'll create a new ticket for that concept. |
Another plot twist: I proposed to get rid of soft requirements (in the sense we used them in the past) completely to acknowledge the current state of things: https://github.com/ckeditor/ckeditor5-core/issues/193. |
Read like a good novel with so much plot twists :D |
Ha! Another plot twist. We will probably have to loosen some
|
Again, the same finding as before IIRC:
Last changes: https://github.com/ckeditor/ckeditor5/compare/dll-integration...i/2907?expand=1 |
After a F2F talk, we agreed that there's no need to introduce new |
Internal: Plugin collection will allow to require plugin by name when it is provided in `config.plugins` or if it was already loaded. Closes #2907.
Closed with 9c24fca. |
Other: Enabled creating builds that can be extended (with more plugins) without the need to being recompiled. This required splitting the project into the, so-called, DLL part and consumers of this DLL. Under the hood, the mechanism is based on [webpack DLLs](https://webpack.js.org/plugins/dll-plugin/). This is the first part of the required changes and it contains the necessary breaking changes (see the "MAJOR BREAKING CHANGES" section above). For more information see the ["DLL builds"](https://ckeditor.com/docs/ckeditor5/latest/builds/guides/development/dll-builds.html) guide. Closes [#8395](#8395). Other: Introduced `Image.isImageWidget()` utility method. Feature (core): Plugin collection will allow to require plugin by name when it is provided in `config.plugins` or if it was already loaded. Closes [#2907](#2907). MAJOR BREAKING CHANGE: Several plugins are not anymore loaded automatically as dependencies of other plugins. From now on, they need to be provided to the editor creator manually (via `config.plugins`). This list includes: - The `CloudServicesUploadAdapter` plugin no longer loads `CloudServices`. Make sure to add `CloudServices` to the editor plugins when using the `CloudServicesUploadAdapter` or `EasyImage` features. - The `EasyImage` plugin no longer loads `Image` and `ImageUpload`. Make sure to add `Image` and `ImageUpload` to the editor plugins when using the `EasyImage` feature. - The `CKFinder` plugin no longer loads `CKFinderUploadAdapter`. The `CKFinderEditing` plugin no longer loads `ImageEditing` and `LinkEditing` features. Make sure to add `CKFinderUploadAdapter`, `Image`, and `Link` features to the editor plugins when using the `CKFinder` feature. - The `Title` plugin no longer loads `Paragraph`. Make sure to add `Paragraph` to the editor plugins when using the `Title` feature. - The `ListEditing` plugin no longer loads `Paragraph`. Make sure to add `Paragraph` to the editor plugins when using the `List` feature. - The `LinkImageEditing` plugin no longer loads `ImageEditing`. Make sure to add `Image` to the editor plugins when using the `LinkImage` feature. - The `LinkImageUI` plugin no longer loads `Image`. Make sure to add `Image` to the editor plugins when using the `LinkImage` feature. - The `ExportPdf` plugin no longer loads `CloudServices`. Make sure to add `CloudServices` to the editor plugins when using the `ExportPdf` feature. - The `ExportWord` plugin no longer loads `CloudServices`. Make sure to add `CloudServices` to the editor plugins when using the `ExportWord` feature.
We already touched this topic here, but it was not implemented then.
Currently, when one plugin requires another plugin you can be sure about two things:
However, sometimes we need only the second part. Another plugin is not necessary, but if it is loaded we want it to be initialized before our plugin. Currently
afterInit
needs to be used what is far from a perfect solution. My proposal is to introduce soft requirements:It means that if the plugin
B
is not loaded then pluginA
shows no errors nor warnings. However, if pluginB
is loaded, then it is initialized before pluginA
, the same way, as it would be a requirement.Note, that I am not sure about "Soft requirements" name nor about
softRequires
method name. Feel free to propose a better name.The text was updated successfully, but these errors were encountered: