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

[TS] PoC of using types in Vue integration #13545

Closed
arkflpc opened this issue Feb 24, 2023 · 7 comments · Fixed by ckeditor/ckeditor5-vue#244
Closed

[TS] PoC of using types in Vue integration #13545

arkflpc opened this issue Feb 24, 2023 · 7 comments · Fixed by ckeditor/ckeditor5-vue#244
Assignees
Labels
domain:ts squad:core Issue to be handled by the Core team.

Comments

@arkflpc
Copy link
Contributor

arkflpc commented Feb 24, 2023

Part of #13471.

@arkflpc arkflpc added the squad:core Issue to be handled by the Core team. label Feb 24, 2023
@CKEditorBot CKEditorBot added the status:planned Set automatically when an issue lands in the "Sprint backlog" column. We will be working on it soon. label Feb 24, 2023
@filipsobol filipsobol self-assigned this Mar 9, 2023
@CKEditorBot CKEditorBot added status:in-progress Set automatically when an issue lands in the "In progress" column. We are working on it. status:planned Set automatically when an issue lands in the "Sprint backlog" column. We will be working on it soon. and removed status:planned Set automatically when an issue lands in the "Sprint backlog" column. We will be working on it soon. status:in-progress Set automatically when an issue lands in the "In progress" column. We are working on it. labels Mar 9, 2023
@Witoso
Copy link
Member

Witoso commented Mar 13, 2023

The result of PoC:

  • Vue project using vue integration (updated in [TS] Migrate Vue integration to use generated typings #13543) and alpha.1 release. On ckeditor5 repo in the dedicated branch.
  • Write down how the integration went. What steps happened, etc. what was not obvious, did it help, in what, we could later reuse it in guides for this dedicated technology and in TS blog post.

@CKEditorBot CKEditorBot added status:in-progress Set automatically when an issue lands in the "In progress" column. We are working on it. and removed status:planned Set automatically when an issue lands in the "Sprint backlog" column. We will be working on it soon. labels Mar 20, 2023
@filipsobol
Copy link
Member

New Vue demo project was added in ckeditor/ckeditor5-vue#244

@filipsobol
Copy link
Member

filipsobol commented Mar 21, 2023

The Vue integration should work exactly as it did before the updates, but it now requires Editor version 37 or later.

If developers have their IDEs set up properly for Vue.js development (e.g., by installing Volar and TypeScript Vue Plugin in VS Code), the new version should provide much better code suggestion and completion, and should show errors if passed props are of the wrong type.

The new demo in the repository shows how to use the integration and gives an example of using all the props and events available in the component.

Component name suggestion:

Error when required editor prop is missing:

Prop suggestions:

Events suggestions:

@CKEditorBot CKEditorBot removed the status:in-progress Set automatically when an issue lands in the "In progress" column. We are working on it. label Mar 22, 2023
@CKEditorBot CKEditorBot added this to the upcoming milestone Mar 22, 2023
@Reinmar
Copy link
Member

Reinmar commented Mar 22, 2023

Out of curiosity: Why do you have <Ckeditor> (and not <ckeditor>) on these screenshots? I can see you used <ckeditor> in the sample itself, but got curious anyway.

@filipsobol
Copy link
Member

Short answer: <Ckeditor> and <ckeditor> are the same thing for Vue, and both will work.

Long answer: The official recommendation from the Vue team is to use PascalCase or kebab-case for Vue components, so that they can be easily distinguished from regular HTML elements. To follow this recommendation (and make eslint happy), I changed the name of the components from <ckeditor> to <Ckeditor>. Either name will work, so it won't make any difference in consuming projects, except that <Ckeditor> will be the default suggested by the IDE (see the first screenshot in my comment above).

Another recommendation is to use multi-word names to avoid potential conflicts when new HTML elements are introduced in the future (e.g. using todo-item instead of generic item). Following this recommendation would be a breaking change, so I choose to ignore it.

@Reinmar
Copy link
Member

Reinmar commented Mar 22, 2023

Would Vue accept <CKEditor>?

It hurts my eyes when I see <Ckeditor> :D I understand we can't do much with how it's suggested by the IDE but maybe let's at least have it written acceptably in the docs/examples.

@filipsobol
Copy link
Member

@Reinmar Unfortunately, changing the name of the component to CKEditor would be a breaking change. Each capital letter is treated as the beginning of a new word. Ckeditor is equal to ckeditor and TodoItem is equal to todo-item, so CKEditor would be c-k-editor.

@Reinmar Reinmar modified the milestones: upcoming, iteration 61 Mar 24, 2023
pomek added a commit to ckeditor/ckeditor5-vue that referenced this issue Mar 29, 2023
Feature: Improve typings for events emitted by the Vue component.

Internal: Add Vue linter and apply suggestions.

Internal: Update demo project to better reflect real-world usage. Closes ckeditor/ckeditor5#13545.

MAJOR BREAKING CHANGE: Integration now requires Editor version 37 or later.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
domain:ts squad:core Issue to be handled by the Core team.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants