Set a default annotation color if not assigned
https://forums.zotero.org/discussion/104249/sync-issue-on-ipados
This commit is contained in:
parent
b33d3ec799
commit
cadfca7475
3 changed files with 19 additions and 1 deletions
|
@ -33,6 +33,8 @@ Zotero.Annotations = new function () {
|
||||||
Zotero.defineProperty(this, 'ANNOTATION_TYPE_IMAGE', { value: 3 });
|
Zotero.defineProperty(this, 'ANNOTATION_TYPE_IMAGE', { value: 3 });
|
||||||
Zotero.defineProperty(this, 'ANNOTATION_TYPE_INK', { value: 4 });
|
Zotero.defineProperty(this, 'ANNOTATION_TYPE_INK', { value: 4 });
|
||||||
|
|
||||||
|
Zotero.defineProperty(this, 'DEFAULT_COLOR', { value: '#ffd400' });
|
||||||
|
|
||||||
Zotero.defineProperty(this, 'PROPS', {
|
Zotero.defineProperty(this, 'PROPS', {
|
||||||
value: ['type', 'authorName', 'text', 'comment', 'color', 'pageLabel', 'sortIndex', 'position'],
|
value: ['type', 'authorName', 'text', 'comment', 'color', 'pageLabel', 'sortIndex', 'position'],
|
||||||
writable: false
|
writable: false
|
||||||
|
|
|
@ -1935,7 +1935,7 @@ Zotero.Item.prototype._saveData = Zotero.Promise.coroutine(function* (env) {
|
||||||
authorName || null,
|
authorName || null,
|
||||||
text || null,
|
text || null,
|
||||||
comment || null,
|
comment || null,
|
||||||
color || null,
|
color || Zotero.Annotations.DEFAULT_COLOR,
|
||||||
pageLabel || null,
|
pageLabel || null,
|
||||||
sortIndex,
|
sortIndex,
|
||||||
position,
|
position,
|
||||||
|
|
|
@ -1400,6 +1400,22 @@ describe("Zotero.Item", function () {
|
||||||
assert.isFalse(annotation.hasChanged());
|
assert.isFalse(annotation.hasChanged());
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it("should assign a default color", async function () {
|
||||||
|
var annotation = new Zotero.Item('annotation');
|
||||||
|
annotation.parentID = attachment.id;
|
||||||
|
annotation.annotationType = 'highlight';
|
||||||
|
annotation.annotationText = "This is highlighted text.";
|
||||||
|
annotation.annotationSortIndex = '00015|002431|00000';
|
||||||
|
annotation.annotationPosition = JSON.stringify({
|
||||||
|
pageIndex: 123,
|
||||||
|
rects: [
|
||||||
|
[314.4, 412.8, 556.2, 609.6]
|
||||||
|
]
|
||||||
|
});
|
||||||
|
await annotation.saveTx();
|
||||||
|
assert.equal(annotation.annotationColor, '#ffd400');
|
||||||
|
});
|
||||||
|
|
||||||
it("should save a note annotation", async function () {
|
it("should save a note annotation", async function () {
|
||||||
var annotation = new Zotero.Item('annotation');
|
var annotation = new Zotero.Item('annotation');
|
||||||
annotation.parentID = attachment.id;
|
annotation.parentID = attachment.id;
|
||||||
|
|
Loading…
Add table
Reference in a new issue