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

Style dropdown: styles definitions without classes property (renaming elements) #15031

Closed
Kocal opened this issue Sep 20, 2023 · 5 comments
Closed
Labels
domain:v4-compatibility This issue reports a CKEditor 4 feature/option that's missing in CKEditor 5. package:style resolution:expired This issue was closed due to lack of feedback. type:improvement This issue reports a possible enhancement of an existing feature.

Comments

@Kocal
Copy link
Contributor

Kocal commented Sep 20, 2023

📝 Provide detailed reproduction steps (if any)

  1. Add a custom style without the classes property:
// ... 
style: {
  definitions: [
    { name: 'title (h2)', element: 'h2' },
  ]
}
// ...
  1. Try to open the styles dropdown:
image
  1. See the following error:
image

✔️ Expected result

What is the expected result of the above steps?

The styles dropdown should be visible.

❌ Actual result

What is the actual result of the above steps?

The styles dropdown is not visible, due to the missing classes property.

❓ Possible solution

If you have ideas, you can list them here. Otherwise, you can delete this section.

It should be possible to define styles without specifying classes property, if the style does not need CSS classes.

If classes is really required, we should have a proper error message telling us that classes property is missing (which will be more useful than Cannot read properties from undefined (reading 'value')

📃 Other details

  • Browser: …
  • OS: …
  • First affected CKEditor version: 39.0.2
  • Installed CKEditor plugins: …

If you'd like to see this fixed sooner, add a 👍 reaction to this post.

@Kocal Kocal added the type:bug This issue reports a buggy (incorrect) behavior. label Sep 20, 2023
@Witoso
Copy link
Member

Witoso commented Sep 25, 2023

Hi, changing to a feature improvement. Style dropdown was thought as a feature to add classes, not rename elements. For the example that you shared, the heading customization option looks like an ideal solution.

@Witoso Witoso added type:improvement This issue reports a possible enhancement of an existing feature. package:style and removed type:bug This issue reports a buggy (incorrect) behavior. labels Sep 25, 2023
@Witoso Witoso changed the title Definitions styles are broken if classes property is missing Style dropdown: styles definitions without classes property (renaming elements) Sep 25, 2023
@Witoso
Copy link
Member

Witoso commented Sep 25, 2023

@Kocal
Copy link
Contributor Author

Kocal commented Sep 25, 2023

Hello, well I'm sorry, I think this is kind of my fault, now that I migrated our custom-editor source code to TypeScript (I was using JSDoc before), my IDE/tsc shows me an error if I remove the classes property:
image

I could also have seen it in the API documentation of StyleDefiniton, but this is a bit less friendly than a sentence "The following properties are required to create a new StyleDefiniton (...)` in the Feature Style documentation.

Indeed, we will use headings for my h2 example, it's just we are migrating from CKEditor 4 to 5 and I wanted to change a few things as possible.

Thanks!

@Witoso Witoso added the domain:v4-compatibility This issue reports a CKEditor 4 feature/option that's missing in CKEditor 5. label Sep 25, 2023
@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. 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 resolution:expired This issue was closed due to lack of feedback. and removed status:stale labels Nov 1, 2024
@CKEditorBot CKEditorBot closed this as not planned Won't fix, can't repro, duplicate, stale Nov 1, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
domain:v4-compatibility This issue reports a CKEditor 4 feature/option that's missing in CKEditor 5. package:style resolution:expired This issue was closed due to lack of feedback. type:improvement This issue reports a possible enhancement of an existing feature.
Projects
None yet
Development

No branches or pull requests

3 participants