Fix Create Bibliography
listbox is gone, but richlistbox is still here as a custom element and works fine for cases where we don't need virtualization. groupbox label and richlistitem styles should probably be copied to somewhere global once tuned a bit.
This commit is contained in:
parent
4c21a42b53
commit
547311ff26
5 changed files with 35 additions and 20 deletions
|
@ -30,7 +30,7 @@
|
|||
//////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
// Class to provide options for bibliography
|
||||
// Used by rtfScan.xul, integrationDocPrefs.xul, and bibliography.xul
|
||||
// Used by rtfScan.xul, integrationDocPrefs.xul, and bibliography.xhtml
|
||||
|
||||
Components.utils.import("resource://gre/modules/Services.jsm");
|
||||
var Zotero_File_Interface_Bibliography = new function() {
|
||||
|
@ -50,8 +50,10 @@ var Zotero_File_Interface_Bibliography = new function() {
|
|||
* @param {Object} [args] - Explicit arguments in place of window arguments
|
||||
*/
|
||||
this.init = Zotero.Promise.coroutine(function* (args = {}) {
|
||||
window.addEventListener('dialogaccept', () => this.acceptSelection());
|
||||
|
||||
// Set font size from pref
|
||||
// Affects bibliography.xul and integrationDocPrefs.xul
|
||||
// Affects bibliography.xhtml and integrationDocPrefs.xul
|
||||
var bibContainer = document.getElementById("zotero-bibliography-container");
|
||||
if(bibContainer) {
|
||||
Zotero.setFontSize(document.getElementById("zotero-bibliography-container"));
|
||||
|
@ -86,7 +88,7 @@ var Zotero_File_Interface_Bibliography = new function() {
|
|||
var styles = Zotero.Styles.getVisible();
|
||||
var selectIndex = null;
|
||||
for (let i=0; i < styles.length; i++) {
|
||||
var itemNode = document.createElement("listitem");
|
||||
var itemNode = document.createXULElement("richlistitem");
|
||||
itemNode.setAttribute("value", styles[i].styleID);
|
||||
let title = styles[i].title;
|
||||
// Add acronyms to APA and ASA to avoid confusion
|
||||
|
@ -94,7 +96,7 @@ var Zotero_File_Interface_Bibliography = new function() {
|
|||
title = title
|
||||
.replace(/^American Psychological Association/, "American Psychological Association (APA)")
|
||||
.replace(/^American Sociological Association/, "American Sociological Association (ASA)");
|
||||
itemNode.setAttribute("label", title);
|
||||
itemNode.append(title);
|
||||
listbox.appendChild(itemNode);
|
||||
|
||||
if(styles[i].styleID == _io.style) {
|
||||
|
@ -132,7 +134,7 @@ var Zotero_File_Interface_Bibliography = new function() {
|
|||
Zotero_File_Interface_Bibliography.styleChanged();
|
||||
}, 0);
|
||||
|
||||
// ONLY FOR bibliography.xul: export options
|
||||
// ONLY FOR bibliography.xhtml: export options
|
||||
if(document.getElementById("save-as-rtf")) {
|
||||
var settings = Zotero.Prefs.get("export.bibliographySettings");
|
||||
try {
|
||||
|
@ -245,7 +247,7 @@ var Zotero_File_Interface_Bibliography = new function() {
|
|||
}
|
||||
|
||||
//
|
||||
// For bibliography.xul
|
||||
// For bibliography.xhtml
|
||||
//
|
||||
|
||||
// Change label to "Citation" or "Note" depending on style class
|
||||
|
@ -320,7 +322,7 @@ var Zotero_File_Interface_Bibliography = new function() {
|
|||
|
||||
|
||||
this.manageStyles = function () {
|
||||
document.documentElement.getButton('cancel').click();
|
||||
document.querySelector('dialog').getButton('cancel').click();
|
||||
var win = Zotero.Utilities.Internal.openPreferences('zotero-prefpane-cite', { tab: 'styles-tab' });
|
||||
if (isDocPrefs) {
|
||||
Zotero.Utilities.Internal.activate(win);
|
||||
|
|
|
@ -2,19 +2,22 @@
|
|||
<?xml-stylesheet href="chrome://global/skin/" type="text/css"?>
|
||||
<?xml-stylesheet href="chrome://zotero/skin/bibliography.css"?>
|
||||
<!DOCTYPE window SYSTEM "chrome://zotero/locale/zotero.dtd">
|
||||
<dialog xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
|
||||
title="&zotero.bibliography.title;" buttons="cancel,accept"
|
||||
ondialogaccept="Zotero_File_Interface_Bibliography.acceptSelection()"
|
||||
id="zotero-bibliography"
|
||||
|
||||
<window
|
||||
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
|
||||
title="&zotero.bibliography.title;"
|
||||
onload="Zotero_File_Interface_Bibliography.init()">
|
||||
<dialog
|
||||
buttons="cancel,accept"
|
||||
id="zotero-bibliography">
|
||||
|
||||
<script src="include.js"/>
|
||||
<script src="bibliography.js"/>
|
||||
|
||||
<vbox id="zotero-bibliography-container">
|
||||
<groupbox>
|
||||
<caption label="&zotero.bibliography.style.label;"/>
|
||||
<listbox id="style-listbox" onselect="Zotero_File_Interface_Bibliography.styleChanged()"/>
|
||||
<label>&zotero.bibliography.style.label;</label>
|
||||
<richlistbox id="style-listbox" onselect="Zotero_File_Interface_Bibliography.styleChanged()"/>
|
||||
<hbox align="right">
|
||||
<label id="manage-styles" class="text-link"
|
||||
onclick="Zotero_File_Interface_Bibliography.manageStyles()">&zotero.bibliography.manageStyles;</label>
|
||||
|
@ -22,19 +25,19 @@
|
|||
</groupbox>
|
||||
<groupbox>
|
||||
<hbox align="center">
|
||||
<caption label="&zotero.bibliography.locale.label;"/>
|
||||
<label>&zotero.bibliography.locale.label;</label>
|
||||
<menulist id="locale-menu" oncommand="Zotero_File_Interface_Bibliography.localeChanged(this.selectedItem.value)"/>
|
||||
</hbox>
|
||||
</groupbox>
|
||||
<groupbox>
|
||||
<caption label="&zotero.bibliography.outputMode;"/>
|
||||
<label>&zotero.bibliography.outputMode;</label>
|
||||
<radiogroup id="output-mode-radio">
|
||||
<radio id="citations"/>
|
||||
<radio id="bibliography" label="&zotero.bibliography.bibliography;"/>
|
||||
</radiogroup>
|
||||
</groupbox>
|
||||
<groupbox>
|
||||
<caption label="&zotero.bibliography.outputMethod;"/>
|
||||
<label>&zotero.bibliography.outputMethod;</label>
|
||||
<radiogroup id="output-method-radio">
|
||||
<radio id="save-as-rtf" label="&zotero.bibliography.saveAsRTF.label;"/>
|
||||
<radio id="save-as-html" label="&zotero.bibliography.saveAsHTML.label;"/>
|
||||
|
@ -43,4 +46,5 @@
|
|||
</radiogroup>
|
||||
</groupbox>
|
||||
</vbox>
|
||||
</dialog>
|
||||
</dialog>
|
||||
</window>
|
|
@ -836,7 +836,7 @@ var Zotero_File_Interface = new function() {
|
|||
}
|
||||
|
||||
var io = new Object();
|
||||
var newDialog = window.openDialog("chrome://zotero/content/bibliography.xul",
|
||||
var newDialog = window.openDialog("chrome://zotero/content/bibliography.xhtml",
|
||||
"_blank","chrome,modal,centerscreen", io);
|
||||
|
||||
if(!io.method) return;
|
||||
|
|
|
@ -4,11 +4,20 @@
|
|||
width: 325pt;
|
||||
}
|
||||
|
||||
#style-listbox > richlistitem {
|
||||
padding: 0.2em 0.4em;
|
||||
}
|
||||
|
||||
groupbox > label:first-child {
|
||||
margin-top: 0.5em;
|
||||
font-size: 1.2em;
|
||||
}
|
||||
|
||||
#locale-box .groupbox-body {
|
||||
padding-top: 3px;
|
||||
}
|
||||
|
||||
#locale-box caption {
|
||||
#locale-box label:first-child {
|
||||
padding-top: 0;
|
||||
padding-bottom: 0;
|
||||
}
|
||||
|
|
|
@ -18,7 +18,7 @@ describe("Create Bibliography Dialog", function () {
|
|||
|
||||
var deferred = Zotero.Promise.defer();
|
||||
var called = false;
|
||||
waitForWindow("chrome://zotero/content/bibliography.xul", function (dialog) {
|
||||
waitForWindow("chrome://zotero/content/bibliography.xhtml", function (dialog) {
|
||||
waitForWindow("chrome://zotero/content/preferences/preferences.xul", function (window) {
|
||||
// Wait for pane switch
|
||||
(async function () {
|
||||
|
|
Loading…
Add table
Reference in a new issue