fx-compat: Fix Attach Link dialog

This commit is contained in:
Abe Jellinek 2022-05-24 12:02:37 -06:00
parent a2215cb8f6
commit 300af4477f
3 changed files with 19 additions and 10 deletions

View file

@ -24,6 +24,14 @@
*/
var Zotero_AttachLink = new function() {
this.load = function () {
document.addEventListener('dialogaccept', (event) => {
if (!this.submit()) {
event.preventDefault();
}
});
};
function getAttachFileLabel() {
return window.opener.document
.getElementById('zotero-tb-attachment-add-file-link')

View file

@ -4,14 +4,14 @@
<!DOCTYPE window SYSTEM "chrome://zotero/locale/zotero.dtd">
<dialog
<window
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
buttons="accept,cancel"
ondialogaccept="return Zotero_AttachLink.submit();"
id="zotero-attach-uri-dialog"
xmlns:html="http://www.w3.org/1999/xhtml"
title="&zotero.attachLink.title;"
>
onload="Zotero_AttachLink.load()">
<dialog
buttons="accept,cancel"
id="zotero-attach-uri-dialog">
<script src="include.js"/>
<script src="attachLink.js"/>
@ -22,11 +22,12 @@
</hbox>
<hbox align="center">
<label id="zotero-attach-uri-label-input" value="&zotero.attachLink.label.link;" control="zotero-attach-uri-input"></label>
<textbox id="zotero-attach-uri-input" flex="1"/>
<html:input type="text" id="zotero-attach-uri-input" style="-moz-box-flex: 1"/>
</hbox>
<hbox align="center">
<label id="zotero-attach-uri-label-title" value="&zotero.attachLink.label.title;" control="zotero-attach-uri-title"></label>
<textbox id="zotero-attach-uri-title" flex="1" placeholder="&zotero.general.optional;"/>
<html:input type="text" id="zotero-attach-uri-title" style="-moz-box-flex: 1" placeholder="&zotero.general.optional;"/>
</hbox>
</vbox>
</dialog>
</dialog>
</window>

View file

@ -3795,7 +3795,7 @@ var ZoteroPane = new function()
}
var io = {};
window.openDialog('chrome://zotero/content/attachLink.xul',
window.openDialog('chrome://zotero/content/attachLink.xhtml',
'zotero-attach-uri-dialog', 'centerscreen, modal', io);
if (!io.out) return;
return Zotero.Attachments.linkFromURL({