fx-compat: Fix Export dialog

RDF isn't working yet, but CSV works well.
This commit is contained in:
Abe Jellinek 2022-05-16 14:27:23 -07:00
parent 60606a8528
commit 49a9c2dba9
4 changed files with 21 additions and 17 deletions

View file

@ -37,7 +37,7 @@ var Zotero_Charset_Menu = new function() {
var charsetMap = {};
// get charset popup and charset RDF
var charsetPopup = document.createElement("menupopup");
var charsetPopup = document.createXULElement("menupopup");
charsetMenu.appendChild(charsetPopup);
var charsets = [];
@ -53,7 +53,7 @@ var Zotero_Charset_Menu = new function() {
for (let charset of charsets) {
let { label, value } = charset;
let itemNode = document.createElement("menuitem");
let itemNode = document.createXULElement("menuitem");
itemNode.setAttribute("label", label);
itemNode.setAttribute("value", value);
@ -62,7 +62,7 @@ var Zotero_Charset_Menu = new function() {
}
}
else {
var charsetSeparator = document.createElement("menuseparator");
var charsetSeparator = document.createXULElement("menuseparator");
charsetPopup.appendChild(charsetSeparator);
Components.utils.import("resource://gre/modules/CharsetMenu.jsm");
@ -94,7 +94,7 @@ var Zotero_Charset_Menu = new function() {
label = charsets[i].label;
// add element
var itemNode = document.createElement("menuitem");
var itemNode = document.createXULElement("menuitem");
itemNode.setAttribute("label", label);
itemNode.setAttribute("value", charset);
@ -109,7 +109,7 @@ var Zotero_Charset_Menu = new function() {
}
}
var itemNode = document.createElement("menuitem");
var itemNode = document.createXULElement("menuitem");
itemNode.setAttribute("label", Zotero.getString("charset.autoDetect"));
itemNode.setAttribute("value", "auto");
charsetMap["auto"] = itemNode;

View file

@ -63,7 +63,7 @@ var Zotero_File_Interface_Export = new function() {
// add styles to format popup
for(var i in translators) {
var itemNode = document.createElement("menuitem");
var itemNode = document.createXULElement("menuitem");
itemNode.setAttribute("label", translators[i].label);
formatPopup.appendChild(itemNode);
@ -91,7 +91,7 @@ var Zotero_File_Interface_Export = new function() {
// right now, option interface supports only boolean values, which
// it interprets as checkboxes
if(typeof(translators[i].displayOptions[option]) == "boolean") {
let checkbox = document.createElement("checkbox");
let checkbox = document.createXULElement("checkbox");
checkbox.setAttribute("id", OPTION_PREFIX+option);
checkbox.setAttribute("label", optionLabel);
optionsBox.insertBefore(checkbox, charsetBox);
@ -102,7 +102,7 @@ var Zotero_File_Interface_Export = new function() {
setTimeout(() => this.updateAnnotationsCheckbox());
};
checkbox = document.createElement("checkbox");
checkbox = document.createXULElement("checkbox");
checkbox.setAttribute("id", OPTION_PREFIX + 'includeAnnotations');
checkbox.setAttribute(
"label",
@ -135,6 +135,9 @@ var Zotero_File_Interface_Export = new function() {
this.updateOptions(Zotero.Prefs.get(
exportingNotes ? "export.noteTranslatorSettings" : "export.translatorSettings"
));
document.addEventListener('dialogaccept', () => this.accept());
document.addEventListener('dialogcancel', () => this.cancel());
}
/*
@ -178,9 +181,9 @@ var Zotero_File_Interface_Export = new function() {
var isChecked = options[optionName];
} else {
// use defaults
var isChecked = (defValue ? "true" : "false");
isChecked = defValue;
}
node.setAttribute("checked", isChecked);
node.checked = isChecked;
}
} else {
// option should be disabled and unchecked to prevent confusion

View file

@ -6,13 +6,13 @@
<!ENTITY % zoteroDTD SYSTEM "chrome://zotero/locale/zotero.dtd" >
%zoteroDTD;
]>
<dialog xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
<window xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
title="&zotero.exportOptions.title;" buttons="cancel,accept"
ondialogaccept="Zotero_File_Interface_Export.accept()"
ondialogcancel="Zotero_File_Interface_Export.cancel()"
id="zotero-export-options"
title="&zotero.exportOptions.title;"
onload="Zotero_File_Interface_Export.init()">
<dialog
buttons="cancel,accept"
id="zotero-export-options">
<script src="include.js"/>
<script src="charsetMenu.js"/>
@ -42,4 +42,5 @@
</vbox>
</groupbox>
</vbox>
</dialog>
</dialog>
</window>

View file

@ -101,7 +101,7 @@ Zotero_File_Exporter.prototype.save = async function () {
// present options dialog
var io = { translators, exportingNotes };
window.openDialog("chrome://zotero/content/exportOptions.xul",
window.openDialog("chrome://zotero/content/exportOptions.xhtml",
"_blank", "chrome,modal,centerscreen,resizable=no", io);
if(!io.selectedTranslator) {
return false;