ckeditor5 icon indicating copy to clipboard operation
ckeditor5 copied to clipboard

Docs: Create a feature (plugin) development guide showcasing an advanced feature

Open iridescentapps opened this issue 7 years ago • 6 comments

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

iridescentapps avatar Jan 08 '19 03:01 iridescentapps

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:

  • FeatureEditing in 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.

  • FeatureUI in 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 the FeatureEditing part.

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.

oleq avatar Jan 09 '19 16:01 oleq

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.

chimon2000 avatar Jan 09 '19 21:01 chimon2000

  • No explanation of why plugins are broken up into 2 parts (UI/Editing). I am assuming separation of concerns. *

It's explained here.

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.

oleq avatar Jan 10 '19 11:01 oleq

I stand corrected @oleq thanks for the link.

chimon2000 avatar Jan 10 '19 18:01 chimon2000

BTW, some good news in https://twitter.com/reinmarpl/status/1085204333350842369:

image

Reinmar avatar Jan 15 '19 16:01 Reinmar

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.

Reinmar avatar Mar 25 '19 14:03 Reinmar