Fix Create Parent dialog

This commit is contained in:
Abe Jellinek 2022-05-17 09:47:19 -07:00
parent 8dae561557
commit 5f24b2dc98
3 changed files with 15 additions and 9 deletions

View file

@ -29,7 +29,7 @@ var io;
let createParent;
function toggleAccept(enabled) {
document.documentElement.getButton("accept").disabled = !enabled;
document.querySelector('dialog').getButton("accept").disabled = !enabled;
}
function doLoad() {
@ -45,6 +45,12 @@ function doLoad() {
item: io.dataIn.item,
toggleAccept
});
document.addEventListener('dialogaccept', (event) => {
doAccept();
event.preventDefault();
});
document.addEventListener('dialogextra2', doManualEntry);
}
function doUnload() {

View file

@ -9,20 +9,19 @@
<!ENTITY % zoteroDTD SYSTEM "chrome://zotero/locale/zotero.dtd"> %zoteroDTD;
]>
<window
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
xmlns:html="http://www.w3.org/1999/xhtml"
title="&zotero.createParent.title;"
onload="doLoad();"
onunload="doUnload();">
<dialog
id="zotero-parent-dialog"
title="&zotero.createParent.title;"
orient="vertical"
buttons="cancel,accept,extra2"
buttondisabledaccept="true"
buttonlabelextra2="&zotero.createParent.button.manual;"
buttonlabelaccept="&zotero.createParent.title;"
ondialogaccept="doAccept();return false;"
ondialogextra2="doManualEntry();"
onload="doLoad();"
onunload="doUnload();"
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
xmlns:html="http://www.w3.org/1999/xhtml"
style="padding:20px 15px;width:400px;">
<script src="chrome://global/content/globalOverlay.js"/>
@ -37,3 +36,4 @@
<html:div id="create-parent" />
</vbox>
</dialog>
</window>

View file

@ -4792,7 +4792,7 @@ var ZoteroPane = new function()
}
let io = { dataIn: { item }, dataOut: null };
window.openDialog('chrome://zotero/content/createParentDialog.xul', '', 'chrome,modal,centerscreen', io);
window.openDialog('chrome://zotero/content/createParentDialog.xhtml', '', 'chrome,modal,centerscreen', io);
if (!io.dataOut) {
return false;
}