Closed kieranlblack closed 4 months ago
A small issue I found is that if I open the add notes window, and a note type without the tone colours css is opened by default, if I then switch to a note type with the tone colours css it won't show the colours in the editor window unless I close and reopen the window.
The number of times this would actually be an issue should be quite small, although it is a bit confusing.
Hmm, would you mind sending a gif of the behaviour. I'm having difficulty reproducing the issue, this seems to be what you are describing:
There does actually seem to be some sort of issue with the font though.
I see, good catch. I have been able to reproduce the issue, I will look into what is causing it.
The components are not being remounted so the onMount
hook where we inject the styling is not being refired. I will continue looking tomorrow if I have time.
I have made a little progress, the css should now definitely update and you won't see the bug you were seeing before. However, there is a race condition which has stumped me causing the userBase
css to sometimes get wiped out resulting in most noticeably the font family and size not getting set correctly in the editor.
You can see it looks kind of strange here:
Made a post about this on the forums.
https://forums.ankiweb.net/t/customstyles-strange-behaviour/37432
Good idea, hopefully some anki guru will come with some input. I tried looking at it for a while yesterday, but js isn't really my strong suit.
It looks like nobody has weighed in on the post I made yet. I think I'm going to implement the fix I had in the post and then open a PR for Anki and see what dae thinks there.
Sounds good.
Otherwise I suggest we revert to 7faaf71 since that was at least an improvement, and then log the remaining bug in a new issue.
@Gustaf-C just as a heads up, the fix for the issue with the custom style in Anki was merged in the other day so when the next Anki release is cut we should be able to merge this PR in 🥳
Great! ~I'll try to remember to merge this once the next Anki version is released~
Edit: I don't know why I would wait, I'll just merge it in now and wait with the release :)
@Gustaf-C Ah, I guess I probably would've waited to avoid introducing known buggy code. We don't really know when the next Anki version will drop and now we are in a position where any bug fixes / features we want to push before it does will include this change unless we add a version check.
Yeah I know that it might become problematic in some cases, but it's the easiest way for me to make sure that the addon works well with the latest Anki version. If we want to push something else before the next Anki release I'll figure it out when we get there. If I regret doing it I'll just remember that the next time :)
The primary issue was that the way the tone css was being injected no longer worked for the current version of Anki. This commit modifies things to inject css in the proper manner.
Closes #3.