Hi!
First of all, thank you for this wonderful add-on!
I recently discovered that the opacity of the colored overlay in the "flashcard" theme is very high – sometimes to the point where you'll even see color banding.
However, this only occurred for one note type I was using. I did some investigating and I think I found the problematic code:
The problem occurs when the onLoad function and will thus add multiple visualFeedback items for every position. I confirmed this with inspector and a few debug logs.
I suggest checking if an element exists before adding it.
function onLoad() {
for (const pos of ["top", "bottom", "left", "right"]) {
// check if the element exists before adding it
if (
document.getElementsByClassName(`visualFeedback ${pos}`).length > 0
) {
continue;
}
const div = visualFeedbackDiv();
div.classList.add(pos);
}
}
Implementing this check fixed the issue for me.
The note type in question (which is actually a modified AnKing note type) is manually dispating a window load, which in turn causes the onLoad function to be called multiple times. Of course it would be best to avoid multiple window load events alltogether… but some note types / extensions may rely on that, so a tiny check on load like this is be the most robust solution.
While this bug is most noticeable for the "flashcard" theme as it featured semi-transparent elements, the general problem should apply to all themes (not tested though).
If you would like to, I can open a pr with changes to all themes.
Hi!
First of all, thank you for this wonderful add-on!
I recently discovered that the opacity of the colored overlay in the "flashcard" theme is very high – sometimes to the point where you'll even see color banding.
However, this only occurred for one note type I was using. I did some investigating and I think I found the problematic code:
The problem occurs when the
onLoadfunction and will thus add multiplevisualFeedbackitems for every position. I confirmed this with inspector and a few debug logs.I suggest checking if an element exists before adding it.
Implementing this check fixed the issue for me.
The note type in question (which is actually a modified AnKing note type) is manually dispating a window load, which in turn causes the
onLoadfunction to be called multiple times. Of course it would be best to avoid multiple window load events alltogether… but some note types / extensions may rely on that, so a tiny check on load like this is be the most robust solution.While this bug is most noticeable for the "flashcard" theme as it featured semi-transparent elements, the general problem should apply to all themes (not tested though).
If you would like to, I can open a pr with changes to all themes.