From 156950c820df5beeec5c94927cafa4e7dcc40fd5 Mon Sep 17 00:00:00 2001 From: David Tod Date: Wed, 28 Feb 2024 17:22:24 -0500 Subject: [PATCH] 0.7.5 fixed bug when changing the location of the preview element --- ZoteroPreview7.xpi | Bin 8959 -> 9137 bytes ZoteroPreview7/manifest.json | 2 +- ZoteroPreview7/zoteropreview.js | 30 ++++++++++++++++----- ZoteroPreview7/zoteropreview7-updates.json | 2 +- 4 files changed, 25 insertions(+), 9 deletions(-) diff --git a/ZoteroPreview7.xpi b/ZoteroPreview7.xpi index 5c8587dc3609351f99efe0c711e3d8d3a44357f4..eb41643a7cabe6642bf7a0a3a305ef53687cca41 100644 GIT binary patch delta 4685 zcmV-T60+_8MX^T=P)h>@6aWAK005+lu?*(|2$+goSfas2rjz>uDFK4BB?AZte|Cyo zSfutV9k~zy04Xy701yBG0D5n9WpZzDa%FaDWp^%WbIn?9bK5o&{_M{5KOoFqNlhin za+BPQ6}i_s>Dis6&DCk{rb))7NJv6W5iCJUQBwc++g$)8NK;ANmzncqViN=wi+z1| z!B0Q=NtV2j;amEZ7knf5md)6^e@{O-5Xmvisx%$K-y2>iA+u(nkh1*ohx2AYWTF&N zD&BHfwun;2aWqO2o;*(ZnrG$tBX!JPzQ*CWDhe36D0eAuNSM*{lCOIQ&mT3zmzgZZ zLh!;JG;9R#m`H}q@H}LOS9U$1a~+5U3(A#Hp~Lfl6}+s9Y>E@~%LL>gf0Aav(1TI) zSM$p5Ftd9(WSTwTby-v#-(4GaQ@IS*YH1iV%1HRUS_WQAC&$cVpEI0lm&32|nBg95 z8z~lLEXwmjM)3*;qmpf9am7Il^QvS@WHD!&JQJnj>4H^?E2dBbYQ=e}hU}beLDFn1 zN=?GqumeWL%*sfF#UWm%RKcF2#oH=VwvIgF%>>c~h${cQLLpCiV61JPG`_xqz+w0h`Up z6!f07DZYTsTFc{tM`mw$78MGvAPo3c=BLeWdbcLO2?@2 zP;HjpfMs%2@Eka1F|f;vDI2Zj+YxMC@;Bu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7/manifest.json b/ZoteroPreview7/manifest.json index 3315814..a128a0d 100644 --- a/ZoteroPreview7/manifest.json +++ b/ZoteroPreview7/manifest.json @@ -1,7 +1,7 @@ { "manifest_version": 2, "name": "ZoteroPreview", - "version": "0.7.4", + "version": "0.7.5", "description": "Citation preview pane for Zotero.", "homepage_url": "https://github.com/dcartertod/zotero-plugins", "applications": { diff --git a/ZoteroPreview7/zoteropreview.js b/ZoteroPreview7/zoteropreview.js index c142774..588402d 100644 --- a/ZoteroPreview7/zoteropreview.js +++ b/ZoteroPreview7/zoteropreview.js @@ -47,19 +47,29 @@ Zotero.zoteropreview = { positionpref = Zotero.Prefs.get('extensions.zoteropreview.position', true); } + this.log(positionpref); + var mainDocument = Zotero.getActiveZoteroPane().document; var target = mainDocument.getElementById(positionpref); this.log(target); - var zpdiv = mainDocument.getElementById('zotero-preview-container'); - this.log(zpdiv); + var zpdivContainer = mainDocument.getElementById('zotero-preview-container'); + Zotero.debug('zpdivContainer done'); + // it appears that if we move a collapsible element, it loses it's contents + this.log('zpdiv'); + var zpdiv = mainDocument.getElementById('zotero-preview'); if (zpdiv == null){ - this.log('adding div') - // Add the div, and put it into a collapsible container + this.log('adding zpdiv'); zpdiv = mainDocument.createElement('div'); zpdiv.id = 'zotero-preview'; + this.storeAddedElement(zpdiv); + } + Zotero.debug('zpdiv done'); + + if (zpdivContainer == null){ + this.log('adding zpdivContainer') zpdivContainer = mainDocument.createXULElement("collapsible-section"); zpdivContainer.id='zotero-preview-container'; @@ -67,13 +77,13 @@ Zotero.zoteropreview = { zpdivContainer.open=""; zpdivContainer.label='Preview'; zpdivContainer.dataset.pane="preview"; - zpdivContainer.appendChild(zpdiv); this.log('adding span'); this.log('storing elements'); // Add a stylesheet to the main Zotero pane - based on make-it-red // see _collapsibleSection.scss + // this is how the icons are done let link1 = mainDocument.createElement('link'); this.log('link1'); link1.id = 'zotero-preview-stylesheet'; @@ -85,9 +95,14 @@ Zotero.zoteropreview = { this.storeAddedElement(link1); this.storeAddedElement(zpdivContainer); - this.storeAddedElement(zpdiv); } + + this.log('appending container to target') target.after(zpdivContainer); + + // basic order of operations thing here. add the div after adding the container to the main document + this.log('appending zpdiv to zpdivContainer'); + zpdivContainer.appendChild(zpdiv); // this.addIcon(); this.log('store') @@ -121,7 +136,7 @@ Zotero.zoteropreview = { doc.getElementById(id)?.remove(); } try { - doc.querySelector('#zotero-preview')?.remove(); + doc.querySelector('#zotero-preview-container')?.remove(); } catch(err){ this.log(err); @@ -153,6 +168,7 @@ Zotero.zoteropreview = { } }, + // the way this works is that you register with the Zotero Notifier, which then calls the "notify" function notify(event, _type, ids, extraData) { Zotero.debug('not sure if there is an event for selecting an item in the main pane'); this.log(event); diff --git a/ZoteroPreview7/zoteropreview7-updates.json b/ZoteroPreview7/zoteropreview7-updates.json index ca5aaf6..22b2a9d 100644 --- a/ZoteroPreview7/zoteropreview7-updates.json +++ b/ZoteroPreview7/zoteropreview7-updates.json @@ -3,7 +3,7 @@ "zoteropreview@carter-tod.com": { "updates": [ { - "version": "0.7.4", + "version": "0.7.5", "update_link": "https://raw.githubusercontent.com/dcartertod/zotero-plugins/main/ZoteroPreview7.xpi", "applications": { "zotero": {