diff --git a/src/events.ts b/src/events.ts index 2b1348c..42a376a 100644 --- a/src/events.ts +++ b/src/events.ts @@ -681,7 +681,10 @@ class AddonEvents extends AddonBase { const noteEditor = _window.document.getElementById("zotero-note-editor"); t = 0; - while (!noteEditor.getCurrentInstance() && t < 500) { + while ( + (!noteEditor.getCurrentInstance || !noteEditor.getCurrentInstance()) && + t < 500 + ) { t += 1; await Zotero.Promise.delay(10); } diff --git a/src/views.ts b/src/views.ts index 3a03cdc..f7b33af 100644 --- a/src/views.ts +++ b/src/views.ts @@ -298,6 +298,7 @@ class AddonViews extends AddonBase { } moreButton.setAttribute("knowledgeinit", "true"); const addAnnotationNoteButton = _document.createElement("div"); + addAnnotationNoteButton.setAttribute("style", "margin: 5px;"); addAnnotationNoteButton.innerHTML = this.editorIcon["addAnnotationNote"]; let annotationWrapper = moreButton; @@ -367,10 +368,13 @@ class AddonViews extends AddonBase { e.preventDefault(); }); addAnnotationNoteButton.addEventListener("mouseover", (e: XULEvent) => { - e.target.setAttribute("style", "background: #F0F0F0;"); + addAnnotationNoteButton.setAttribute( + "style", + "background: #F0F0F0; margin: 5px;" + ); }); addAnnotationNoteButton.addEventListener("mouseout", (e: XULEvent) => { - e.target.removeAttribute("style"); + addAnnotationNoteButton.setAttribute("style", "margin: 5px;"); }); moreButton.before(addAnnotationNoteButton); updateCount += 1;