Remove dead collection plumbing for window-opened notes

The collections passed through Notes.open into the note window were never
read -- the note editor has no collections setter and EditorInstance.collection
is never assigned on this path -- so they had no effect. New notes are still
added to the selected collection(s) directly in newNote().
This commit is contained in:
Dan Stillman 2026-06-16 12:02:00 -04:00
parent cda229509a
commit ee24c0b468
3 changed files with 4 additions and 23 deletions

View file

@ -41,7 +41,6 @@ async function onLoad() {
}
let itemID = parseInt(io.itemID);
let collectionIDs = io.collectionIDs.split(",").filter(x => x).map(x => parseInt(x));
let parentItemKey = io.parentItemKey;
let ref;
@ -65,10 +64,6 @@ async function onLoad() {
ref = Zotero.Items.getByLibraryAndKey(parentItemKey);
noteEditor.parentItem = ref;
}
else if (collectionIDs.length) {
// DEBUG: Was 'collection', but seemingly unused?
noteEditor.collections = Zotero.Collections.get(collectionIDs);
}
noteEditor.refresh();
}

View file

@ -43,7 +43,7 @@ Zotero.Notes = new function () {
* @returns {Promise<Zotero.EditorInstance | null>} Instance of Zotero.EditorInstance for the note.
* If the note tab is opened in background (unloaded), returns null.
*/
this.open = async function (itemID, location, { title, tabIndex, tabID, openInBackground, openInWindow, allowDuplicate, preventJumpback, parentItemKey, collections } = {}) {
this.open = async function (itemID, location, { title, tabIndex, tabID, openInBackground, openInWindow, allowDuplicate, preventJumpback, parentItemKey } = {}) {
let { libraryID } = Zotero.Items.getLibraryAndKeyFromID(itemID);
let library = Zotero.Libraries.get(libraryID);
let win = Zotero.getMainWindow();
@ -117,14 +117,10 @@ Zotero.Notes = new function () {
if (itemID) {
// Create a name for this window so we can focus it later
//
// Collection is only used on new notes, so we don't need to
// include it in the name
name = 'zotero-note-' + itemID;
}
let collectionIDs = collections ? collections.map(c => c.id).join(',') : '';
let io = { itemID, parentItemKey, collectionIDs, location, _initPromise: Zotero.Promise.defer() };
let io = { itemID, parentItemKey, location, _initPromise: Zotero.Promise.defer() };
Services.ww.openWindow(
win,
'chrome://zotero/content/note.xhtml',

View file

@ -4787,14 +4787,7 @@ var ZoteroPane = new function () {
if (popup) {
// TODO: _text_
let collections = this.getSelectedCollections();
this.openNote(
null,
{
collections: collections.length ? collections : undefined,
parentKey
}
);
this.openNote(null, { parentKey });
return null;
}
@ -4888,12 +4881,10 @@ var ZoteroPane = new function () {
this.openNote = function (itemID, options = {
collections: undefined,
parentKey: undefined,
openInWindow: undefined
}) {
let {
collections,
parentKey,
openInWindow,
} = options;
@ -4903,7 +4894,6 @@ var ZoteroPane = new function () {
return Zotero.Notes.open(itemID, undefined, {
openInWindow,
collections,
});
};