Commit graph

1014 commits

Author SHA1 Message Date
Dan Stillman
79950ecfe5 Exclude annotations from library export
We'll want to support this eventually, but for now they would just break
translation.
2021-03-02 18:10:44 -05:00
Dan Stillman
2d2062a63d Block saving of annotations and embedded images in groups
Both should already be disabled via the UI, but just in case there's
some way they sneak through
2021-03-02 18:10:44 -05:00
Adomas Venčkauskas
0fc9037a54 Add a version of citation dialog for citing notes 2021-03-02 18:10:44 -05:00
Dan Stillman
73ba5f9ffe Auto-sync after setting change 2021-03-02 18:10:44 -05:00
Dan Stillman
77ea19277d Remove embedded-image attachment under annotation in test 2021-03-02 18:10:44 -05:00
Dan Stillman
651aabc4dc Prevent setting parent item to non-regular item
Except for embedded-image attachments under notes and annotations under
attachments
2021-03-02 18:10:44 -05:00
Dan Stillman
8b57d0000b Don't orphan embedded-image attachments in schema integrity check! 2021-03-02 18:10:44 -05:00
Dan Stillman
eb865e2625 setAttachmentPageIndex() → setAttachmentLastPageIndex() 2021-03-02 18:10:44 -05:00
Dan Stillman
c8ee3196cd Replace attachmentPageIndex with synced-setting-based mechanism
The page index needs to be per-person in group libraries, and it should
still work in read-only libraries, so it doesn't make sense to store it
on the item. This uses a synced setting in the user's library instead.
2021-03-02 18:10:44 -05:00
Dan Stillman
4a4a54da7b Clear annotation change state after save 2021-03-02 17:58:28 -05:00
Dan Stillman
98f9a99126 Fix annotation tests after adding isExternal to annotation JSON 2021-03-02 17:58:28 -05:00
Dan Stillman
9f954488c6 Delete cache image when image annotation position changes 2021-03-02 17:58:28 -05:00
Dan Stillman
89d9efdec7 Use seconds instead of ms for attachmentLastProcessedModificationTime 2021-03-02 17:58:28 -05:00
Dan Stillman
88f886cb30 Don't delete all annotations when updating attachment item 2021-03-02 17:58:28 -05:00
Dan Stillman
857b413df1 Don't add non-syncing items to sync delete log
Currently just external annotations
2021-03-02 17:58:28 -05:00
Dan Stillman
226fc90308 Switch to cache files for image annotations
Instead of embedded-image attachments

Create with Zotero.Annotations.saveCacheImage({ libraryID, key }, blob)
2021-03-02 17:58:28 -05:00
Dan Stillman
8c464a7a8b Add options argument for Zotero.File.createDirectoryIfMissingAsync()
To allow passing 'from' argument through to OS.File.makeDir()
2021-03-02 17:58:28 -05:00
Dan Stillman
ebc0ca2462 Add annotationIsExternal property to annotations 2021-03-02 17:58:28 -05:00
Martynas Bagdonas
5266734ac9 Fix note editor tests 2021-03-02 17:58:28 -05:00
Dan Stillman
1f2408a9c5 Fix ZFS tests after removing format=json from syncAPIClient 2021-03-02 17:58:28 -05:00
Dan Stillman
0fe6e3d055 Fix some test breakages related to .note/.getNote() changes 2021-03-02 17:58:28 -05:00
Dan Stillman
9997ece0d2 Fix annotation tests for recent changes 2021-03-02 17:58:28 -05:00
Dan Stillman
55c6de23ba Add "Include Annotations" checkbox to export options dialog
This changes the attachment saveFile() function in translators to be
async. In order for errors to be properly caught, translators will need
to be changed to make doExport() async and await on saveFile() calls.
(The translation architecture theoretically already allows doExport() to
be async.)
2021-03-02 17:58:28 -05:00
Dan Stillman
b1e324ddfb Fix marking of childItems as loaded for non-top-level items
Now that attachments and notes can have child items too
2021-03-02 17:58:28 -05:00
Dan Stillman
6ee3863e37 Fix clearing of annotation fields 2021-03-02 17:58:28 -05:00
Dan Stillman
69958d4356 Return Zotero.Item objects from getAnnotations() instead of ids
Returning ids mirrors getAttachments() and getNotes(), but I think we
want to move towards a world where those return actual objects, even if
we need async load calls on the returned objects.
2021-03-02 17:58:28 -05:00
Dan Stillman
60cb299f40 Fix uploading of embedded-image attachments 2021-03-02 17:58:28 -05:00
Dan Stillman
f425b8d8d9 Fix image annotation test after Item.annotationImageURL removal 2021-03-02 17:58:28 -05:00
Dan Stillman
9a41dc69fe Add PDF attachment properties to Zotero.Item
- .attachmentLastProcessedModificationTime
- .attachmentPageIndex
2021-03-02 17:58:27 -05:00
Adomas Venčkauskas
51db52a5ea Changes for note insertion in non-GoogleDocs 2021-03-02 17:43:10 -05:00
Adomas Venčkauskas
2e9e655479 Add ability to cite Zotero notes.
<span class=citation data-citation=serialized-citation-data/>
elements will automatically be converted to zotero citations
2021-03-02 17:43:09 -05:00
Adomas Venčkauskas
2b3669afd8 Consolidate Integration.Fields into Integration.Session 2021-03-02 17:43:09 -05:00
Dan Stillman
ead8c6bb45 Fix Everything search after annotations
And replace ancient 'annotation' search condition with
'annotationText'/'annotationComment'
2021-03-02 17:39:39 -05:00
Dan Stillman
199619f40e Remove .noteSchemaVersion
This leaves item.note in place, rather than reverting all the
`getNote()` → `.note` changes. We can consider which we want to keep.
2021-03-02 17:36:05 -05:00
Dan Stillman
602e4c1e1f More annotation 'position' fixes 2021-03-02 17:36:05 -05:00
Dan Stillman
2536edb6ab Fix annotation 'position' handling and update additional sortIndex tests
Item.position has to be a string. It still gets passed to/from the PDF
reader as an object.
2021-03-02 17:36:05 -05:00
Dan Stillman
151a14c0a8 Update test for shortened annotation sortIndex 2021-03-02 17:36:05 -05:00
Dan Stillman
a0fb7a8583 Ignore remote noteSchemaVersion: 0 for items with no local note
E.g., embedded attachment notes with no note don't have an itemNotes row
and don't output noteSchemaVersion in their JSON, but they shouldn't
trigger a conflict
2021-03-02 17:36:05 -05:00
Dan Stillman
b2aee30410 Fix fromJSON() not importing parentItem for annotations 2021-03-02 17:36:05 -05:00
Dan Stillman
b8eeb3abaa Drop decimal places from annotation sortIndex 2021-03-02 17:36:05 -05:00
Dan Stillman
99b959285e Send Zotero-Schema-Version header with API requests
Set to the current global schema version
2021-03-02 17:36:05 -05:00
Dan Stillman
e133aab530 Annotation support in Item::fromJSON()/toJSON()
And clean up embedded-image handling
2021-03-02 17:36:05 -05:00
Dan Stillman
a94323fc15 Sort multiple levels of items when generating API JSON
Added Zotero.DataObjects.sortByParent() to sort child items immediately
after their parent items. Zotero.DataObjects.sortByLevel(), which is
used for collections, sorts each level together, but that's less
appropriate for items where, e.g., an embedded-image attachment should
immediately follow the note that depends on it.
2021-03-02 17:36:05 -05:00
Dan Stillman
f662b58331 Update tests after sortIndex length change 2021-03-02 17:36:05 -05:00
Dan Stillman
427a227370 Rename 'area' annotations to 'image' annotations 2021-03-02 17:36:05 -05:00
Dan Stillman
078a18f7c0 Shorten sortIndex to 22 characters 2021-03-02 17:36:05 -05:00
Dan Stillman
4142f4b316 Replace occurrences of .getNote() with .note 2021-03-02 17:36:05 -05:00
Dan Stillman
ebc53a2bbc Add noteSchemaVersion, and replace item.getNote() with .note
```
var noteContents = item.note; // was item.getNote()
var schemaVersion = item.noteSchemaVersion;

item.setNote(contents) // default to Zotero.Notes.schemaVersion
item.setNote(contents, schemaVersion) - explicit version
```
2021-03-02 17:36:05 -05:00
Dan Stillman
1c366de546 Initial annotation support 2021-03-02 17:36:05 -05:00
Dan Stillman
92ba393488 Don't clear item type set in constructor when loading primary data
Generally, don't clear the change state for primaryData when calling
loadPrimaryData() on an item that doesn't exist. Specifically, this
fixes an issue where calling loadPrimaryData() on a nonexistent item
after setting a libraryID and key would also clear any item type set in
the constructor. The same would apply for props set in the
Collection/Search constructors.
2021-03-02 17:36:05 -05:00