Both sides previous revisionPrevious revisionNext revision | Previous revision |
dev:zotero_7_for_developers [2024/12/14 01:42] – [Other Platform Changes] dstillman | dev:zotero_7_for_developers [2025/02/02 06:38] (current) – [XUL Overlays → bootstrap.js] dstillman |
---|
===== Dev Builds ===== | ===== Dev Builds ===== |
| |
<HTML><!--<span style="color: red; font-weight: bold">WARNING:</span></html> These are test builds based on Firefox 115 intended solely for use by Zotero plugin developers and **should not be used in production**. We strongly recommend using a [[https://www.zotero.org/support/kb/multiple_profiles|separate profile and data directory]] for development.--></HTML> | <html><span style="color: red; font-weight: bold">WARNING:</span></html> These are test builds based on Firefox 128 intended solely for use by Zotero plugin developers and **should not be used in production**. We strongly recommend using a [[https://www.zotero.org/support/kb/multiple_profiles|separate profile and data directory]] for development. |
| |
The ''dev'' channel has been paused. Use [[:beta_builds|Zotero 7 beta builds]] for development. | The ''dev'' channel has been paused. Use [[:beta_builds|Zotero 7 beta builds]] for development. |
| |
<HTML><!-- * [[https://www.zotero.org/download/client/dl?channel=dev&platform=mac|Mac]] | <HTML><!-- |
| * [[https://www.zotero.org/download/client/dl?channel=dev&platform=mac|Mac]] |
* [[https://www.zotero.org/download/client/dl?channel=dev&platform=linux-x86_64|Linux 64-bit]] | * [[https://www.zotero.org/download/client/dl?channel=dev&platform=linux-x86_64|Linux 64-bit]] |
* [[https://www.zotero.org/download/client/dl?channel=dev&platform=win-x64-zip|Windows 64-bit ZIP]] | * [[https://www.zotero.org/download/client/dl?channel=dev&platform=win-x64-zip|Windows 64-bit ZIP]] |
* [[https://www.zotero.org/download/client/dl?channel=dev&platform=win-x64|Windows 64-bit Installer]] | * [[https://www.zotero.org/download/client/dl?channel=dev&platform=win-x64|Windows 64-bit Installer]] |
| * [[https://www.zotero.org/download/client/dl?channel=dev&platform=win-arm64-zip|Windows ARM64 ZIP]] |
| * [[https://www.zotero.org/download/client/dl?channel=dev&platform=win-arm64|Windows ARM64 Installer]] |
* [[https://www.zotero.org/download/client/dl?channel=dev&platform=win32-zip|Windows 32-bit ZIP]] | * [[https://www.zotero.org/download/client/dl?channel=dev&platform=win32-zip|Windows 32-bit ZIP]] |
* [[https://www.zotero.org/download/client/dl?channel=dev&platform=win32|Windows 32-bit Installer]] | * [[https://www.zotero.org/download/client/dl?channel=dev&platform=win32|Windows 32-bit Installer]]--></HTML> |
--></HTML> | |
===== Sample Plugin ===== | ===== Sample Plugin ===== |
| |
Since Zotero is based on Firefox, it's possible to use the Firefox Developer Tools to interact with the DOM, set code breakpoints, follow network requests, and more. | Since Zotero is based on Firefox, it's possible to use the Firefox Developer Tools to interact with the DOM, set code breakpoints, follow network requests, and more. |
| |
Zotero 7 beta builds include the Firefox 115 devtools. To start a beta build with the Browser Toolbox open, pass the ''-jsdebugger'' flag on the command line: | Zotero 7 beta builds include the Firefox 128 devtools. To start a beta build with the Browser Toolbox open, pass the ''-jsdebugger'' flag on the command line: |
| |
<code> | <code> |
Note that Zotero 6 provides a ''resourceURI'' nsIURI object instead of a ''rootURI'' string, so for Zotero 6 compatibility you'll want to assign ''resourceURI.spec'' to ''rootURI'' if ''rootURI'' isn't provided. | Note that Zotero 6 provides a ''resourceURI'' nsIURI object instead of a ''rootURI'' string, so for Zotero 6 compatibility you'll want to assign ''resourceURI.spec'' to ''rootURI'' if ''rootURI'' isn't provided. |
| |
In Zotero 7, the ''install()'' and ''startup()'' bootstrap methods are called only after Zotero has initialized, and the ''Zotero'' object is automatically made available in the bootstrap scope, along with ''Services'', ''Cc'', ''Ci'', and other Mozilla and browser objects. This isn't the case in Zotero 6, in which these functions can load before the ''Zotero'' object is available and won't automatically get ''window'' properties such as ''URL''. (''Zotero'' also isn't available in ''uninstall()'' in Zotero 6.) The sample plugin provides an example of [[https://github.com/zotero/make-it-red/blob/main/src-1.2/bootstrap.js|waiting for availability of the ''Zotero'' object]] and [[https://github.com/zotero/make-it-red/blob/main/src-1.2/lib.js|importing global properties]] in a bootstrapped plugin that works in both Zotero 6 and 7. | In Zotero 7, the ''install()'' and ''startup()'' bootstrap methods are called only after Zotero has initialized, and the ''Zotero'' object is automatically made available in the bootstrap scope, along with ''Services'', ''Cc'', ''Ci'', and other Mozilla and browser objects. This isn't the case in Zotero 6, in which these functions can load before the ''Zotero'' object is available and won't automatically get ''window'' properties such as ''URL''. (''Zotero'' also isn't available in ''uninstall()'' in Zotero 6.) The sample plugin provides an example of [[https://github.com/zotero/make-it-red/blob/main/src-1.2/bootstrap.js|waiting for availability of the ''Zotero'' object]] and [[https://github.com/zotero/make-it-red/blob/main/src-1.2/make-it-red.js|importing global properties]] in a bootstrapped plugin that works in both Zotero 6 and 7. |
| |
Bootstrapped plugins can be disabled or uninstalled without restarting Zotero, so you'll need to make sure you remove all functionality in the ''shutdown()'' function. | Bootstrapped plugins can be disabled or uninstalled without restarting Zotero, so you'll need to make sure you remove all functionality in the ''shutdown()'' function. |
==== Custom Item Tree Columns ==== | ==== Custom Item Tree Columns ==== |
| |
Zotero 7 beta 23 adds an API for creating custom columns in the item tree. The item tree is widely used in Zotero for displaying a table of items (e.g., the items list in the main library view and the search results in the Advanced Search window). | Zotero 7 adds an API for creating custom columns in the item tree. The item tree is widely used in Zotero for displaying a table of items (e.g., the items list in the main library view and the search results in the Advanced Search window). |
| |
If you were previously using monkey-patching to add custom columns in Zotero 6, please switch to using the official API in Zotero 7. | If you were previously using monkey-patching to add custom columns in Zotero 6, please switch to using the official API in Zotero 7. |
==== Custom Reader Event Handlers ==== | ==== Custom Reader Event Handlers ==== |
| |
Zotero 7 beta 40 adds an API for creating custom reader event handlers. Available event types are: | Zotero 7 adds an API for creating custom reader event handlers. Available event types are: |
| |
* ''renderTextSelectionPopup'': inject DOM event, triggered when the selection popup is rendered | * ''renderTextSelectionPopup'': inject DOM event, triggered when the selection popup is rendered |
The following list includes nearly all Mozilla changes that affected Zotero code. You may encounter other breaking changes if you use APIs not used in Zotero. [[https://searchfox.org/|Searchfox]] is the best resource for identifying current correct usage in Mozilla code and changes between Firefox 60 and Firefox 128. | The following list includes nearly all Mozilla changes that affected Zotero code. You may encounter other breaking changes if you use APIs not used in Zotero. [[https://searchfox.org/|Searchfox]] is the best resource for identifying current correct usage in Mozilla code and changes between Firefox 60 and Firefox 128. |
| |
Earlier Zotero 7 beta releases were based on Firefox 102, so we've listed changes for Firefox 102 and Firefox 115 separately. An upcoming beta will be based on Firefox 128. | Earlier Zotero 7 beta releases were based on Firefox 102, so we've listed changes for Firefox 102, 115, and 128 separately. |
| |
=== Firefox 60 → Firefox 102 === | === Firefox 60 → Firefox 102 === |