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

Add API to register vue.js components from plugins in 3.5 (vue3) #9494

Closed
jardakotesovec opened this issue Nov 9, 2023 · 2 comments · Fixed by #9496 · May be fixed by pkp/ops#593
Closed

Add API to register vue.js components from plugins in 3.5 (vue3) #9494

jardakotesovec opened this issue Nov 9, 2023 · 2 comments · Fixed by #9496 · May be fixed by pkp/ops#593
Assignees
Labels
Bug:2:Moderate A bug that is causing problems for a substantial minority of users.
Milestone

Comments

@jardakotesovec
Copy link
Contributor

jardakotesovec commented Nov 9, 2023

Issue

In Vue2 there was one global Vue instance (available via pkp.Vue) that allowed to globally register components and that was possible to use also from plugins.

In Vue3 there is no global Vue instance, where would be possible to globally register components.New vue instance is created everytime it needs to be mounted (can be multiple times on one page until we have fully vue.js app) and therefore also the global components are registered for each instance.

Solution

Create new API available to the plugins

pkp.registry.registerComponent('componentName', component);
pkp.registry.getComponent('componentName);

Additionally expose vue module (to be able to use advance functions from vue, including composition api) via

pkp.modules.vue
@jardakotesovec jardakotesovec self-assigned this Nov 9, 2023
@jardakotesovec jardakotesovec added the Bug:2:Moderate A bug that is causing problems for a substantial minority of users. label Nov 9, 2023
@jardakotesovec jardakotesovec added this to the 3.5 Internal milestone Nov 9, 2023
jardakotesovec added a commit to jardakotesovec/pkp-lib that referenced this issue Nov 9, 2023
- Add API for component registry from plugins
- Expose vue module globally
@jardakotesovec jardakotesovec changed the title Add mechanism to register vue.js components from plugin in Vue3 Add API to register vue.js components from plugins in 3.5 (vue3) Nov 9, 2023
@jardakotesovec
Copy link
Contributor Author

pkp-lib: #9496
ops (just to run tests): pkp/ops#593

@touhidurabir Would you mind do the code review? After this is merged you would use pkp.registry.registerComponent instead of pkp.Vue.component.

@jonasraoni Could you please also have a quick look? Thanks!

jardakotesovec added a commit that referenced this issue Nov 14, 2023
- Add API for component registry from plugins
- Expose vue module globally
@jardakotesovec
Copy link
Contributor Author

Merged

ipula pushed a commit to ipula/pkp-lib that referenced this issue Dec 4, 2023
- Add API for component registry from plugins
- Expose vue module globally
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug:2:Moderate A bug that is causing problems for a substantial minority of users.
Projects
None yet
1 participant