fix: editor menu resizeImage duplication bug
This commit is contained in:
parent
98636bca00
commit
5a4bdc72bf
|
|
@ -15,10 +15,14 @@ export function initEditorMenu(editor: Zotero.EditorInstance) {
|
||||||
}
|
}
|
||||||
editor._popup.setAttribute("bn-init", "true");
|
editor._popup.setAttribute("bn-init", "true");
|
||||||
(editor._popup as XUL.Menu).addEventListener("popupshowing", (ev) => {
|
(editor._popup as XUL.Menu).addEventListener("popupshowing", (ev) => {
|
||||||
if (isImageAtCursor(editor)) {
|
const menuitemID = makeId("resizeImage");
|
||||||
|
if (
|
||||||
|
!(editor._popup as XUL.Menu).querySelector(`#${menuitemID}`) &&
|
||||||
|
isImageAtCursor(editor)
|
||||||
|
) {
|
||||||
ztoolkit.Menu.register(editor._popup, {
|
ztoolkit.Menu.register(editor._popup, {
|
||||||
tag: "menuitem",
|
tag: "menuitem",
|
||||||
id: makeId("resizeImage"),
|
id: menuitemID,
|
||||||
classList: [config.addonRef],
|
classList: [config.addonRef],
|
||||||
label: getString("menuEditor.resizeImage"),
|
label: getString("menuEditor.resizeImage"),
|
||||||
icon: `chrome://${config.addonRef}/content/icons/favicon.png`,
|
icon: `chrome://${config.addonRef}/content/icons/favicon.png`,
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue