Skip to content

Commit

Permalink
citekey display -- of sorts
Browse files Browse the repository at this point in the history
  • Loading branch information
retorquere committed Apr 29, 2024
1 parent 46282e1 commit ee4bb0e
Show file tree
Hide file tree
Showing 8 changed files with 30 additions and 20 deletions.
29 changes: 17 additions & 12 deletions content/ZoteroItemPane.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,18 +46,23 @@ export class ZoteroItemPane {

if (!this.document.getElementById('better-bibtex-editpane-item-box')) {
if (is7) {
/*
itemBox.parentNode.parentNode.parentNode.appendChild(elements.create('html:div', { style: 'display: flex; flex-direction: column;' , $: [
elements.create('html:div', { id: 'better-bibtex-editpane-item-box', style: 'display: flex; flex-direction: row', $: [
elements.create('label', { id: 'better-bibtex-citekey-label', style: 'flex: 0 0 auto; width: 9em; text-align: right; color: #7F7F7F', value: '' }),
elements.create('html:input', { id: 'better-bibtex-citekey-display', type: 'text', style: 'flex: 0 0 auto', readonly: 'true', value: '' }),
]}),
itemBox.parentNode.parentNode,
]}))
*/
log.debug('waiting for API to insert citekey in itempane')
Zotero.ItemPaneManager.registerSection({
paneID: 'betterbibtex-section-citationkey',
pluginID: 'better-bibtex@iris-advies.com',
header: {
l10nID: 'example-item-pane-header',
icon: `${rootURI}content/skin/citation-key.png`,
},
sidenav: {
l10nID: 'example-item-pane-header',
icon: `${rootURI}content/skin/citation-key.png`,
},
bodyXHTML: 'Citation Key <html:input type="text" id="better-bibtex-citation-key" readonly="true" style="position:relative;width:80%" xmlns:html="http://www.w3.org/1999/xhtml"/>',
// onRender: ({ body, item, editable, tabType }) => {
onRender: ({ body, item }) => {
body.ownerDocument.getElementById('better-bibtex-citation-key').value = item.getField('citationKey') || '\u274C'
},
})
}
else {
itemBox.parentNode.appendChild(elements.create('vbox', { flex: 1, style: 'margin: 0; padding: 0', $: [
Expand Down
3 changes: 3 additions & 0 deletions content/bootstrap.ts
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,9 @@ export async function startup({ resourceURI, rootURI = resourceURI.spec }, reaso
target: {
Zotero,

// because the Zotero sample code assumes you're doing everything in bootstrap.js
rootURI,

// to pacify libraries that do env-detection
window: Zotero.getMainWindow(),
document: Zotero.getMainWindow().document,
Expand Down
2 changes: 1 addition & 1 deletion site/themes/relearn
2 changes: 1 addition & 1 deletion submodules/babel
2 changes: 1 addition & 1 deletion submodules/biber
Submodule biber updated 2 files
+0 −8 bin/biber
+16 −5 lib/Biber/Config.pm
2 changes: 1 addition & 1 deletion submodules/biblatex
8 changes: 5 additions & 3 deletions typings/global.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -70,11 +70,13 @@ interface ZoteroItem {
toJSON: () => import('../gen/typings/serialized-item').Item
}

// https://stackoverflow.com/questions/39040108/import-class-in-definition-file-d-ts
declare const Zotero: {
[attr: string]: any
type GlobalBBT = {
// https://stackoverflow.com/questions/39040108/import-class-in-definition-file-d-ts
BetterBibTeX: import('../content/better-bibtex').BetterBibTeX
}
type ZoteroObject = GlobalBBT & Omit<Record<string, any>, keyof GlobalBBT>
declare const Zotero: ZoteroObject

declare const Components: any
declare const Services: any
declare const rootURI: string

0 comments on commit ee4bb0e

Please sign in to comment.