fix: initialize existing editors on plugin reload
This commit is contained in:
parent
c561657472
commit
7162f249fe
|
|
@ -19,6 +19,7 @@ export function registerEditorInstanceHook() {
|
|||
},
|
||||
},
|
||||
);
|
||||
Zotero.Notes._editorInstances.forEach(onEditorInstanceCreated);
|
||||
}
|
||||
|
||||
async function onEditorInstanceCreated(editor: Zotero.EditorInstance) {
|
||||
|
|
|
|||
|
|
@ -10,10 +10,10 @@ export function initEditorMenu(editor: Zotero.EditorInstance) {
|
|||
const makeId = (key: string) =>
|
||||
`${config.addonRef}-editor-menu-${editor.instanceID}-${key}`;
|
||||
// Prevent duplicate menu items
|
||||
if (editor._popup.getAttribute("bn-init") === "true") {
|
||||
if (editor._popup.getAttribute("bn-init") === addon.data.uid) {
|
||||
return;
|
||||
}
|
||||
editor._popup.setAttribute("bn-init", "true");
|
||||
editor._popup.setAttribute("bn-init", addon.data.uid);
|
||||
(editor._popup as XUL.Menu).addEventListener("popupshowing", (ev) => {
|
||||
const menuitemID = makeId("resizeImage");
|
||||
if (
|
||||
|
|
|
|||
Loading…
Reference in New Issue