-
Notifications
You must be signed in to change notification settings - Fork 2
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
✨ Custom Fonts #96
✨ Custom Fonts #96
Conversation
e39d652
to
e64d325
Compare
Thanks for another contribution. It looks good, but I see one issue, where the font selection doesn't change automatically back to Sans Serif when you select plain text.
If you try it on the official site, it seems to work correctly: This isn't a big deal, so if we can't figure it out, that's ok. Also, I see you are using Yarn, which is ok, but the "pnpm-lock.yaml" file should be updated before merging. If you don't want to use pnpm, I can update the file before merging. I'm not too picky on coding, so its usually fine as long as it works, and doesn't mess up anyone's existing notes. |
f85d6ab
to
227c277
Compare
Hi, @nienow, I believe the problem was that I forgot to set a default format for Quill at the beginning of code. I’ve now included a default format with the The only serious problem seems to be that I needed to roll-back Quill to 1.3.7, as with 2.0.2 version, when adding a new line, the selected font is not persisted and the editor assumes a default unknown font, but as far as I know, this problem is also happening in the playground you just shared, so it may be a bug from the framework itself. I would like to request you to please take a look, once you've the needed time, of course, as you're way more experienced than me. Regarding the package manager, given your substantial experience in web development, as demonstrated by your repositories, could you kindly provide a brief overview of why you opt for pnpm over yarn v2 (or npm) and what makes it your preferred option? |
For the package manager. I was using yarn for a while, and I still like it the concept of it, but I had issues with certain projects or libraries using the "pnp" mode. And changing to the "node-modules" mode seemed like it wasn't any better than using "npm". The reason I like "pnpm" is that I have a lot of projects on my computer, and many of them use the same dependencies. pnpm only downloads a dependency once, caches it, and then uses a symbolic link in each project, so it is faster and uses less file space. It also uses the same node_modules format as npm so there is no compatibility issues. I will look at the code changes later. |
That's dope! I knew that Yarn V2 offers the
Take your time, @nienow, and thank you in advance. |
I found the default Font whitelist for quill in their code, and it is So I tried putting false as the default value in a simple example, and it seems like it solves the issue, without any of the other extra code. I was running a simple example here: https://stackblitz.com/edit/stackblitz-starters-zgrzbr?file=index.html I wish the documentation was better, because this is not easy to figure out! One more thing, I have the default font set to be whatever the standard notes theme is set to: |
Hi, @nienow! First of all, thank you for introducing me to the Stackblitz. I was unaware of its existence, and it seems to be a great tool to play with. Unfortunately, I couldn't achieve the same behavior with the I've committed a patch that adds an entry to the fonts array to denote the |
I pushed some changes. I think the main change needed was the removing the |
Hi, @nienow, I tested it locally, and everything seems to be working great! However, just to let you know, I did notice that when we choose a custom font and press enter to add a new line, the font reverts to Default. If this is the behavior you intended, I’m totally fine with it! |
That is annoying. And actually in v1, it looks like it still maintains the Font, it just says "Default" until you start typing. But it v2, it was actually changed to reset all format settings on Enter press: slab/quill#3428. People were complaining about this change. It looks like if we want to stick with v2, we can override the enter key handler to make it act like v1. Not sure what else we can do. |
Another option regarding the enter key handler could be to check the HTML element value whenever Quill doesn't have a font value, like I did here. I'm pretty sure it's not the best approach in terms of performance, though. It's up to you, @nienow. We can go back to version 1.3.7 until this issue is handled in v2. |
I added the code in the enter key handle to make it keep the selected font after pressing enter, and re-upgraded to v2. I think this is the best way, even though its not perfect. Can you test one more time? |
Hi, @nienow, first of all, sorry for the delay. I'm currently on vacation, so I can't test it out locally. But I totally trust your expertize! Feel free to merge it, and I'll start using the new version on my phone right away. |
Hi, @nienow, as I said on #95, I would like to start contributing more to your repositories as I love Standard Notes product. I'm more a CI guy than a software developer, especially when it comes to frontend stuff, but I've hope that, with your help and guidance, I can make some good progresses.
This PR is an attempt to bring custom fonts to your Quill plugin, based on the code that you have already developed. Please take a look when you've the time and let me know what changes I must make to align it more closely with your standards.