fix: add annotation to note bug

This commit is contained in:
xiangyu 2022-05-08 23:33:01 +08:00
parent b38c1ceeaa
commit 2f31c7db06
2 changed files with 10 additions and 3 deletions

View File

@ -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);
}

View File

@ -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;