Commit graph

7901 commits

Author SHA1 Message Date
Dan Stillman
146e1af189 Update submodules 2021-05-14 22:44:33 -04:00
Dan Stillman
6834c6062b Fix auto-sync timeout in notes
Regression in 7ace5ea29
2021-05-14 05:13:19 -04:00
Dan Stillman
53f53779a3 Mendeley import: Don't show local import option
It's still possible to trigger a local import from a 1.18 database by
selecting the .sqlite file directly from the file option, but don't
offer it in the dialog.
2021-05-14 04:27:19 -04:00
Dan Stillman
7e23cfef96 Fix invalid imported Mendeley annotation color
After fix in 808b71832e

And require annotation colors to be 6-char hex colors going forward
2021-05-14 04:20:50 -04:00
Dan Stillman
f925f0e402 Don't cache SQL statements during initialization
From executeSQLFile()
2021-05-14 04:20:50 -04:00
Dan Stillman
d2b36c4218 Deduplicate libraryIDs passed to setSyncTimeout() for an auto-sync 2021-05-14 04:20:50 -04:00
Dan Stillman
5eb6935842 Deduplicate queued sync options
E.g., if a sync is ongoing and there are multiple item saves that would
trigger auto-sync with the same options, only queue a single sync.

7ace5ea29e fixed the main cause of this, but in case some other
saves end up happening during a sync, this will prevent them from
triggering multiple sync loops with the same options.
2021-05-14 04:20:36 -04:00
Dan Stillman
7ace5ea29e Fix unnecessary sync looping after downloading items
An extra sync loop would be performed for every object downloaded, so a
download to an empty database could result in a huge number of
unnecessary loops. This was a regression from 52932b6eb, which started
queuing auto-syncs while a sync was in progress. The fix here is to skip
auto-sync for all objects saved from a sync download.

There are two new mechanisms involved:

- Event-level notifier options that get passed to passed to notify() at
  the top level of extraData rather than being included with every
  object (e.g., because `skipAutoSync` should apply to an entire save
  transaction)
- The ability to pass event-level notifier options when initializing
  a Zotero.Notifier.Queue, such as the one used for sync downloads
2021-05-14 03:49:26 -04:00
Dan Stillman
5b0f02a12b Trigger auto-sync after item deletion
It looks like this has been broken for years.
2021-05-14 03:49:26 -04:00
Dan Stillman
9a47f74787 Specify note auto-sync timeout in save call, not in sync event listener
This will allow other operations to specify a longer timeout.
2021-05-14 03:49:26 -04:00
Tom Najdek
808b71832e Fix rgb to hex color conversion 2021-05-13 15:52:54 -04:00
Tom Najdek
833ee10516 Mendeley import: Switch to authorisation code flow via proxy 2021-05-10 14:32:02 -04:00
Dan Stillman
d3a78982f0 Add attr()/text() to search translators 2021-05-07 14:57:55 -04:00
Dan Stillman
d27b622f9f Mendeley import: Fill in Publication field on existing items if empty
It was skipped in online imports before eef0fc6fa8.
2021-05-06 15:59:46 -04:00
Dan Stillman
eef0fc6fa8 Mendeley online import: Fix "Journal" → "Publication" mapping 2021-05-06 15:46:35 -04:00
Dan Stillman
6d5b00e94c Fix descendant collections not skipping delete log
If a collection was deleted with `skipDeleteLog: true`, descendant
collections still ended up in the delete log, which could cause
constant "Reset Group and Sync" prompts.

https://forums.zotero.org/discussion/89485/warning-when-syncing-group-library
2021-05-06 03:34:09 -04:00
J. Ryan Stinnett
74b9604c7b Show full tab title on hover
Fixes https://github.com/zotero/zotero/issues/2033
2021-05-05 01:20:42 -04:00
J. Ryan Stinnett
12b100fd4b Hide tab bar for single tab case on Windows and Linux
This hides the tab bar on Windows and Linux, where it currently takes up a lot
of vertical space below the menu bar. On macOS, the tab bar remains always shown
since we don't have the menu bar and can move tabs in the window there.

Fixes https://github.com/zotero/zotero/issues/2019
2021-05-03 17:24:05 -04:00
Martynas Bagdonas
a74c012b65 Improve contextPane notes list performance 2021-05-03 21:41:41 +03:00
Dan Stillman
48d5ec240e Mendeley import: Tweak intro text 2021-04-30 07:14:19 -04:00
Dan Stillman
3877563abe Mendeley import: Clear cookies when closing OAuth window 2021-04-30 07:10:58 -04:00
Dan Stillman
57fbe61f93 Use notifier queue during Mendeley import
This dramatically speeds up Mendeley imports by avoiding UI updates.
Regular imports in fileInterface have done this for a while, but the
Mendeley importer used a fake translation object that didn't use the
passed queue.

After this change, a 10,000-item import goes from 9m30s to 2m45s, a 71%
decrease.
2021-04-29 00:46:18 -04:00
Dan Stillman
bb75fcd784 Fix support link in encrypted Mendeley database message
It started being flattened at some point.
2021-04-29 00:46:18 -04:00
Dan Stillman
3032cc6a02 Increase default basicViewer height to 700
Though this is currently persisted, so it stops being relevant as soon
as one instance of the basic viewer is resized, which maybe we don't
want.
2021-04-29 00:45:52 -04:00
Dan Stillman
d35719d0e8 Mendeley online import tweaks
- Add "(online import)" and "(local import)" next to "Mendeley Referance
  Manager" and "Mendeley Desktop", respectively
- Adjust size of OAuth window
- Use bound parameter instead of string literal for Fx78 compatibility
2021-04-29 00:45:23 -04:00
Tom Najdek
962222a5f5 Mendeley import: Import annotations from matching files in groups
All annotations in all groups are fetched and hashes are compared to
detect annotations created on the same file while it was in a group
library. Annotations created by other users are filtered out.
2021-04-29 00:40:44 -04:00
Tom Najdek
d4d2080a31 Mendeley online importer 2021-04-29 00:40:44 -04:00
Martynas Bagdonas
8799de5284 Display embedded images in item reports
Fixes #2002
2021-04-28 13:05:43 +03:00
Martynas Bagdonas
65329dbf27 Improve popup actions when read-only or multiple annotations selected
Fixes #2046
2021-04-28 12:45:53 +03:00
Martynas Bagdonas
3c3c1ba88a Add "Show in Library" option to PDF reader file menu #2032 2021-04-27 12:50:13 +03:00
Martynas Bagdonas
09125277ac Focus note-editor faster 2021-04-27 11:01:23 +03:00
Martynas Bagdonas
0b219ed8a7 Prevent opening multiple PDFs in windows when shift isn't pressed 2021-04-26 22:49:52 +03:00
Martynas Bagdonas
e7eae06d8d Optimize contextPane notes list rendering 2021-04-26 22:08:11 +03:00
Dan Stillman
76d8818bed Don't count missing annotation values as changed if empty string passed
Similar to 0d377a1c4a, this fixes an unnecessary annotation reload and
loss of unsaved typing on auto-sync immediately after an annotation is
created.
2021-04-26 03:49:59 -04:00
Dan Stillman
0d377a1c4a Clear changed state of annotation after saving color change
This was resulting in an extra 'modify' event after each sync upload.
2021-04-24 19:49:08 -04:00
Dan Stillman
ea42789206 Avoid memory leaks from caching unique DB statements
Many DB statements that were being cached included embedded ids or temp
table names, so they would permanently use memory and never get reused.
During large imports, this could result in hundreds of megabytes of
extra memory usage.

This commit marks many more statements as `noCache`, adds `noCache`
support for column and value queries, adds a log line at DB shutdown in
source builds with the number of cached statements, and adds
Zotero.DB.getCachedStatements() for auditing of cached statements.

Addresses #1531
2021-04-22 02:53:29 -04:00
Dan Stillman
12045a7cf8 Add Zotero.isSourceBuild
This should be used sparingly, since it risks missing problems in
released builds.
2021-04-21 21:37:56 -04:00
Martynas Bagdonas
1eb888d026 Fix missing itemData when creating a note from annotations 2021-04-21 16:55:44 +03:00
Martynas Bagdonas
3de7b6c5ec Trim whitespace from highlights and comments when creating a note 2021-04-21 16:52:19 +03:00
Dan Stillman
7065dacee8 Move About pane strings and URLs to ZOTERO_CONFIG 2021-04-19 18:30:21 -04:00
Dan Stillman
749e28dc1f Fix alphabetical sorting of child attachments in new databases
Broken after global schema introduction
2021-04-18 01:44:39 -04:00
Martynas Bagdonas
633710c90b Improve note-editor:
- Allow to format citations inside note-editor
- Allow quickFormat dialog to display and pick already cited items, even if an item no longer exists
- Watch and automatically update citation itemData in metadata container and re-format citations in body in opened notes
- Reorganize note metadata container handling and improve resistance to accidentally breaking it in further development
- Improve performance when typing in larger notes
- Rewrite note saving mechanism to support automatic note changes and reduce complexity for further development
- Cleanup and comment some core parts or note-editor as the preparation for further development
- Prepopulate quickFormat dialog with the currently opened PDF parent #1984 (doesn't include the currently scrolled page label yet)
2021-04-16 17:55:05 +03:00
HollandeP
4ab6fe8c59 Made About page text visible across default Linux themes 2021-04-13 11:46:56 -04:00
Adomas Venčkauskas
ffab4d5243 Add an optional callback for Integration.initPipe(). Addresses #2031 2021-04-12 12:35:51 +03:00
Dan Stillman
52932b6eb0 Reduce auto-sync timeout to 3 seconds and optimize auto-sync process
Reduce timeout after an object change from 15 seconds to 3 seconds,
ecxept for individual notes. We should probably kick off an auto-sync
3 seconds after a note is blurred, but that's not implemented.

We also now skip file syncing and full-text content syncing altogether
unless an attachment has changed.

Reindexing an item now kicks off auto-sync, whereas before it didn't.
2021-04-06 05:09:42 -04:00
Adomas Venčkauskas
8bff4cff42 Fix the attempt to display the delay citation updates dialog breaking updates
Since 2b3669afd
2021-04-05 16:23:43 +03:00
Adomas Venčkauskas
a6fc2cb206 Fix embedded item citing (since 2e9e6554)
I don't know how this has not been reported yet
2021-04-05 16:23:43 +03:00
Martynas Bagdonas
bbb0f8bca4 Do not strip abstract from citation items data in notes 2021-04-05 09:00:28 +03:00
Martynas Bagdonas
c3a74a22d7 Update signature for _serializeAnnotations and return object instead 2021-04-03 11:08:57 +03:00
Martynas Bagdonas
20022a5d7c Properly check schema version in note editor tests 2021-04-02 21:57:35 +03:00
Martynas Bagdonas
415e644211 Upgrade note schema to v2:
- Automatically upgrade all editable v1 notes when note is being opened
- Pull `itemData` from existing citations and annotations into metadata container attribute `data-citation-items`
- Strip `abstract` from `itemData`
- Fill `citationItem` (in citations and annotations) with `itemData` when passing an HTML fragment for further processing in `note-editor`
- Keep only `uri`, `text`, `color`, `pageLabel`, `position`, `citationItem` annotation properties
2021-04-02 18:35:01 +03:00
Dan Stillman
26bf507fe2 Throw invalid-data error on unknown annotation type 2021-04-01 05:52:14 -04:00
Dan Stillman
6d212b1759 Update About window
- Add Zotero logo
- Move most acknowledgements to the website, where they can be more more
easily updated and more comprehensive
- Increase font size
- Center window on screen
2021-03-29 01:41:37 -04:00
Dan Stillman
5e9636089d Fix primary item types not appearing in More menu when not in MRU list
Regression in 1c366de54
2021-03-29 01:41:37 -04:00
Martynas Bagdonas
5e98b9c533 Select library tab when navigating to item from syncRunner popup 2021-03-25 20:56:02 +02:00
Martynas Bagdonas
f6fa81fdac Strip abstract field to save note space, set new itemData on export 2021-03-25 20:56:01 +02:00
Martynas Bagdonas
3536a384a9 Ensure attachment storage dir exists when saving pdf-reader state 2021-03-24 18:51:27 +02:00
Martynas Bagdonas
ec7251fd98 Fix tab toolbar button icon scaling on HiDPI 2021-03-23 18:04:38 +02:00
Martynas Bagdonas
3d204f75e9 Focus pdf-reader on tab selection if not focused contextPane note editor 2021-03-23 18:00:07 +02:00
Dan Stillman
f690c666d4 Don't make 'engine' required in Sync.Storage.Request
Follow-up to dc12a2c95a
2021-03-23 03:49:05 -04:00
Dan Stillman
f20263a50f Fix disambiguation-related hang in citeproc-js
This reverts the fix for
https://github.com/Juris-M/citeproc-js/issues/171 to fix the hang in
https://github.com/Juris-M/citeproc-js/issues/179
2021-03-23 03:31:22 -04:00
Dan Stillman
45968375d8 Return sooner in _checkForUpdatedFile() on SYNC_STATE_TO_UPLOAD
Before file.stat() instead of after, though it probably doesn't really
matter because the file is already open, which makes the stat call much
faster
2021-03-23 03:20:33 -04:00
Dan Stillman
dc12a2c95a Stop file upload queue after low-quota errors
We weren't making actual upload requests after a quota error if the file
would exceed the quota, but we were still going through all attachments
to upload, which in some cases involves making stat() calls. We now just
stop the queue immediately after a quota error or when starting a new
background sync after a previous quota error.

Closes #1255
2021-03-23 03:20:26 -04:00
Dan Stillman
c0eea4dadd Missed annotation property from 7889cd5d3 2021-03-21 15:53:12 -04:00
Dan Stillman
06b28194da Show annotation widget in conflict resolution window
This adds a very basic reimplementation of the annotation widget for use
in the CR window. It's not pixel-perfect, but it's close enough that
most people probably won't notice. We'll want to replace this with a
real version that's shared between the PDF reader and the rest of the
codebase.

Image annotations currently show an "[image not shown]" placeholder.
Showing images is tricky: we don't have the remote cache image, so if
the remote position has changed, we could only show an image by
rendering it from the file, and only if the file itself hasn't changed.
Just for a better user experience, we could use the local image as long
as the position and file are both the same, but that would take some
rejiggering of the CR window.

Tags aren't shown because they're not shown for CR at all, though that
could be changed in the future.
2021-03-21 14:36:43 -04:00
Dan Stillman
7889cd5d39 Fix item.clone() on annotation items 2021-03-21 14:36:42 -04:00
Martynas Bagdonas
9eb4fdb9cd Return back to notes list when a note is deleted 2021-03-19 12:41:07 +02:00
Martynas Bagdonas
ac750520e7 Use browser element instead of iframe to have access to History API 2021-03-18 18:19:09 +02:00
Martynas Bagdonas
f02b3464b8 Close note editor window when the note item is deleted 2021-03-18 10:05:21 +02:00
Martynas Bagdonas
4f71c2ab09 Improve PDF reader and note editor error handling 2021-03-18 10:03:36 +02:00
Martynas Bagdonas
1ede4240e0 Close all tabs and unregister tabs observer when destroying main window
#2005
2021-03-17 17:59:04 +02:00
Martynas Bagdonas
bf84e16002 Show crash popover on annotation saving failure
#2006
2021-03-17 13:43:48 +02:00
Martynas Bagdonas
1677e957cd Properly ignore deleted PDF attachments and close pdf-reader tabs
#2006
2021-03-17 13:43:48 +02:00
Martynas Bagdonas
8013a6ce97 Do not select the closest tab when closing a tab that is not selected 2021-03-17 13:41:21 +02:00
Dan Stillman
ae98488d2b Fix selectItem() on first items row (regression from d5334dc483) 2021-03-17 00:31:42 -04:00
Dan Stillman
d5334dc483 Fix item tree breakage if annotation is added while search is active 2021-03-17 00:14:43 -04:00
Martynas Bagdonas
bb2f1ced99 Position pdf-reader color popup by element instead of coordinates 2021-03-15 20:27:24 +02:00
Dan Stillman
ed70b404ad Tweak zoom labels in PDF reader context menu
"Automatic" → "Automatically Resize"
"Page Width" → "Zoom to Page Width"
2021-03-12 06:59:53 -05:00
Dan Stillman
76d504c564 Delete child annotations when deleting attachment
And fix a FK definition that could result in orphaned `items` rows
without `itemAnnotations` rows after an attachment was deleted.
2021-03-12 06:35:21 -05:00
Dan Stillman
0bc6b2ccc6 Transfer annotations when converting linked files to stored files
Previously, any annotations on the linked file were partially deleted,
leaving broken `items` rows without `itemAnnotations` rows.
2021-03-12 06:35:21 -05:00
Martynas Bagdonas
7b0bd05865 Add PDF page context menu, update editor & reader
Fixes #1978
2021-03-11 17:24:48 +02:00
Dan Stillman
98c101fd55 Notes pane: Change "Delete" to "Move to Trash" and remove confirm()
And remove unused _removeNote() function

We prompt to delete in the items list to distinguish from collection
removals, but it's arguably not necessary here, since you can always get
the item out of the trash. Undo would be nice, though.
2021-03-10 11:00:48 -05:00
Dan Stillman
24cc59cc7e Compress single-file HTML attachments and other text files
The test for ZIP uploads was having multiple files, but now snapshots
are all single files.
2021-03-10 09:37:52 -05:00
Dan Stillman
249d1aa0da Mendeley import: Add log lines for timing pdf-worker 2021-03-10 09:37:52 -05:00
Martynas Bagdonas
13cafe886e Rework note editor toolbar and related UI 2021-03-09 17:37:44 +02:00
Dan Stillman
824f67cb36 Mendeley import: Ignore empty text highlights 2021-03-08 10:58:15 -05:00
Dan Stillman
e4d7089506 Mendeley import: Fix blank PDF attachment MIME type from previous imports 2021-03-08 09:55:26 -05:00
Dan Stillman
5cdc088c49 Mendeley import: Import highlight and note annotations
Using new PDF worker functionality

If you've previously imported, you should be able to import again to get
annotations in the new PDF reader.

Details:

- Text highlights will be processed to extract text
- Rectangle highlights will turn into image annotations
- Any extracted-annotation notes created by previous improts won't be
  removed, but they're no longer created as long as the file exists.
2021-03-08 09:05:07 -05:00
Dan Stillman
c16432b217 Mendeley import: Set contentType for PDFs 2021-03-08 09:04:40 -05:00
Dan Stillman
3af4793f7f Don't log warning when opening a PDF for the first time
"Setting contains an invalid attachment page index ('null') -- discarding"

Fixes #1973
2021-03-07 02:30:21 -05:00
Martynas Bagdonas
6e49da1452 Add notes list context menu
Fixes #1979
2021-03-06 00:51:00 +02:00
Martynas Bagdonas
a1206e8901 Add Mendeley annotations processor 2021-03-05 21:26:49 +02:00
Martynas Bagdonas
8b1b2ee56a Fix ctrl+something default keyboard shortcuts 2021-03-04 17:02:10 +02:00
Dan Stillman
586a6f1ddf Fix time zone of note modification time in notes pane 2021-03-03 17:06:27 -05:00
Dan Stillman
bda52827da Reset note font size to 14 for new editor 2021-03-03 16:03:31 -05:00
Dan Stillman
49906c3fa0 Add "Export PDF" options to File menu
Quick implementation, but works on parent items or PDF attachments

Currently always includes annotations, but we'll want that to be an
option
2021-03-03 15:31:37 -05:00
Martynas Bagdonas
d893a02092 Properly check note schema version existence 2021-03-03 03:36:13 -05:00
Martynas Bagdonas
8755cf7338 Add missing schema version container 2021-03-03 03:36:13 -05:00
Dan Stillman
d98fabc5ab Add annotation type to schema 2021-03-03 03:33:52 -05:00
Dan Stillman
bffefe6644 Refer to PDF reader preview as a preview in the prefs 2021-03-03 00:59:27 -05:00