Add a prompt to import Mendeley DB if mendeley citation found in doc
This commit is contained in:
parent
9b938f2236
commit
e10fc538d0
5 changed files with 46 additions and 5 deletions
|
@ -61,7 +61,7 @@ const Zotero_Import_Wizard = { // eslint-disable-line no-unused-vars
|
||||||
},
|
},
|
||||||
|
|
||||||
async init() {
|
async init() {
|
||||||
const { mendeleyCode, libraryID } = window.arguments[0].wrappedJSObject ?? {};
|
const { mendeleyCode, libraryID, pageID } = window.arguments[0].wrappedJSObject ?? {};
|
||||||
|
|
||||||
this.libraryID = libraryID;
|
this.libraryID = libraryID;
|
||||||
|
|
||||||
|
@ -125,6 +125,10 @@ const Zotero_Import_Wizard = { // eslint-disable-line no-unused-vars
|
||||||
this.wizard.shadowRoot
|
this.wizard.shadowRoot
|
||||||
.querySelector('.wizard-header-label').style.fontSize = '16px';
|
.querySelector('.wizard-header-label').style.fontSize = '16px';
|
||||||
|
|
||||||
|
if (pageID) {
|
||||||
|
this.wizard.goTo(pageID);
|
||||||
|
}
|
||||||
|
|
||||||
if (mendeleyCode && Zotero.Prefs.get("import.mendeleyUseOAuth")) {
|
if (mendeleyCode && Zotero.Prefs.get("import.mendeleyUseOAuth")) {
|
||||||
this.mendeleyCode = mendeleyCode;
|
this.mendeleyCode = mendeleyCode;
|
||||||
this.wizard.goTo('page-options');
|
this.wizard.goTo('page-options');
|
||||||
|
|
|
@ -2655,11 +2655,42 @@ Zotero.Integration.URIMap.prototype.getZoteroItemForURIs = async function (uris)
|
||||||
replacer = await Zotero.Relations.getByPredicateAndObject(
|
replacer = await Zotero.Relations.getByPredicateAndObject(
|
||||||
'item', 'mendeleyDB:documentUUID', m[1]
|
'item', 'mendeleyDB:documentUUID', m[1]
|
||||||
);
|
);
|
||||||
if (replacer.length && !replacer[0].deleted) {
|
if (replacer.length) {
|
||||||
zoteroItem = replacer[0];
|
if (!replacer[0].deleted) {
|
||||||
break;
|
zoteroItem = replacer[0];
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
// If not blocked by user having pressed skip in this session,
|
||||||
|
// or user having checked the checkbox to not be prompted about this,
|
||||||
|
// or user having imported their library with the new version of importer
|
||||||
|
else if (!(this.session.dontPromptForMendeley
|
||||||
|
|| Zotero.Prefs.get('integration.dontPromptMendeleyImport')
|
||||||
|
|| await Zotero.DB.valueQueryAsync("SELECT value FROM settings WHERE setting='mendeleyImport' AND key='version'")
|
||||||
|
)) {
|
||||||
|
// Prompt user to (re)import their mendeley database which might make us recognize
|
||||||
|
// these items
|
||||||
|
let checkbox = {};
|
||||||
|
let result = Zotero.Prompt.confirm({
|
||||||
|
title: Zotero.getString('integration.mendeleyImport.title'),
|
||||||
|
text: Zotero.getString('integration.mendeleyImport.description', [Zotero.appName]),
|
||||||
|
button0: Zotero.getString('integration.mendeleyImport.openImporter'),
|
||||||
|
button1: Zotero.getString('general.skip'),
|
||||||
|
checkLabel: Zotero.getString('general.dontAskAgain'),
|
||||||
|
checkbox
|
||||||
|
});
|
||||||
|
if (result === 0) {
|
||||||
|
setTimeout(() => Zotero.getMainWindow().Zotero_File_Interface.showImportWizard({ pageID: 'page-mendeley-online-intro' }));
|
||||||
|
throw new Zotero.Exception.UserCancelled("Importing mendeley citations");
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
this.session.dontPromptForMendeley = true;
|
||||||
|
}
|
||||||
|
if (checkbox.value) {
|
||||||
|
Zotero.Prefs.set('integration.dontPromptMendeleyImport', true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -73,6 +73,7 @@ general.tryLater = Try Later
|
||||||
general.showDirectory = Show Directory
|
general.showDirectory = Show Directory
|
||||||
general.showInLibrary = Show in Library
|
general.showInLibrary = Show in Library
|
||||||
general.continue = Continue
|
general.continue = Continue
|
||||||
|
general.skip = Skip
|
||||||
general.copy = Copy
|
general.copy = Copy
|
||||||
general.copyToClipboard = Copy to Clipboard
|
general.copyToClipboard = Copy to Clipboard
|
||||||
general.cancel = Cancel
|
general.cancel = Cancel
|
||||||
|
@ -992,6 +993,9 @@ integration.exportDocument.description1 = Zotero will convert citations in the d
|
||||||
integration.exportDocument.description2 = You should make a backup of the document before proceeding.
|
integration.exportDocument.description2 = You should make a backup of the document before proceeding.
|
||||||
integration.importInstructions = The Zotero citations in this document have been converted to a format that can be safely transferred between word processors. Open this document in a supported word processor and press Refresh in the Zotero plugin to continue working with the citations.
|
integration.importInstructions = The Zotero citations in this document have been converted to a format that can be safely transferred between word processors. Open this document in a supported word processor and press Refresh in the Zotero plugin to continue working with the citations.
|
||||||
integration.upgradeTemplate = The %S plugin for %S is outdated. Reinstall the plugin from Preferences → Cite → Word Processors.
|
integration.upgradeTemplate = The %S plugin for %S is outdated. Reinstall the plugin from Preferences → Cite → Word Processors.
|
||||||
|
integration.mendeleyImport.title = Missing Mendeley Data
|
||||||
|
integration.mendeleyImport.description = %1$S detected that the document you are citing with contains Mendeley citations. %1$S will be able to manage these citations if you import your Mendeley database.
|
||||||
|
integration.mendeleyImport.openImporter = Open Mendeley Importer...
|
||||||
|
|
||||||
styles.install.title = Install Style
|
styles.install.title = Install Style
|
||||||
styles.install.unexpectedError = An unexpected error occurred while installing "%1$S"
|
styles.install.unexpectedError = An unexpected error occurred while installing "%1$S"
|
||||||
|
|
|
@ -53,6 +53,7 @@ const xpcomFilesAll = [
|
||||||
'mimeTypeHandler',
|
'mimeTypeHandler',
|
||||||
'pdfWorker/manager',
|
'pdfWorker/manager',
|
||||||
'ipc',
|
'ipc',
|
||||||
|
'prompt',
|
||||||
'profile',
|
'profile',
|
||||||
'progressWindow',
|
'progressWindow',
|
||||||
'proxy',
|
'proxy',
|
||||||
|
|
|
@ -135,6 +135,7 @@ pref("extensions.zotero.integration.autoRegenerate", -1); // -1 = ask; 0 = no; 1
|
||||||
pref("extensions.zotero.integration.useClassicAddCitationDialog", false);
|
pref("extensions.zotero.integration.useClassicAddCitationDialog", false);
|
||||||
pref("extensions.zotero.integration.keepAddCitationDialogRaised", false);
|
pref("extensions.zotero.integration.keepAddCitationDialogRaised", false);
|
||||||
pref("extensions.zotero.integration.upgradeTemplateDelayedOn", 0);
|
pref("extensions.zotero.integration.upgradeTemplateDelayedOn", 0);
|
||||||
|
pref("extensions.zotero.integration.dontPromptMendeleyImport", false);
|
||||||
|
|
||||||
// Connector settings
|
// Connector settings
|
||||||
pref("extensions.zotero.httpServer.enabled", true);
|
pref("extensions.zotero.httpServer.enabled", true);
|
||||||
|
|
Loading…
Reference in a new issue