-
Notifications
You must be signed in to change notification settings - Fork 13
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
Vue 3 ready? #49
Comments
Wish owner answer this |
Unfortunately I'm not familiar with Vue 3 and I don't have the time to learn it right now, but if someone would submit a PR, I'd be happy to merge it. That said, note that in the current version of MathLive, a mathfield is just a |
Honestly, this was not well documented. I am having a hard time setting this up. Vue 3. The imports don't even seem to work. The example had to be from CDN? Such good promise for this library. I will keep searching. |
@tobychidi Did you manage to implement Mathlive in Vue 3? I'm currently having the same problem, and I'm not quite sure how to get it to work... |
@ViridityCorn Oh My! I did. I actually integrated it into an editor and it works so well. Here are the steps:
|
Thanks @tobychidi for the detailed information. |
So many thanks @tobychidi ! It also looks like quite an interesting project, you've been working on! |
@ViridityCorn accessing mathField in your script... You can simply use refs. The usual ref special attribute. It's value would be the name as your |
@tobychidi Thanks, of course! |
@tobychidi-zz Hi Toby, when I import |
@hwynand you do not need to import this CSS file, you can just skip that. |
Hi @arnog , thanks for your great works. Unfortunately the import error happened with |
Hi @huongphamx, were you able to solve the error? I just ran into the same thing. |
@tobychidi-zz do you mind sharing your code snippet? I am getting the same issue as @huongphamx |
@arnog , firstly, thanks for the awesome work with this wonderful library! Looking at Stack Overflow and GitHub, it seems that quite a lot of people are having hard time setting this project up with vite and Vue. The reality is, that majority of people want to set it up with an npm package and documentation for this is not clear at the moment. Would it be possible to get some pointers on how it's intended to be used with npm and Vue? |
Unfortunately, I am far from an expert in Vue and Vite. It would be great if someone from the community with more expertise than I have could contribute some instructions. FYI, someone has recently filed an issue that may contain useful information. I would appreciate it if you could have a look at it, and let me know if this is something that you find useful and that I should consider integrating into the documentation: arnog/mathlive#2191 |
Thanks for the pointer! For some reason, I get an error, but it might be Vue / my project specific. I'll try to solve it or create a minimalistic reproduction.
I think that if we have a solid guide for getting it to work with npm, then the community can follow up on the Vue/React/Angular/Svelte/... implementations. What people are doing, is using the "plain javascript" version to load the MathLive in their framework-specific lifecycle hook, when the component has been loaded. I do advise on putting the "plain javascript" setup with npm in Getting Started section so people can get started quickly with npm and their chosen framework. This Stack Overlow issue was created just last month, pointing out the issue. I created a simple stackblitz. I think if the code in there were to be in Getting Started guide, then it would help out. I'll try to create a PR on the weekend to the main repo. The aim would be to end up with something like this: https://www.npmjs.com/package/@recogito/annotorious If you open it up in the npm registry, then the users have pretty clear instructions on how to get started. |
The Getting Started page is here: https://cortexjs.io/mathlive/guides/getting-started/ I welcome any suggestions for improving it! To be clear, there is no need to create a Or are you suggesting that creating the BTW, there is also a React-specific guide (https://cortexjs.io/mathlive/guides/react/) but it would be great to have something similar for Vue3 (or Angular, or...). |
Oh, there is also a section on creating |
@arnog Not necessary to create it for other frameworks. The documentation for npm installation is currently just a bit misleading:
As long as there's a guide on how to get it to work properly with npm, html and javascript, then the rest should be the worry for people using this library. This framework works quite well, but it's just a habit for people. Most of the libraries require people to initialize it themselves. There's quite a lot of documentation and it's easy to miss the fact that the library initializes itself onto the I propose the following change to the documentation:
Perhaps this project should also convert to a source code for the wrapper instead of being an example that links to a minified wrapper. That way people can understand the wrapper better and it would be easy to contribute here if any updates or functionalities are needed. Probably would need some extra work to get the wrapper up on npm, but worth thinking about. I also created a working example for Vue 3: arnog/mathlive#2191 (comment) |
Thanks for submitting a PR. I've merged it. Do you mean a wrapper like this: https://github.com/arnog/vue-mathlive ? |
Yes, but the only place where I found the actual wrapper implementation was in the index.html Is there a repository for the original non-minified version and how can people contribute to it? The community could help with making PR-s to make it Vue 3 compatible, add improvements, or just copy the wrapper and use it in their project. With the current setup, I don't see a good way. |
Yes, the source for the wrapper is here: https://github.com/arnog/mathlive/blob/master/src/vue-mathlive.js |
Does that mean, that when the wrapper in the main repository is updated to Vue 3 and developers use https://unpkg.com/mathlive/dist/vue-mathlive.mjs , it will be broken for the old users? Perhaps the version should be specified in the example? Such as https://unpkg.com/[email protected]/dist/vue-mathlive.mjs . I'll make a PR for this. Better yet, perhaps developers could use it from the package they have downloaded via npm? That way they can get the code automatically updated? Probably needs types in https://github.com/arnog/mathlive/tree/master/src/public if they use typescript? Is there a reason why there's currently dependency in package.json to mathlive? Disclaimer. Not an expert on bundlers and library development, just a developer who uses Vite to generate projects and usually doesn't take deep dives on how the dependency is added, whether it's tree shaked, etc. |
The sample code seems to be for Vue 2. Can I possibly use it in Vue 3? Thanks for suggestions.
The text was updated successfully, but these errors were encountered: