Docs: Create a feature (plugin) development guide showcasing an advanced feature
Is this a bug report or feature request? (choose one)
Other
💻 Version of CKEditor
CKEditor 5
📋 Steps to reproduce
Hi Colleagues, More than bug, this is a "how to do" Request. We have a requirement to render HTML5 tags like input, dropdown, calender pick up and build extra label divs around it. ( as if custom controls) . I went through the CKeditor documentation, And tried to understand the architecture and design. I really appriciate the details provided.
But I would be of great help if one sample is available for the above scenarios as an example for people who want to extend the CKeditor5. Also mentioning as in which files to change and where to add the custom views would help in building it correctly.
Thanks in advance for your guidance. Also if any such github or solution is available, please point me to them.
✅ Expected result
❎ Actual result
📃 Other details that might be useful
What you need is a set of custom plugins for each kind of content you'd like to use in the editor. Each plugin (feature) will have 2 parts:
-
FeatureEditingin this part you will define the content in the model's schema and define the converters from the model to the data and view (downcast) and from the data to the model (DB to model – upcast). You should also get familiar with the editing engine architecture to understand what you do. -
FeatureUIin this part you will define toolbar buttons, dropdowns, balloons (whatever you want) that will allow you to insert and edit the content you declared in theFeatureEditingpart.
A very simple example of the plugin can be found here, although it doesn't define the editing part and it will not be enough in your case.
I assume that the controls you want to insert are not editable in the editor content, so they will probably be widgets. What you should do is analyze out the code of 2 core features that use widgets: image and media–embed to learn how to use widgets in you plugins. You'll copy&paste a lot from those plugins.
Personally, I find the simple example leaves a lot to be desired because it just reuses another plugin that does all of the grunt work.
-
There's no clear direction on how to use Widget without scouring thru code.
-
No explanation of why plugins are broken up into 2 parts (UI/Editing). I am assuming separation of concerns.
-
There's a lot of API usage with very little explanation. Even comments in the code for what each function does would be a huge improvement.
I know v5 is new so it's understandable. That said, it'd be nice if an advanced example was broken down fully, similar to what Quill does. Preferably it'd also be nice to see an example without Widget for comparison sake.
- No explanation of why plugins are broken up into 2 parts (UI/Editing). I am assuming separation of concerns. *
Other than that, I agree that this must be a journey down the rabbit hole for the outsiders because CKEditor 5 is no longer a standalone app but a framework allowing to do a lot of crazy stuff and with a hight level of complexity exactly for that reason.
I stand corrected @oleq thanks for the link.
BTW, some good news in https://twitter.com/reinmarpl/status/1085204333350842369:

Two new tutorials were published:
- https://ckeditor.com/docs/ckeditor5/latest/framework/guides/tutorials/implementing-a-block-widget.html
- https://ckeditor.com/docs/ckeditor5/latest/framework/guides/tutorials/implementing-an-inline-widget.html
They cover many advanced topics around widgets (the most often implemented type of plugin). There's still a lot to cover, of course, but for that we need more specific tickets.