Skip to content
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

Widget conversion helper methods #7823

Closed
piernik opened this issue Aug 12, 2020 · 11 comments
Closed

Widget conversion helper methods #7823

piernik opened this issue Aug 12, 2020 · 11 comments
Labels
domain:dx This issue reports a developer experience problem or possible improvement. package:widget resolution:expired This issue was closed due to lack of feedback. squad:core Issue to be handled by the Core team. status:stale type:feature This issue reports a feature request (an idea for a new functionality or a missing option).

Comments

@piernik
Copy link

piernik commented Aug 12, 2020

I want to create card bootstrap widget (https://getbootstrap.com/docs/4.5/components/card/).

If I want to create widget out of it I need to change my convertion and from this:

conversion.elementToElement({
            model: 'cardHeader',
            view: {
                name: 'h5',
                classes: 'card-header'
            }
        });

I have to write this:

conversion.for('upcast').elementToElement({
            model: 'cardHeader',
            view: {
                name: 'h5',
                classes: 'card-header'
            }
        });
        conversion.for('dataDowncast').elementToElement({
            model: 'cardHeader',
            view: {
                name: 'h5',
                classes: 'card-header'
            }
        });
        conversion.for('editingDowncast').elementToElement({
            model: 'cardHeader',
            view: (modelElement, viewWriter) => {
                // Note: You use a more specialized createEditableElement() method here.
                const h1 = viewWriter.createEditableElement('h5', {class: 'card-header'});

                return toWidgetEditable(h1, viewWriter);
            }
        });

There is much repetition.
I think that helper functions should be introduced like:
elementToWidget(config, editor); // if editor is needed
elementToWidgetEditable(config, editor);

@piernik piernik added the type:feature This issue reports a feature request (an idea for a new functionality or a missing option). label Aug 12, 2020
@Reinmar
Copy link
Member

Reinmar commented Oct 5, 2020

Big 👍  from me. Adding this to the DX squad's backlog. This way or another we should simplify this.

@Reinmar Reinmar added squad:dx domain:dx This issue reports a developer experience problem or possible improvement. package:widget labels Oct 5, 2020
@Reinmar Reinmar added this to the nice-to-have milestone Oct 5, 2020
@Reinmar
Copy link
Member

Reinmar commented Oct 5, 2020

Related feature: #1012.

@jodator
Copy link
Contributor

jodator commented Oct 5, 2020

Question: How to enhance conversion.for() from Widget feature?

Another idea: expose it on the Widget plugin.

Things to remember:

  • use it in existing widget features
  • update the block and inline widget tutorials

@jodator jodator added the intro Good first ticket. label Oct 5, 2020
@jodator
Copy link
Contributor

jodator commented Oct 12, 2020

conversion.for().add( widget.elementToWidget() )
// or import
conversion.for().add( elementToWidget() )

@Reinmar
Copy link
Member

Reinmar commented Oct 12, 2020

In #1012 I'm discussing with myself whether toWidget() should end up in the Widget plugin instance or whether we should already predict that we'll have something like CKE5.widget.utils....

@jodator
Copy link
Contributor

jodator commented Oct 16, 2020

Duplicate detected: #1228. My comments in #1228 didn't age well. The helper looks like needed but its implementation might be cumbersome because the widget system is a separate feature and the covnersion is a "core" feature.

@Reinmar Reinmar modified the milestones: nice-to-have, iteration 38 Oct 26, 2020
@jodator
Copy link
Contributor

jodator commented Nov 2, 2020

Depends on the outcome of #667.

@Reinmar Reinmar modified the milestones: iteration 38, nice-to-have Nov 6, 2020
@maxbarnas maxbarnas removed the intro Good first ticket. label Dec 14, 2020
@Reinmar Reinmar changed the title Widget helper methods Widget conversion helper methods Jan 27, 2021
@Reinmar Reinmar removed the squad:dx label Sep 9, 2021
@piernik
Copy link
Author

piernik commented Oct 18, 2021

@jodator @Reinmar more then a year have passed and we still don't have good and easy tools or tutorial how to create good widget plugins :/ I know that You focus on paid functionalities, but please help us.
I still didn't convert from ckeditor@4 :/

@Reinmar Reinmar added the squad:core Issue to be handled by the Core team. label Oct 28, 2021
@pomek pomek removed this from the nice-to-have milestone Feb 21, 2022
@idiazroncero
Copy link

The verbosity of this is a problem: you need to create three conversions for each element on your widget, which can easily become a nightmare (imagine a widget with 5,6,7 elements! that's up to 21 conversions to write and maintain...)

Huge +1 to any kind of helper, automation or any other way to write the same on a more structured, less repetitive way.

@CKEditorBot
Copy link
Collaborator

There has been no activity on this issue for the past year. We've marked it as stale and will close it in 30 days. We understand it may still be relevant, so if you're interested in the solution, leave a comment or reaction under this issue.

@CKEditorBot
Copy link
Collaborator

We've closed your issue due to inactivity over the last year. We understand that the issue may still be relevant. If so, feel free to open a new one (and link this issue to it).

@CKEditorBot CKEditorBot added the resolution:expired This issue was closed due to lack of feedback. label Nov 24, 2023
@CKEditorBot CKEditorBot closed this as not planned Won't fix, can't repro, duplicate, stale Nov 24, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
domain:dx This issue reports a developer experience problem or possible improvement. package:widget resolution:expired This issue was closed due to lack of feedback. squad:core Issue to be handled by the Core team. status:stale type:feature This issue reports a feature request (an idea for a new functionality or a missing option).
Projects
None yet
Development

No branches or pull requests

7 participants