diff --git a/src/dialogs/editor/index.tsx b/src/dialogs/editor/index.tsx index 1246782..3a68fbf 100644 --- a/src/dialogs/editor/index.tsx +++ b/src/dialogs/editor/index.tsx @@ -5,7 +5,6 @@ import { createRoot } from "react-dom/client"; import Citation from "../../cita/citation"; import Wikicite from "../../cita/wikicite"; import { compareSemVer } from "semver-parser"; -import ZoteroOverlay from "../../cita/zoteroOverlay"; import WikiciteChrome from "../../cita/wikiciteChrome"; import PID from "../../cita/PID"; @@ -119,9 +118,19 @@ window.addEventListener("load", () => { const itemBoxLabel = document.createElement("h4"); itemBoxLabel.textContent = "Target"; //Wikicite.getString("wikicite.editor.title"); container.appendChild(itemBoxLabel); - // "item-box" was renamed to "info-box" in Zotero 7.0.10. We compare to 7.0.9 to include the beta versions. - const tagName = - compareSemVer(Zotero.version, "7.0.9") === 1 ? "info-box" : "item-box"; + // "item-box" was renamed to "info-box" in Zotero 7.0.10, so check if we have at least this version of Zotero. + let semVerCompare: number; + try { + semVerCompare = compareSemVer(Zotero.version, "7.0.10"); + } catch (e) { + // Zotero.version is not a valid semver string + // This may happen when installing certain beta versions or building Zotero from source, so we treat it as if it is at least Zotero 7.0.10 + Zotero.log( + `Zotero version (${Zotero.version}) is not a valid semver string - maybe you installed a beta version or built it from source? Treating this version of Zotero as at least 7.0.10.`, + ); + semVerCompare = 1; + } + const tagName = semVerCompare >= 0 ? "info-box" : "item-box"; const itemBox = document.createElementNS( "http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul", tagName, diff --git a/translators/zotkat b/translators/zotkat new file mode 160000 index 0000000..ece06e4 --- /dev/null +++ b/translators/zotkat @@ -0,0 +1 @@ +Subproject commit ece06e457def61ab749d27c2d9be51b07d72d25a