Enable PDF reader by default and enable for groups
"Zotero" is now the first and default option in the "Open PDFs using" drop-down in the General pane of the preferences.
This commit is contained in:
parent
f8d7eb8ed7
commit
5a0cd78f06
22 changed files with 84 additions and 263 deletions
|
@ -363,16 +363,7 @@
|
|||
}
|
||||
|
||||
var type = Zotero.Libraries.get(this.item.libraryID).libraryType;
|
||||
var switherDeck = this._id('attachment-note-editor-switcher');
|
||||
// Note editor
|
||||
if (type == 'group' && !Zotero.enablePDFBuildForGroups || !Zotero.isPDFBuild) {
|
||||
var noteEditor = this._id('attachment-note-editor-old');
|
||||
switherDeck.selectedIndex = 0;
|
||||
}
|
||||
else {
|
||||
var noteEditor = this._id('attachment-note-editor');
|
||||
switherDeck.selectedIndex = 1;
|
||||
}
|
||||
var noteEditor = this._id('attachment-note-editor');
|
||||
|
||||
if (this.displayNote && (this.displayNoteIfEmpty || this.item.note != '')) {
|
||||
noteEditor.linksOnTop = true;
|
||||
|
@ -637,10 +628,7 @@
|
|||
</grid>
|
||||
</vbox>
|
||||
|
||||
<deck id="attachment-note-editor-switcher" flex="1">
|
||||
<oldzoteronoteeditor id="attachment-note-editor-old" notitle="1" flex="1"/>
|
||||
<zoteronoteeditor id="attachment-note-editor" notitle="1" flex="1"/>
|
||||
</deck>
|
||||
<zoteronoteeditor id="attachment-note-editor" notitle="1" flex="1"/>
|
||||
|
||||
<button id="select-button" hidden="true"/>
|
||||
</vbox>
|
||||
|
|
|
@ -340,8 +340,7 @@
|
|||
|
||||
case 'note':
|
||||
var type = Zotero.Libraries.get(this.libraryID).libraryType;
|
||||
var useOld = type == 'group' && !Zotero.enablePDFBuildForGroups || !Zotero.isPDFBuild;
|
||||
elementName = useOld ? 'oldzoteronoteeditor' : 'zoteronoteeditor';
|
||||
elementName = 'zoteronoteeditor';
|
||||
break;
|
||||
|
||||
case 'annotation':
|
||||
|
|
|
@ -256,58 +256,22 @@ var ZoteroItemPane = new function() {
|
|||
tree.focus();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
this.switchEditorEngine = function (useOld) {
|
||||
var switherDeck = document.getElementById('zotero-note-editor-switcher');
|
||||
switherDeck.selectedIndex = useOld ? 0 : 1;
|
||||
};
|
||||
|
||||
|
||||
this.onNoteSelected = function (item, editable) {
|
||||
_selectedNoteID = item.id;
|
||||
|
||||
var type = Zotero.Libraries.get(item.libraryID).libraryType;
|
||||
if (type == 'group' && !Zotero.enablePDFBuildForGroups || !Zotero.isPDFBuild) {
|
||||
// If an external note window is open for this item, don't show the editor
|
||||
if (ZoteroPane.findNoteWindow(item.id)) {
|
||||
this.showNoteWindowMessage();
|
||||
return;
|
||||
}
|
||||
|
||||
var noteEditor = document.getElementById('zotero-note-editor-old');
|
||||
|
||||
// If loading new or different note, disable undo while we repopulate the text field
|
||||
// so Undo doesn't end up clearing the field. This also ensures that Undo doesn't
|
||||
// undo content from another note into the current one.
|
||||
var clearUndo = noteEditor.item ? noteEditor.item.id != item.id : false;
|
||||
|
||||
noteEditor.mode = editable ? 'edit' : 'view';
|
||||
noteEditor.parent = null;
|
||||
noteEditor.item = item;
|
||||
|
||||
if (clearUndo) {
|
||||
noteEditor.clearUndo();
|
||||
}
|
||||
}
|
||||
else {
|
||||
var noteEditor = document.getElementById('zotero-note-editor');
|
||||
noteEditor.mode = editable ? 'edit' : 'view';
|
||||
noteEditor.viewMode = 'library';
|
||||
noteEditor.parent = null;
|
||||
noteEditor.item = item;
|
||||
}
|
||||
var noteEditor = document.getElementById('zotero-note-editor');
|
||||
noteEditor.mode = editable ? 'edit' : 'view';
|
||||
noteEditor.viewMode = 'library';
|
||||
noteEditor.parent = null;
|
||||
noteEditor.item = item;
|
||||
|
||||
document.getElementById('zotero-view-note-button').hidden = !editable || (type == 'user' || Zotero.enablePDFBuildForGroups) && Zotero.isPDFBuild;
|
||||
document.getElementById('zotero-item-pane-content').selectedIndex = 2;
|
||||
};
|
||||
|
||||
|
||||
this.showNoteWindowMessage = function () {
|
||||
ZoteroPane.setItemPaneMessage(Zotero.getString('pane.item.notes.editingInWindow'));
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* Select the parent item and open the note editor
|
||||
*/
|
||||
|
@ -315,19 +279,6 @@ var ZoteroItemPane = new function() {
|
|||
var selectedNote = Zotero.Items.get(_selectedNoteID);
|
||||
|
||||
var type = Zotero.Libraries.get(selectedNote.libraryID).libraryType;
|
||||
if (type == 'group' && !Zotero.enablePDFBuildForGroups || !Zotero.isPDFBuild) {
|
||||
// We don't want to show the note in two places, since it causes unnecessary UI updates
|
||||
// and can result in weird bugs where note content gets lost.
|
||||
//
|
||||
// If this is a child note, select the parent
|
||||
if (selectedNote.parentID) {
|
||||
await ZoteroPane.selectItem(selectedNote.parentID);
|
||||
}
|
||||
// Otherwise, hide note and replace with a message that we're editing externally
|
||||
else {
|
||||
this.showNoteWindowMessage();
|
||||
}
|
||||
}
|
||||
ZoteroPane.openNoteWindow(selectedNote.id);
|
||||
};
|
||||
|
||||
|
|
|
@ -117,16 +117,8 @@
|
|||
'onerror' handler crashes the app on a save error to prevent typing in notes
|
||||
while they're not being saved
|
||||
-->
|
||||
<deck id="zotero-note-editor-switcher" flex="1">
|
||||
<oldzoteronoteeditor id="zotero-note-editor-old" flex="1" notitle="1"
|
||||
previousfocus="zotero-items-tree"
|
||||
onerror="ZoteroPane.displayErrorMessage(); this.mode = 'view'"/>
|
||||
<zoteronoteeditor id="zotero-note-editor" flex="1" notitle="1"
|
||||
previousfocus="zotero-items-tree"/>
|
||||
</deck>
|
||||
<button id="zotero-view-note-button"
|
||||
label="&zotero.notes.separate;"
|
||||
oncommand="ZoteroItemPane.openNoteWindow()"/>
|
||||
<zoteronoteeditor id="zotero-note-editor" flex="1" notitle="1"
|
||||
previousfocus="zotero-items-tree"/>
|
||||
</groupbox>
|
||||
|
||||
<!-- Attachment item -->
|
||||
|
|
|
@ -27,11 +27,6 @@ var noteEditor;
|
|||
var notifierUnregisterID;
|
||||
var type;
|
||||
|
||||
function switchEditorEngine(useOld) {
|
||||
var switherDeck = document.getElementById('zotero-note-editor-switcher');
|
||||
switherDeck.selectedIndex = useOld ? 0 : 1;
|
||||
}
|
||||
|
||||
async function onLoad() {
|
||||
if (window.arguments) {
|
||||
var io = window.arguments[0];
|
||||
|
@ -58,13 +53,7 @@ async function onLoad() {
|
|||
}
|
||||
}
|
||||
type = Zotero.Libraries.get(libraryID).libraryType;
|
||||
switchEditorEngine(type == 'group' && !Zotero.enablePDFBuildForGroups || !Zotero.isPDFBuild);
|
||||
if (type == 'group' && !Zotero.enablePDFBuildForGroups || !Zotero.isPDFBuild) {
|
||||
noteEditor = document.getElementById('zotero-note-editor-old');
|
||||
}
|
||||
else {
|
||||
noteEditor = document.getElementById('zotero-note-editor');
|
||||
}
|
||||
noteEditor = document.getElementById('zotero-note-editor');
|
||||
noteEditor.mode = 'edit';
|
||||
noteEditor.viewMode = 'window';
|
||||
|
||||
|
@ -107,14 +96,7 @@ function onError() {
|
|||
|
||||
function onUnload() {
|
||||
Zotero.Notifier.unregisterObserver(notifierUnregisterID);
|
||||
if (type == 'group' && !Zotero.enablePDFBuildForGroups || !Zotero.isPDFBuild) {
|
||||
if (noteEditor.item) {
|
||||
window.opener.ZoteroPane.onNoteWindowClosed(noteEditor.item.id, noteEditor.value);
|
||||
}
|
||||
}
|
||||
else {
|
||||
noteEditor.saveSync();
|
||||
}
|
||||
noteEditor.saveSync();
|
||||
}
|
||||
|
||||
var NotifyCallback = {
|
||||
|
|
|
@ -22,8 +22,5 @@
|
|||
</keyset>
|
||||
<command id="cmd_close" oncommand="window.close();"/>
|
||||
|
||||
<deck id="zotero-note-editor-switcher" flex="1">
|
||||
<oldzoteronoteeditor id="zotero-note-editor-old" flex="1" onerror="onError()"/>
|
||||
<zoteronoteeditor id="zotero-note-editor" flex="1" onerror="return;onError()"/>
|
||||
</deck>
|
||||
<zoteronoteeditor id="zotero-note-editor" flex="1" onerror="return;onError()"/>
|
||||
</window>
|
||||
|
|
|
@ -43,7 +43,6 @@ Zotero_Preferences.General = {
|
|||
|
||||
this.updateAutoRenameFilesUI();
|
||||
this._updateFileHandlerUI();
|
||||
this._updateZotero6BetaCheckbox();
|
||||
},
|
||||
|
||||
updateAutoRenameFilesUI: function () {
|
||||
|
@ -60,7 +59,7 @@ Zotero_Preferences.General = {
|
|||
var currentPath = Zotero.Prefs.get(pref);
|
||||
|
||||
var fp = new FilePicker();
|
||||
if (currentPath) {
|
||||
if (currentPath && currentPath != 'system') {
|
||||
fp.displayDirectory = OS.Path.dirname(currentPath);
|
||||
}
|
||||
fp.init(
|
||||
|
@ -78,12 +77,7 @@ Zotero_Preferences.General = {
|
|||
|
||||
setFileHandler: function (type, handler) {
|
||||
var pref = this._getFileHandlerPref(type);
|
||||
if (handler) {
|
||||
Zotero.Prefs.set(pref, handler);
|
||||
}
|
||||
else {
|
||||
Zotero.Prefs.clear(pref);
|
||||
}
|
||||
Zotero.Prefs.set(pref, handler);
|
||||
this._updateFileHandlerUI();
|
||||
},
|
||||
|
||||
|
@ -92,16 +86,13 @@ Zotero_Preferences.General = {
|
|||
var menulist = document.getElementById('fileHandler-pdf');
|
||||
var customMenuItem = document.getElementById('fileHandler-custom');
|
||||
|
||||
// TEMP: Use separate checkbox for now
|
||||
/*if (handler == 'zotero') {
|
||||
let menuitem = document.getElementById('fileHandler-internal');
|
||||
menulist.selectedIndex = 0;
|
||||
// System default
|
||||
if (handler == 'system') {
|
||||
customMenuItem.hidden = true;
|
||||
return;
|
||||
}*/
|
||||
|
||||
menulist.selectedIndex = 1;
|
||||
}
|
||||
// Custom handler
|
||||
if (handler) {
|
||||
else if (handler) {
|
||||
let icon;
|
||||
try {
|
||||
let fph = Services.io.getProtocolHandler("file")
|
||||
|
@ -126,13 +117,14 @@ Zotero_Preferences.General = {
|
|||
customMenuItem.className = '';
|
||||
}
|
||||
customMenuItem.hidden = false;
|
||||
menulist.selectedIndex = 1;
|
||||
}
|
||||
// System default
|
||||
else {
|
||||
customMenuItem.hidden = true;
|
||||
menulist.selectedIndex = 2;
|
||||
}
|
||||
// Zotero
|
||||
else {
|
||||
let menuitem = document.getElementById('fileHandler-internal');
|
||||
menulist.selectedIndex = 0;
|
||||
customMenuItem.hidden = true;
|
||||
}
|
||||
},
|
||||
|
||||
_getFileHandlerPref: function (type) {
|
||||
|
@ -140,38 +132,5 @@ Zotero_Preferences.General = {
|
|||
throw new Error(`Unknown file type ${type}`);
|
||||
}
|
||||
return 'fileHandler.pdf';
|
||||
},
|
||||
|
||||
|
||||
handleZotero6BetaChange: function (event) {
|
||||
var ps = Services.prompt;
|
||||
var buttonFlags = ps.BUTTON_POS_0 * ps.BUTTON_TITLE_IS_STRING
|
||||
+ ps.BUTTON_POS_1 * ps.BUTTON_TITLE_CANCEL;
|
||||
var index = ps.confirmEx(
|
||||
window,
|
||||
Zotero.getString('general.restartRequired'),
|
||||
Zotero.getString('general.restartRequiredForChange', Zotero.appName),
|
||||
buttonFlags,
|
||||
Zotero.getString('general.restartApp', Zotero.appName),
|
||||
null, null, null, {}
|
||||
);
|
||||
if (index == 0) {
|
||||
Zotero.Prefs.set('beta.zotero6', !event.target.checked);
|
||||
Zotero.Utilities.Internal.quitZotero(true);
|
||||
return;
|
||||
}
|
||||
// Set to opposite so the click changes it back to what it was before
|
||||
event.target.checked = !event.target.checked;
|
||||
},
|
||||
|
||||
|
||||
_updateZotero6BetaCheckbox: function () {
|
||||
var checkbox = document.getElementById('zotero6-checkbox');
|
||||
if (Zotero.Prefs.get('beta.zotero6')) {
|
||||
checkbox.setAttribute('checked', true);
|
||||
}
|
||||
else {
|
||||
checkbox.removeAttribute('checked');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -67,23 +67,15 @@
|
|||
<menulist id="fileHandler-pdf" class="fileHandler-menu">
|
||||
<menupopup>
|
||||
<menuitem id="fileHandler-internal"
|
||||
oncommand="Zotero_Preferences.General.setFileHandler('pdf', 'zotero')"
|
||||
hidden="true"/>
|
||||
<menuitem id="fileHandler-custom"/>
|
||||
oncommand="Zotero_Preferences.General.setFileHandler('pdf', '')"/>
|
||||
<menuitem label="&zotero.preferences.fileHandler.systemDefault;"
|
||||
oncommand="Zotero_Preferences.General.setFileHandler('pdf', false)"/>
|
||||
oncommand="Zotero_Preferences.General.setFileHandler('pdf', 'system')"/>
|
||||
<menuitem id="fileHandler-custom"/>
|
||||
<menuitem label="&zotero.preferences.custom;"
|
||||
oncommand="Zotero_Preferences.General.chooseFileHandler('pdf')"/>
|
||||
</menupopup>
|
||||
</menulist>
|
||||
</hbox>
|
||||
<checkbox
|
||||
id="zotero6-checkbox"
|
||||
label="Enable the Zotero PDF reader and new note editor (preview, My Library only)"
|
||||
style="margin-top: 5px"
|
||||
onclick="Zotero_Preferences.General.handleZotero6BetaChange(event)"/>
|
||||
<label class="zotero-text-link" value="Learn more about the preview"
|
||||
style="margin-left: 23px; margin-top: 1px" href="https://www.zotero.org/support/pdf_reader_preview"/>
|
||||
</groupbox>
|
||||
|
||||
<groupbox id="zotero-prefpane-miscellaneous-groupbox">
|
||||
|
|
|
@ -87,13 +87,6 @@ const ZoteroStandalone = new function() {
|
|||
|
||||
ZoteroStandalone.DebugOutput.init();
|
||||
|
||||
// TEMP: Remove tab bar if not PDF build
|
||||
if (Zotero.isMac && !Zotero.isPDFBuild) {
|
||||
document.documentElement.removeAttribute('drawintitlebar');
|
||||
document.documentElement.removeAttribute('tabsintitlebar');
|
||||
document.documentElement.removeAttribute('chromemargin');
|
||||
}
|
||||
|
||||
Zotero.hideZoteroPaneOverlays();
|
||||
ZoteroPane.init();
|
||||
ZoteroPane.makeVisible();
|
||||
|
|
|
@ -1702,7 +1702,7 @@ Zotero.Server.Connector.Ping.prototype = {
|
|||
let response = {
|
||||
prefs: {
|
||||
automaticSnapshots: Zotero.Prefs.get('automaticSnapshots'),
|
||||
googleDocsAddNoteEnabled: Zotero.isPDFBuild
|
||||
googleDocsAddNoteEnabled: true
|
||||
}
|
||||
};
|
||||
if (Zotero.QuickCopy.hasSiteSettings()) {
|
||||
|
|
|
@ -1273,19 +1273,6 @@ Zotero.Item.prototype._saveData = Zotero.Promise.coroutine(function* (env) {
|
|||
env.sqlValues.push({ int: itemTypeID });
|
||||
}
|
||||
|
||||
// TEMP: Don't allow annotations or embedded images in group libraries
|
||||
// TODO: Enable test in annotations.js after removing
|
||||
if (libraryType == 'group' && !Zotero.enablePDFBuildForGroups) {
|
||||
if (this._changed.primaryData && this._changed.primaryData.itemTypeID
|
||||
&& Zotero.ItemTypes.getName(itemTypeID) == 'annotation') {
|
||||
throw new Error("Annotations can currently be created only in user libraries");
|
||||
}
|
||||
if (this._changed.attachmentData
|
||||
&& this.attachmentLinkMode == Zotero.Attachments.LINK_MODE_EMBEDDED_IMAGE) {
|
||||
throw new Error("Embedded-image attachments can currently be created only in user libraries");
|
||||
}
|
||||
}
|
||||
|
||||
if (isNew || (this._changed.primaryData && this._changed.primaryData.dateAdded)) {
|
||||
env.sqlColumns.push('dateAdded');
|
||||
env.sqlValues.push(this.dateAdded ? this.dateAdded : Zotero.DB.transactionDateTime);
|
||||
|
|
|
@ -666,13 +666,6 @@ Zotero.Integration.Interface.prototype.addEditCitation = async function (docFiel
|
|||
* @return {Promise}
|
||||
*/
|
||||
Zotero.Integration.Interface.prototype.addNote = async function () {
|
||||
if (!Zotero.isPDFBuild) {
|
||||
let ps = Services.prompt;
|
||||
let errorMessage = "To add notes to your document, you must enable the beta PDF reader "
|
||||
+ "and note editor in the Zotero preferences.";
|
||||
let index = ps.alert(null, Zotero.getString('general.error'), errorMessage);
|
||||
throw new Zotero.Exception.UserCancelled('Cannot add notes with note editor disabled');
|
||||
}
|
||||
await this._session.init(false, false);
|
||||
|
||||
if ((!await this._doc.canInsertField(this._session.data.prefs['fieldType']))) {
|
||||
|
|
|
@ -27,6 +27,8 @@
|
|||
|
||||
Zotero.OpenPDF = {
|
||||
openToPage: async function (pathOrItem, page, annotationKey) {
|
||||
var handler = Zotero.Prefs.get("fileHandler.pdf");
|
||||
|
||||
var path;
|
||||
if (pathOrItem == 'string') {
|
||||
Zotero.logError("Zotero.OpenPDF.openToPage() now takes a Zotero.Item rather than a path "
|
||||
|
@ -36,8 +38,8 @@ Zotero.OpenPDF = {
|
|||
else {
|
||||
let item = pathOrItem;
|
||||
let library = Zotero.Libraries.get(item.libraryID);
|
||||
// TEMP
|
||||
if (Zotero.isPDFBuild && (library.libraryType == 'user' || Zotero.enablePDFBuildForGroups)) {
|
||||
// Zotero PDF reader
|
||||
if (!handler) {
|
||||
let location = {
|
||||
annotationKey,
|
||||
pageIndex: page && page - 1
|
||||
|
@ -53,10 +55,9 @@ Zotero.OpenPDF = {
|
|||
}
|
||||
}
|
||||
|
||||
var handler = Zotero.Prefs.get("fileHandler.pdf");
|
||||
var opened = false;
|
||||
|
||||
if (handler) {
|
||||
if (handler != 'system') {
|
||||
Zotero.debug(`Custom handler is ${handler}`);
|
||||
}
|
||||
|
||||
|
@ -72,7 +73,7 @@ Zotero.OpenPDF = {
|
|||
opened = true;
|
||||
}
|
||||
else if (Zotero.isWin) {
|
||||
if (!handler) {
|
||||
if (handler == 'system') {
|
||||
handler = this._getPDFHandlerWindows();
|
||||
if (handler) {
|
||||
Zotero.debug(`Default handler is ${handler}`);
|
||||
|
@ -92,7 +93,7 @@ Zotero.OpenPDF = {
|
|||
}
|
||||
}
|
||||
else if (Zotero.isLinux) {
|
||||
if (!handler) {
|
||||
if (handler == 'system') {
|
||||
handler = await this._getPDFHandlerLinux();
|
||||
if (handler) {
|
||||
Zotero.debug(`Resolved handler is ${handler}`);
|
||||
|
|
|
@ -49,7 +49,7 @@ Zotero.Prefs = new function(){
|
|||
if (!fromVersion) {
|
||||
fromVersion = 0;
|
||||
}
|
||||
var toVersion = 3;
|
||||
var toVersion = 4;
|
||||
if (fromVersion < toVersion) {
|
||||
for (var i = fromVersion + 1; i <= toVersion; i++) {
|
||||
switch (i) {
|
||||
|
@ -78,10 +78,9 @@ Zotero.Prefs = new function(){
|
|||
this.clear('note.fontSize');
|
||||
break;
|
||||
|
||||
// TEMP: Uncomment and set toVersion above to 3 when adding to prefs drop-down
|
||||
//case 3:
|
||||
// this.clear('fileHandler.pdf');
|
||||
// break;
|
||||
case 4:
|
||||
this.clear('fileHandler.pdf');
|
||||
break;
|
||||
}
|
||||
}
|
||||
this.set('prefVersion', toVersion);
|
||||
|
|
|
@ -260,9 +260,6 @@ Services.scriptloader.loadSubScript("resource://zotero/polyfill.js");
|
|||
return;
|
||||
}
|
||||
|
||||
Zotero.isPDFBuild = Zotero.Prefs.get('beta.zotero6');
|
||||
Zotero.enablePDFBuildForGroups = false;
|
||||
|
||||
try {
|
||||
yield Zotero.DataDirectory.init();
|
||||
if (this.restarting) {
|
||||
|
|
|
@ -69,13 +69,6 @@ var ZoteroPane = new function()
|
|||
this.init = function () {
|
||||
Zotero.debug("Initializing Zotero pane");
|
||||
|
||||
if (!Zotero.isPDFBuild) {
|
||||
let win = document.getElementById('main-window')
|
||||
win.setAttribute('legacytoolbar', 'true');
|
||||
document.getElementById('titlebar').hidden = true;
|
||||
document.getElementById('tab-bar-container').hidden = true;
|
||||
}
|
||||
|
||||
// Set key down handler
|
||||
document.addEventListener('keydown', ZoteroPane_Local.handleKeyDown, true);
|
||||
document.addEventListener('blur', ZoteroPane.handleBlur);
|
||||
|
@ -1224,12 +1217,9 @@ var ZoteroPane = new function()
|
|||
}
|
||||
|
||||
// Rename tab
|
||||
if (Zotero.isPDFBuild) {
|
||||
Zotero_Tabs.rename('zotero-pane', collectionTreeRow.getName());
|
||||
}
|
||||
Zotero_Tabs.rename('zotero-pane', collectionTreeRow.getName());
|
||||
|
||||
let type = Zotero.Libraries.get(collectionTreeRow.ref.libraryID).libraryType;
|
||||
ZoteroItemPane.switchEditorEngine(type == 'group' && !Zotero.enablePDFBuildForGroups || !Zotero.isPDFBuild);
|
||||
|
||||
// Clear quick search and tag selector when switching views
|
||||
document.getElementById('zotero-tb-search').value = "";
|
||||
|
@ -3334,7 +3324,7 @@ var ZoteroPane = new function()
|
|||
this.openNoteWindow = function (itemID, col, parentKey) {
|
||||
var item = Zotero.Items.get(itemID);
|
||||
var type = Zotero.Libraries.get(item.libraryID).libraryType;
|
||||
if (!this.canEdit() && (type == 'group' && !Zotero.enablePDFBuildForGroups || !Zotero.isPDFBuild)) {
|
||||
if (!this.canEdit()) {
|
||||
this.displayCannotEditLibraryMessage();
|
||||
return;
|
||||
}
|
||||
|
@ -3371,25 +3361,12 @@ var ZoteroPane = new function()
|
|||
}
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
this.onNoteWindowClosed = async function (itemID, noteText) {
|
||||
var item = Zotero.Items.get(itemID);
|
||||
item.setNote(noteText);
|
||||
await item.saveTx();
|
||||
|
||||
// If note is still selected, show the editor again when the note window closes
|
||||
var selectedItems = this.getSelectedItems(true);
|
||||
if (selectedItems.length == 1 && itemID == selectedItems[0]) {
|
||||
ZoteroItemPane.onNoteSelected(item, this.collectionsView.editable);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
this.openBackupNoteWindow = function (itemID) {
|
||||
var item = Zotero.Items.get(itemID);
|
||||
var type = Zotero.Libraries.get(item.libraryID).libraryType;
|
||||
if (!this.canEdit() && (type == 'group' && !Zotero.enablePDFBuildForGroups || !Zotero.isPDFBuild)) {
|
||||
if (!this.canEdit()) {
|
||||
this.displayCannotEditLibraryMessage();
|
||||
return;
|
||||
}
|
||||
|
@ -3866,10 +3843,10 @@ var ZoteroPane = new function()
|
|||
}
|
||||
else if (item.isNote()) {
|
||||
var type = Zotero.Libraries.get(item.libraryID).libraryType;
|
||||
if (!this.collectionsView.editable && (type == 'group' && !Zotero.enablePDFBuildForGroups || !Zotero.isPDFBuild)) {
|
||||
if (!this.collectionsView.editable) {
|
||||
continue;
|
||||
}
|
||||
document.getElementById('zotero-view-note-button').doCommand();
|
||||
ZoteroItemPane.openNoteWindow();
|
||||
}
|
||||
else if (item.isAttachment()) {
|
||||
yield this.viewAttachment(item.id, event);
|
||||
|
@ -3899,12 +3876,12 @@ var ZoteroPane = new function()
|
|||
await item.saveTx();
|
||||
}
|
||||
}
|
||||
// Custom PDF handler
|
||||
if (contentType === 'application/pdf') {
|
||||
let item = await Zotero.Items.getAsync(itemID);
|
||||
let library = Zotero.Libraries.get(item.libraryID);
|
||||
// TEMP
|
||||
if (Zotero.isPDFBuild && (library.libraryType == 'user' || Zotero.enablePDFBuildForGroups)) {
|
||||
let pdfHandler = Zotero.Prefs.get("fileHandler.pdf");
|
||||
// Zotero PDF reader
|
||||
if (!pdfHandler) {
|
||||
await Zotero.Reader.open(
|
||||
itemID,
|
||||
extraData && extraData.location,
|
||||
|
@ -3912,15 +3889,18 @@ var ZoteroPane = new function()
|
|||
);
|
||||
return;
|
||||
}
|
||||
let pdfHandler = Zotero.Prefs.get("fileHandler.pdf");
|
||||
if (pdfHandler) {
|
||||
if (await OS.File.exists(pdfHandler)) {
|
||||
Zotero.launchFileWithApplication(path, pdfHandler);
|
||||
return;
|
||||
// Custom PDF handler
|
||||
if (pdfHandler != 'system') {
|
||||
try {
|
||||
if (await OS.File.exists(pdfHandler)) {
|
||||
Zotero.launchFileWithApplication(path, pdfHandler);
|
||||
return;
|
||||
}
|
||||
}
|
||||
else {
|
||||
Zotero.logError(`${pdfHandler} not found -- launching file normally`);
|
||||
catch (e) {
|
||||
Zotero.logError(e);
|
||||
}
|
||||
Zotero.logError(`${pdfHandler} not found -- launching file normally`);
|
||||
}
|
||||
}
|
||||
Zotero.launchFile(path);
|
||||
|
|
|
@ -50,7 +50,6 @@
|
|||
<!ENTITY zotero.tabs.attachments.label "Attachments">
|
||||
<!ENTITY zotero.tabs.tags.label "Tags">
|
||||
<!ENTITY zotero.tabs.related.label "Related">
|
||||
<!ENTITY zotero.notes.separate "Edit in a separate window">
|
||||
|
||||
<!ENTITY zotero.toolbar.duplicate.label "Show Duplicates">
|
||||
<!ENTITY zotero.collections.showUnfiledItems "Show Unfiled Items">
|
||||
|
|
|
@ -394,7 +394,6 @@ pane.item.notes.allNotes = All Notes
|
|||
pane.item.notes.untitled = Untitled Note
|
||||
pane.item.notes.delete.confirm = Are you sure you want to delete this note?
|
||||
pane.item.notes.count = %1$S note;%1$S notes
|
||||
pane.item.notes.editingInWindow = Editing in separate window
|
||||
pane.item.notes.ignoreMissingImage = Some note images are missing and cannot be copied.
|
||||
pane.item.attachments.rename.title = New title:
|
||||
pane.item.attachments.rename.renameAssociatedFile = Rename associated file
|
||||
|
|
|
@ -178,7 +178,6 @@ pref("extensions.zotero.pane.persist", "");
|
|||
|
||||
// Custom file handlers
|
||||
pref("extensions.zotero.fileHandler.pdf", "");
|
||||
pref("extensions.zotero.beta.zotero6", false);
|
||||
|
||||
// File/URL opening executable if launch() fails
|
||||
pref("extensions.zotero.fallbackLauncher.unix", "/usr/bin/xdg-open");
|
||||
|
|
|
@ -935,6 +935,10 @@ async function importPDFAttachment(parentItem, options = {}) {
|
|||
|
||||
async function createAnnotation(type, parentItem, options = {}) {
|
||||
var annotation = new Zotero.Item('annotation');
|
||||
annotation.libraryID = parentItem.libraryID;
|
||||
if (options.version != undefined) {
|
||||
annotation.version = options.version;
|
||||
}
|
||||
annotation.parentID = parentItem.id;
|
||||
annotation.annotationType = type;
|
||||
if (type == 'highlight') {
|
||||
|
@ -958,13 +962,21 @@ async function createAnnotation(type, parentItem, options = {}) {
|
|||
[314.4, 412.8, 556.2, 609.6]
|
||||
]
|
||||
});
|
||||
if (options.createdByUserID) {
|
||||
annotation.createdByUserID = options.createdByUserID;
|
||||
}
|
||||
if (options.isExternal) {
|
||||
annotation.annotationIsExternal = options.isExternal;
|
||||
}
|
||||
if (options.tags) {
|
||||
annotation.setTags(options.tags);
|
||||
}
|
||||
await annotation.saveTx();
|
||||
if (options.synced !== undefined) {
|
||||
annotation.synced = options.synced;
|
||||
}
|
||||
await annotation.saveTx({
|
||||
skipEditCheck: true
|
||||
});
|
||||
return annotation;
|
||||
}
|
||||
|
||||
|
|
|
@ -159,7 +159,6 @@ user_pref("dom.max_chrome_script_run_time", 0);
|
|||
// It would be better to leave this on and handle it in Sinon's FakeXMLHttpRequest
|
||||
user_pref("extensions.zotero.sync.server.compressData", false);
|
||||
user_pref("extensions.zotero.automaticScraperUpdates", false);
|
||||
user_pref("extensions.zotero.beta.zotero6", true);
|
||||
user_pref("extensions.zotero.debug.log", $DEBUG);
|
||||
user_pref("extensions.zotero.debug.level", $DEBUG_LEVEL);
|
||||
user_pref("extensions.zotero.debug.time", $DEBUG);
|
||||
|
|
|
@ -126,14 +126,13 @@ describe("Zotero.Annotations", function() {
|
|||
exampleNote.libraryID = item.libraryID;
|
||||
exampleImage.libraryID = item.libraryID;
|
||||
|
||||
// Disabled while group annotations are disabled
|
||||
/*group = await getGroup();
|
||||
group = await getGroup();
|
||||
exampleGroupHighlight.libraryID = group.libraryID;
|
||||
groupItem = await createDataObject('item', { libraryID: group.libraryID });
|
||||
groupAttachment = await importFileAttachment(
|
||||
'test.pdf',
|
||||
{ libraryID: group.libraryID, parentID: groupItem.id }
|
||||
);*/
|
||||
);
|
||||
});
|
||||
|
||||
describe("#toJSON()", function () {
|
||||
|
@ -236,11 +235,11 @@ describe("Zotero.Annotations", function() {
|
|||
await annotation.eraseTx();
|
||||
});
|
||||
|
||||
it.skip("should generate an object for a highlight by another user in a group library", async function () {
|
||||
await Zotero.Users.setName(12345, 'Kate Smith');
|
||||
it("should generate an object for a highlight by another user in a group library", async function () {
|
||||
await Zotero.Users.setName(12345, 'First Last');
|
||||
|
||||
var annotation = new Zotero.Item('annotation');
|
||||
annotation.libraryID = group.libraryID;
|
||||
annotation.libraryID = groupAttachment.libraryID;
|
||||
annotation.key = exampleGroupHighlight.key;
|
||||
await annotation.loadPrimaryData();
|
||||
annotation.createdByUserID = 12345;
|
||||
|
@ -250,13 +249,17 @@ describe("Zotero.Annotations", function() {
|
|||
let itemProp = 'annotation' + prop[0].toUpperCase() + prop.substr(1);
|
||||
annotation[itemProp] = exampleGroupHighlightAlt[prop];
|
||||
}
|
||||
await annotation.saveTx();
|
||||
await annotation.saveTx({
|
||||
skipEditCheck: true
|
||||
});
|
||||
var json = await Zotero.Annotations.toJSON(annotation);
|
||||
|
||||
assert.isFalse(json.isAuthor);
|
||||
assert.equal(json.authorName, 'Kate Smith');
|
||||
assert.equal(json.authorName, 'First Last');
|
||||
|
||||
await annotation.eraseTx();
|
||||
await annotation.eraseTx({
|
||||
skipEditCheck: true
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
|
|
Loading…
Reference in a new issue