Safer fix for external note focus issues
Follow-up to96e96c0348
and07efe0304e
This commit is contained in:
parent
07efe0304e
commit
3dcdd7f2ba
|
@ -25,7 +25,7 @@
|
||||||
|
|
||||||
var ZoteroItemPane = new function() {
|
var ZoteroItemPane = new function() {
|
||||||
var _lastItem, _itemBox, _notesLabel, _notesButton, _notesList, _tagsBox, _relatedBox;
|
var _lastItem, _itemBox, _notesLabel, _notesButton, _notesList, _tagsBox, _relatedBox;
|
||||||
var _selectedNote;
|
var _selectedNoteID;
|
||||||
var _translationTarget;
|
var _translationTarget;
|
||||||
var _noteIDs;
|
var _noteIDs;
|
||||||
|
|
||||||
|
@ -61,8 +61,6 @@ var ZoteroItemPane = new function() {
|
||||||
* Load a top-level item
|
* Load a top-level item
|
||||||
*/
|
*/
|
||||||
this.viewItem = Zotero.Promise.coroutine(function* (item, mode, index) {
|
this.viewItem = Zotero.Promise.coroutine(function* (item, mode, index) {
|
||||||
_selectedNote = null;
|
|
||||||
|
|
||||||
if (!index) {
|
if (!index) {
|
||||||
index = 0;
|
index = 0;
|
||||||
}
|
}
|
||||||
|
@ -226,7 +224,7 @@ var ZoteroItemPane = new function() {
|
||||||
|
|
||||||
|
|
||||||
this.onNoteSelected = function (item, editable) {
|
this.onNoteSelected = function (item, editable) {
|
||||||
_selectedNote = item;
|
_selectedNoteID = item.id;
|
||||||
|
|
||||||
// If an external note window is open for this item, don't show the editor
|
// If an external note window is open for this item, don't show the editor
|
||||||
if (ZoteroPane.findNoteWindow(item.id)) {
|
if (ZoteroPane.findNoteWindow(item.id)) {
|
||||||
|
@ -263,19 +261,20 @@ var ZoteroItemPane = new function() {
|
||||||
* Select the parent item and open the note editor
|
* Select the parent item and open the note editor
|
||||||
*/
|
*/
|
||||||
this.openNoteWindow = async function () {
|
this.openNoteWindow = async function () {
|
||||||
var noteID = _selectedNote.id;
|
var selectedNote = Zotero.Items.get(_selectedNoteID);
|
||||||
|
|
||||||
// We don't want to show the note in two places, since it causes unnecessary UI updates
|
// 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.
|
// and can result in weird bugs where note content gets lost.
|
||||||
//
|
//
|
||||||
// If this is a child note, select the parent
|
// If this is a child note, select the parent
|
||||||
if (_selectedNote.parentID) {
|
if (selectedNote.parentID) {
|
||||||
await ZoteroPane.selectItem(_selectedNote.parentID);
|
await ZoteroPane.selectItem(selectedNote.parentID);
|
||||||
}
|
}
|
||||||
// Otherwise, hide note and replace with a message that we're editing externally
|
// Otherwise, hide note and replace with a message that we're editing externally
|
||||||
else {
|
else {
|
||||||
this.showNoteWindowMessage();
|
this.showNoteWindowMessage();
|
||||||
}
|
}
|
||||||
ZoteroPane.openNoteWindow(noteID);
|
ZoteroPane.openNoteWindow(selectedNote.id);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user