diff --git a/chrome/content/zotero/bindings/attachmentbox.xml b/chrome/content/zotero/bindings/attachmentbox.xml index 6424db615c..917c99e2a6 100644 --- a/chrome/content/zotero/bindings/attachmentbox.xml +++ b/chrome/content/zotero/bindings/attachmentbox.xml @@ -362,13 +362,14 @@ var type = Zotero.Libraries.get(this.item.libraryID).libraryType; var switherDeck = this._id('attachment-note-editor-switcher'); - switherDeck.selectedIndex = type == 'user' ? 1 : 0; // Note editor - if (type == 'user') { - var noteEditor = this._id('attachment-note-editor'); + if (type == 'group' || !Zotero.isPDFBuild) { + var noteEditor = this._id('attachment-note-editor-old'); + switherDeck.selectedIndex = 0; } else { - var noteEditor = this._id('attachment-note-editor-old'); + var noteEditor = this._id('attachment-note-editor'); + switherDeck.selectedIndex = 1; } if (this.displayNote && (this.displayNoteIfEmpty || this.item.note != '')) { diff --git a/chrome/content/zotero/bindings/merge.xml b/chrome/content/zotero/bindings/merge.xml index aa7fdba580..a1b4c3cb88 100644 --- a/chrome/content/zotero/bindings/merge.xml +++ b/chrome/content/zotero/bindings/merge.xml @@ -335,7 +335,9 @@ break; case 'note': - elementName = 'zoteronoteeditor'; + var type = Zotero.Libraries.get(this.libraryID).libraryType; + var useOld = type == 'group' || !Zotero.isPDFBuild; + elementName = useOld ? 'oldzoteronoteeditor' : 'zoteronoteeditor'; break; default: diff --git a/chrome/content/zotero/itemPane.js b/chrome/content/zotero/itemPane.js index a09227341b..7103353c76 100644 --- a/chrome/content/zotero/itemPane.js +++ b/chrome/content/zotero/itemPane.js @@ -255,9 +255,9 @@ var ZoteroItemPane = new function() { } - this.switchEditorEngine = function (type) { + this.switchEditorEngine = function (useOld) { var switherDeck = document.getElementById('zotero-note-editor-switcher'); - switherDeck.selectedIndex = type == 'user' ? 1 : 0; + switherDeck.selectedIndex = useOld ? 0 : 1; }; @@ -265,27 +265,20 @@ var ZoteroItemPane = new function() { _selectedNoteID = item.id; var type = Zotero.Libraries.get(item.libraryID).libraryType; - if (type == 'user') { - var noteEditor = document.getElementById('zotero-note-editor'); - - noteEditor.mode = editable ? 'edit' : 'view'; - noteEditor.parent = null; - noteEditor.item = item; - } - else { + if (type == 'group' || !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; @@ -294,6 +287,12 @@ var ZoteroItemPane = new function() { noteEditor.clearUndo(); } } + else { + var noteEditor = document.getElementById('zotero-note-editor'); + noteEditor.mode = editable ? 'edit' : 'view'; + noteEditor.parent = null; + noteEditor.item = item; + } document.getElementById('zotero-view-note-button').hidden = !editable; document.getElementById('zotero-item-pane-content').selectedIndex = 2; @@ -312,7 +311,7 @@ var ZoteroItemPane = new function() { var selectedNote = Zotero.Items.get(_selectedNoteID); var type = Zotero.Libraries.get(selectedNote.libraryID).libraryType; - if (type == 'group') { + if (type == 'group' || !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. // diff --git a/chrome/content/zotero/note.js b/chrome/content/zotero/note.js index a33711c94e..120df37099 100644 --- a/chrome/content/zotero/note.js +++ b/chrome/content/zotero/note.js @@ -27,9 +27,9 @@ var noteEditor; var notifierUnregisterID; var type; -function switchEditorEngine(type) { +function switchEditorEngine(useOld) { var switherDeck = document.getElementById('zotero-note-editor-switcher'); - switherDeck.selectedIndex = type === 'user' ? 1 : 0; + switherDeck.selectedIndex = useOld ? 0 : 1; } async function onLoad() { @@ -58,8 +58,8 @@ async function onLoad() { } } type = Zotero.Libraries.get(libraryID).libraryType; - switchEditorEngine(type); - if (type === 'group') { + switchEditorEngine(type == 'group' || !Zotero.isPDFBuild); + if (type == 'group' || !Zotero.isPDFBuild) { noteEditor = document.getElementById('zotero-note-editor-old'); } else { @@ -106,14 +106,14 @@ function onError() { function onUnload() { Zotero.Notifier.unregisterObserver(notifierUnregisterID); - if (type == 'user') { - noteEditor.saveSync(); - } - else { + if (type == 'group' || !Zotero.isPDFBuild) { if (noteEditor.item) { window.opener.ZoteroPane.onNoteWindowClosed(noteEditor.item.id, noteEditor.value); } } + else { + noteEditor.saveSync(); + } } var NotifyCallback = { diff --git a/chrome/content/zotero/zoteroPane.js b/chrome/content/zotero/zoteroPane.js index 75dea04ed0..7588b03e1e 100644 --- a/chrome/content/zotero/zoteroPane.js +++ b/chrome/content/zotero/zoteroPane.js @@ -1207,7 +1207,9 @@ var ZoteroPane = new function() if (Zotero.isPDFBuild) { Zotero_Tabs.rename('zotero-pane', collectionTreeRow.getName()); } - ZoteroItemPane.switchEditorEngine(Zotero.Libraries.get(collectionTreeRow.ref.libraryID).libraryType); + + let type = Zotero.Libraries.get(collectionTreeRow.ref.libraryID).libraryType; + ZoteroItemPane.switchEditorEngine(type == 'group' || !Zotero.isPDFBuild); // Clear quick search and tag selector when switching views document.getElementById('zotero-tb-search').value = "";