Replace occurrences of .getNote()
with .note
This commit is contained in:
parent
ebc53a2bbc
commit
4142f4b316
12 changed files with 36 additions and 36 deletions
|
@ -362,7 +362,7 @@
|
|||
|
||||
// Note editor
|
||||
var noteEditor = this._id('attachment-note-editor');
|
||||
if (this.displayNote && (this.displayNoteIfEmpty || this.item.getNote() != '')) {
|
||||
if (this.displayNote && (this.displayNoteIfEmpty || this.item.note != '')) {
|
||||
noteEditor.linksOnTop = true;
|
||||
noteEditor.hidden = false;
|
||||
|
||||
|
|
|
@ -101,12 +101,12 @@
|
|||
}
|
||||
}
|
||||
else {
|
||||
let curValue = this.item.getNote();
|
||||
let curValue = this.item.note;
|
||||
if (curValue !== this._lastHtmlValue) {
|
||||
this.initEditor();
|
||||
}
|
||||
}
|
||||
this._lastHtmlValue = this.item.getNote();
|
||||
this._lastHtmlValue = this.item.note;
|
||||
}
|
||||
|
||||
this._id('links-container').hidden = !(this.displayTags && this.displayRelated);
|
||||
|
@ -192,7 +192,7 @@
|
|||
if (!val) this._item = null;
|
||||
if (this._item && this._item.id === val.id) return;
|
||||
|
||||
this._lastHtmlValue = val.getNote();
|
||||
this._lastHtmlValue = val.note;
|
||||
|
||||
this._editor = new Zotero.NoteEditor();
|
||||
this._editor.init({
|
||||
|
|
|
@ -31,7 +31,7 @@ class NoteEditor {
|
|||
|
||||
this.window.addEventListener('message', this.listener);
|
||||
this.quickFormatWindow = null;
|
||||
let data = this.state ? { state: this.state } : { html: this.item.getNote() };
|
||||
let data = this.state ? { state: this.state } : { html: this.item.note };
|
||||
this.postMessage({
|
||||
op: 'init', ...data,
|
||||
libraryId: this.item.libraryID,
|
||||
|
|
|
@ -2019,7 +2019,7 @@ Zotero.Item.prototype.numNotes = function(includeTrashed, includeEmbedded) {
|
|||
if (includeEmbedded) {
|
||||
// Include embedded attachment notes that aren't empty
|
||||
num += Zotero.Items.get(this.getAttachments(includeTrashed))
|
||||
.filter(x => x.getNote() !== '').length;
|
||||
.filter(x => x.note !== '').length;
|
||||
}
|
||||
return num;
|
||||
}
|
||||
|
@ -2073,7 +2073,7 @@ Zotero.Item.prototype.hasNote = Zotero.Promise.coroutine(function* () {
|
|||
Zotero.defineProperty(Zotero.Item.prototype, 'note', {
|
||||
get: function () {
|
||||
if (!this.isNote() && !this.isAttachment()) {
|
||||
throw new Error("getNote() can only be called on notes and attachments "
|
||||
throw new Error(".note can only be accessed on notes and attachments "
|
||||
+ `(${this.libraryID}/${this.key} is a ${Zotero.ItemTypes.getName(this.itemTypeID)})`);
|
||||
}
|
||||
|
||||
|
|
|
@ -80,7 +80,7 @@ Zotero.Notes = new function() {
|
|||
* @returns {Promise}
|
||||
*/
|
||||
this.updateURIs = async (item) => {
|
||||
let html = item.getNote();
|
||||
let html = item.note;
|
||||
let num = 0;
|
||||
// "uri":"http://zotero.org/users/local/(.+?)/items/(.+?)"
|
||||
let regex = new RegExp(/%22uri%22%3A%22http%3A%2F%2Fzotero.org%2Fusers%2Flocal%2F(.+?)%2Fitems%2F(.+?)%22/g);
|
||||
|
|
|
@ -3509,7 +3509,7 @@ Zotero.ItemTreeRow.prototype.numNotes = function() {
|
|||
return 0;
|
||||
}
|
||||
if (this.ref.isAttachment()) {
|
||||
return this.ref.getNote() !== '' ? 1 : 0;
|
||||
return this.ref.note !== '' ? 1 : 0;
|
||||
}
|
||||
return this.ref.numNotes(false, true) || 0;
|
||||
}
|
||||
|
|
|
@ -292,7 +292,7 @@ Zotero.QuickCopy = new function() {
|
|||
div.className = "zotero-note";
|
||||
// AMO reviewer: This documented is never rendered (and the inserted markup
|
||||
// is sanitized anyway)
|
||||
div.insertAdjacentHTML('afterbegin', notes[i].getNote());
|
||||
div.insertAdjacentHTML('afterbegin', notes[i].note);
|
||||
container.appendChild(div);
|
||||
textContainer.appendChild(textDoc.importNode(div, true));
|
||||
}
|
||||
|
|
|
@ -3490,7 +3490,7 @@ var ZoteroPane = new function()
|
|||
var items = this.getSelectedItems();
|
||||
|
||||
if (this.itemsView.selection.count == 1 && items[0] && items[0].isNote()) {
|
||||
var note = items[0].getNote()
|
||||
var note = items[0].note;
|
||||
|
||||
items[0].setNote(note + text);
|
||||
yield items[0].saveTx();
|
||||
|
|
|
@ -1327,7 +1327,7 @@ describe("Zotero.Attachments", function() {
|
|||
assert.equal(newAttachment.attachmentContentType, 'application/pdf');
|
||||
assert.isTrue(await newAttachment.fileExists());
|
||||
assert.equal(newAttachment.getField('title'), 'Title');
|
||||
assert.equal(newAttachment.getNote(), 'Note');
|
||||
assert.equal(newAttachment.note, 'Note');
|
||||
assert.sameDeepMembers(newAttachment.getTags(), [{ tag: 'Tag' }]);
|
||||
assert.sameMembers(newAttachment.relatedItems, [relatedItem.key]);
|
||||
assert.sameMembers(relatedItem.relatedItems, [newAttachment.key]);
|
||||
|
|
|
@ -227,21 +227,21 @@ describe("Zotero.DataObject", function() {
|
|||
var item = new Zotero.Item('book');
|
||||
var id = yield item.saveTx();
|
||||
yield item.loadAllData();
|
||||
assert.throws(item.getNote.bind(item), 'getNote() can only be called on notes and attachments');
|
||||
assert.throws(item.getNote.bind(item), 'note can only be called on notes and attachments');
|
||||
})
|
||||
|
||||
it("should load data on an attachment item", function* () {
|
||||
var item = new Zotero.Item('attachment');
|
||||
var id = yield item.saveTx();
|
||||
yield item.loadAllData();
|
||||
assert.equal(item.getNote(), '');
|
||||
assert.equal(item.note, '');
|
||||
})
|
||||
|
||||
it("should load data on a note item", function* () {
|
||||
var item = new Zotero.Item('note');
|
||||
var id = yield item.saveTx();
|
||||
yield item.loadAllData();
|
||||
assert.equal(item.getNote(), '');
|
||||
assert.equal(item.note, '');
|
||||
})
|
||||
})
|
||||
|
||||
|
|
|
@ -339,7 +339,7 @@ describe("Zotero.Sync.Data.Engine", function () {
|
|||
yield assertInCache(obj);
|
||||
|
||||
obj = yield Zotero.Items.getByLibraryAndKeyAsync(userLibraryID, "BBBBBBBB");
|
||||
assert.equal(obj.getNote(), 'This is a note.');
|
||||
assert.equal(obj.note, 'This is a note.');
|
||||
assert.equal(obj.parentItemID, parentItemID);
|
||||
assert.equal(obj.version, 3);
|
||||
assert.isTrue(obj.synced);
|
||||
|
@ -513,7 +513,7 @@ describe("Zotero.Sync.Data.Engine", function () {
|
|||
yield assertInCache(obj);
|
||||
|
||||
obj = Zotero.Items.getByLibraryAndKey(libraryID, "BBBBBBBB");
|
||||
assert.equal(obj.getNote(), 'This is a note.');
|
||||
assert.equal(obj.note, 'This is a note.');
|
||||
assert.equal(obj.parentItemID, parentItemID);
|
||||
assert.equal(obj.version, 3);
|
||||
assert.isTrue(obj.synced);
|
||||
|
@ -3487,7 +3487,7 @@ describe("Zotero.Sync.Data.Engine", function () {
|
|||
await obj.saveTx({
|
||||
skipDateModifiedUpdate: true
|
||||
});
|
||||
values[i].left.note = obj.getNote();
|
||||
values[i].left.note = obj.note;
|
||||
values[i].left.version = obj.getField('version');
|
||||
}
|
||||
|
||||
|
@ -3529,8 +3529,8 @@ describe("Zotero.Sync.Data.Engine", function () {
|
|||
await engine._downloadObjects('item', objects.map(o => o.key));
|
||||
await crPromise;
|
||||
|
||||
assert.equal(objects[0].getNote(), values[0].right.note);
|
||||
assert.equal(objects[1].getNote(), values[1].left.note);
|
||||
assert.equal(objects[0].note, values[0].right.note);
|
||||
assert.equal(objects[1].note, values[1].left.note);
|
||||
assert.equal(objects[0].version, values[0].right.version);
|
||||
assert.equal(objects[1].version, values[1].right.version);
|
||||
assert.isTrue(objects[0].synced);
|
||||
|
|
|
@ -213,13 +213,13 @@ describe("Zotero.Translate", function() {
|
|||
let noteIDs = newItems["Test Item"].getNotes();
|
||||
let note1 = yield Zotero.Items.getAsync(noteIDs[0]);
|
||||
assert.equal(Zotero.ItemTypes.getName(note1.itemTypeID), "note");
|
||||
assert.equal(note1.getNote(), "1 note as string");
|
||||
assert.equal(note1.note, "1 note as string");
|
||||
let note2 = yield Zotero.Items.getAsync(noteIDs[1]);
|
||||
assert.equal(Zotero.ItemTypes.getName(note2.itemTypeID), "note");
|
||||
assert.equal(note2.getNote(), "2 note as object");
|
||||
assert.equal(note2.note, "2 note as object");
|
||||
checkTestTags(note2);
|
||||
let note3 = newItems["standalone note"];
|
||||
assert.equal(note3.getNote(), "standalone note");
|
||||
assert.equal(note3.note, "standalone note");
|
||||
checkTestTags(note3);
|
||||
});
|
||||
|
||||
|
@ -323,20 +323,20 @@ describe("Zotero.Translate", function() {
|
|||
for (let savedAttachments of [[newItems["Empty PDF"], newItems["Link to zotero.org"]],
|
||||
[containedAttachments[0], containedAttachments[1]]]) {
|
||||
assert.equal(savedAttachments[0].getField("title"), "Empty PDF");
|
||||
assert.equal(savedAttachments[0].getNote(), "attachment note");
|
||||
assert.equal(savedAttachments[0].note, "attachment note");
|
||||
assert.equal(savedAttachments[0].attachmentLinkMode, Zotero.Attachments.LINK_MODE_IMPORTED_FILE);
|
||||
checkTestTags(savedAttachments[0]);
|
||||
|
||||
assert.equal(savedAttachments[1].getField("title"), "Link to zotero.org");
|
||||
assert.equal(savedAttachments[1].getField("url"), "http://www.zotero.org/");
|
||||
assert.equal(savedAttachments[1].getNote(), "attachment 2 note");
|
||||
assert.equal(savedAttachments[1].note, "attachment 2 note");
|
||||
assert.equal(savedAttachments[1].attachmentLinkMode, Zotero.Attachments.LINK_MODE_LINKED_URL);
|
||||
checkTestTags(savedAttachments[1]);
|
||||
}
|
||||
|
||||
assert.equal(containedAttachments[2].getField("title"), "Snapshot");
|
||||
assert.equal(containedAttachments[2].getField("url"), "http://www.example.com/");
|
||||
assert.equal(containedAttachments[2].getNote(), "attachment 3 note");
|
||||
assert.equal(containedAttachments[2].note, "attachment 3 note");
|
||||
assert.equal(containedAttachments[2].attachmentLinkMode, Zotero.Attachments.LINK_MODE_IMPORTED_URL);
|
||||
checkTestTags(containedAttachments[2]);
|
||||
});
|
||||
|
@ -371,7 +371,7 @@ describe("Zotero.Translate", function() {
|
|||
|
||||
assert.equal(containedAttachments[0].getField("title"), "Snapshot with missing file");
|
||||
assert.equal(containedAttachments[0].getField("url"), "http://www.example.com/");
|
||||
assert.equal(containedAttachments[0].getNote(), "attachment note");
|
||||
assert.equal(containedAttachments[0].note, "attachment note");
|
||||
assert.equal(containedAttachments[0].attachmentLinkMode, Zotero.Attachments.LINK_MODE_LINKED_URL);
|
||||
checkTestTags(containedAttachments[0]);
|
||||
});
|
||||
|
@ -548,7 +548,7 @@ describe("Zotero.Translate", function() {
|
|||
assert.equal(attachments[1].attachmentLinkMode, Zotero.Attachments.LINK_MODE_LINKED_FILE);
|
||||
assert.equal(attachments[1].attachmentContentType, 'text/html');
|
||||
assert.equal(attachments[1].attachmentCharset, 'utf-8');
|
||||
assert.equal(attachments[1].getNote(), file2URL);
|
||||
assert.equal(attachments[1].note, file2URL);
|
||||
});
|
||||
|
||||
it("import translators shouldn't save linked-file attachment with linkFiles: true if path is within current storage directory", async function () {
|
||||
|
@ -648,20 +648,20 @@ describe("Zotero.Translate", function() {
|
|||
|
||||
let link = containedAttachments["Link to zotero.org"];
|
||||
assert.equal(link.getField("url"), "http://www.zotero.org/");
|
||||
assert.equal(link.getNote(), "attachment note");
|
||||
assert.equal(link.note, "attachment note");
|
||||
assert.equal(link.attachmentLinkMode, Zotero.Attachments.LINK_MODE_LINKED_URL);
|
||||
checkTestTags(link, true);
|
||||
|
||||
let snapshot = containedAttachments["Test Snapshot"];
|
||||
assert.equal(snapshot.getField("url"), "http://127.0.0.1:23119/test/translate/test.html");
|
||||
assert.equal(snapshot.getNote(), "attachment 2 note");
|
||||
assert.equal(snapshot.note, "attachment 2 note");
|
||||
assert.equal(snapshot.attachmentLinkMode, Zotero.Attachments.LINK_MODE_IMPORTED_URL);
|
||||
assert.equal(snapshot.attachmentContentType, "text/html");
|
||||
checkTestTags(snapshot, true);
|
||||
|
||||
let pdf = containedAttachments["Test PDF"];
|
||||
assert.equal(pdf.getField("url"), "http://127.0.0.1:23119/test/translate/test.pdf");
|
||||
assert.equal(pdf.getNote(), "attachment 3 note");
|
||||
assert.equal(pdf.note, "attachment 3 note");
|
||||
assert.equal(pdf.attachmentLinkMode, Zotero.Attachments.LINK_MODE_IMPORTED_URL);
|
||||
assert.equal(pdf.attachmentContentType, "application/pdf");
|
||||
checkTestTags(pdf, true);
|
||||
|
@ -700,7 +700,7 @@ describe("Zotero.Translate", function() {
|
|||
|
||||
let snapshot = containedAttachments[0];
|
||||
assert.equal(snapshot.getField("url"), "http://127.0.0.1:23119/test/translate/test.html");
|
||||
assert.equal(snapshot.getNote(), "attachment note");
|
||||
assert.equal(snapshot.note, "attachment note");
|
||||
assert.equal(snapshot.attachmentLinkMode, Zotero.Attachments.LINK_MODE_IMPORTED_URL);
|
||||
assert.equal(snapshot.attachmentContentType, "text/html");
|
||||
checkTestTags(snapshot, true);
|
||||
|
@ -734,7 +734,7 @@ describe("Zotero.Translate", function() {
|
|||
|
||||
let snapshot = containedAttachments[0];
|
||||
assert.equal(snapshot.getField("url"), "http://127.0.0.1:23119/test/translate/test.html");
|
||||
assert.equal(snapshot.getNote(), "attachment note");
|
||||
assert.equal(snapshot.note, "attachment note");
|
||||
assert.equal(snapshot.attachmentLinkMode, Zotero.Attachments.LINK_MODE_IMPORTED_URL);
|
||||
assert.equal(snapshot.attachmentContentType, "text/html");
|
||||
checkTestTags(snapshot, true);
|
||||
|
@ -798,7 +798,7 @@ describe("Zotero.Translate", function() {
|
|||
let pdf = containedAttachments[0];
|
||||
assert.equal(pdf.getField("title"), "Test PDF");
|
||||
assert.equal(pdf.getField("url"), "http://127.0.0.1:23119/test/translate/test.pdf");
|
||||
assert.equal(pdf.getNote(), "attachment note");
|
||||
assert.equal(pdf.note, "attachment note");
|
||||
assert.equal(pdf.attachmentLinkMode, Zotero.Attachments.LINK_MODE_IMPORTED_URL);
|
||||
checkTestTags(pdf, true);
|
||||
});
|
||||
|
@ -901,7 +901,7 @@ describe("Zotero.Translate", function() {
|
|||
|
||||
var snapshot = containedAttachments[0];
|
||||
assert.equal(snapshot.getField("url"), url + '?t');
|
||||
assert.equal(snapshot.getNote(), "attachment note");
|
||||
assert.equal(snapshot.note, "attachment note");
|
||||
assert.equal(snapshot.attachmentLinkMode, Zotero.Attachments.LINK_MODE_IMPORTED_URL);
|
||||
assert.equal(snapshot.attachmentContentType, "text/html");
|
||||
checkTestTags(snapshot, true);
|
||||
|
@ -951,7 +951,7 @@ describe("Zotero.Translate", function() {
|
|||
|
||||
var snapshot = containedAttachments[0];
|
||||
assert.equal(snapshot.getField("url"), url);
|
||||
assert.equal(snapshot.getNote(), "attachment note");
|
||||
assert.equal(snapshot.note, "attachment note");
|
||||
assert.equal(snapshot.attachmentLinkMode, Zotero.Attachments.LINK_MODE_IMPORTED_URL);
|
||||
assert.equal(snapshot.attachmentContentType, "text/html");
|
||||
checkTestTags(snapshot, true);
|
||||
|
|
Loading…
Reference in a new issue