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

Is having definitions.xxx.classes mandatory by intention? #16737

Open
garvinhicking opened this issue Jul 16, 2024 · 7 comments
Open

Is having definitions.xxx.classes mandatory by intention? #16737

garvinhicking opened this issue Jul 16, 2024 · 7 comments
Labels
type:question This issue asks a question (how to...).

Comments

@garvinhicking
Copy link

📝 Ask a question

Having a configuration like this (asking for the context of a default TYPO3 implementation):

editor:
  config:
    style:
      definitions:
        # block level styles
        - { name: 'Orange title H2', element: 'h2', classes: ['orange'] }
        - { name: 'Orange title H3', element: 'h3', classes: ['orange'] }
        - { name: 'Quote / Citation', element: 'blockquote', classes: [''] }
        - { name: 'Code block', element: 'code', classes: ['']  }
        # Inline styles
        - { name: 'Yellow marker', element: 'span', classes: ['yellow-marker'] }

it seems that classes is a required attribute. Also https://ckeditor.com/docs/ckeditor5/latest/api/module_style_styleconfig-StyleDefinition.html does not really mention it as being optional. Leaving such an attribute out leads to the dropdown for styles not getting opened.

If the attribute is required, I wonder how one could implement an empty <code> element. Currently, always <code class=""> is emitted.

Also, when using classes: [] to indicate an empty array, the element is not choosable at all. Using classes: false|null|true only leads to having <code class="false|null|true">.

So I wonder, am I missing something here, or would it classify as a bug?

@garvinhicking garvinhicking added the type:question This issue asks a question (how to...). label Jul 16, 2024
@Witoso
Copy link
Member

Witoso commented Sep 19, 2024

For now Style dropdown doesn't insert elements, it just adds classes to existing elements. Most likely, you would want it to insert as well, +1 the following ticket #14372.

@Witoso Witoso added the pending:feedback This issue is blocked by necessary feedback. label Sep 19, 2024
@CKEditorBot
Copy link
Collaborator

The issue lacks the feedback we asked for two weeks. Hence, 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.

@garvinhicking
Copy link
Author

Which feedback did you ask?! Happy to provide any.

@Witoso
Copy link
Member

Witoso commented Oct 4, 2024

Just let us know if the ticket we sent is something that covers your need, and we will close this one as a duplicate :)

@garvinhicking
Copy link
Author

Ah I see! I just saw this as related, not a duplicate.

If I understand correctly, the other issue is about properly getting the "context" of the style dropdown and allowing to insert new elements when inside the context of another?

My issue here is about the ability to insert "pure" elements, without requiring an (empty) class selector.

IMO those two are distinct issues, but then again I'm not deep into the code 😇

@CKEditorBot CKEditorBot removed status:stale pending:feedback This issue is blocked by necessary feedback. labels Oct 4, 2024
@Witoso
Copy link
Member

Witoso commented Oct 7, 2024

Then I wonder why not use a proper button of the feature like code? Multiple access points to insert the same thing could be confusing, and I'm curious what's the use case and your thoughts here.

@garvinhicking
Copy link
Author

The reason is to group style-related custom choices in a single "point of truth", which would be the style dropdown.

Also, emitting <div class=""> as it is currently really looks odd and more like a bug than intention.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type:question This issue asks a question (how to...).
Projects
None yet
Development

No branches or pull requests

3 participants