Now it:
1. Strips punctuation at the beginning, no matter what it is.
2. Strips non-dash punctuation in other positions.
3. Trims the result.
This should better prevent numerical ranges from being joined into a
single number that ends up incorrectly being sorted to the very bottom.
Follow-up to 58f515058 with a better approach: if no full-text cache
file, just get text directly without indexing. In the one existing use
of `attachmentText`, attachment merging, this is better anyway, because
we might be deleting the file, so there's no point wasting time
inserting words into the database.
We follow a different merge procedure for each attachment type:
- For PDF attachments, compare by MD5. If no match, get the top 50 words
in the attachment's text and hash those, then check again for a match.
Update references to item keys in notes and annotations.
- For web (snapshot / link) attachments, compare by title and URL.
Prefer a title + URL match but accept a title-only match.
- For other attachment types, keep all attachments from all items being
merged.
Also:
- Move most merge tests from Duplicates to Items#merge(). It just doesn't
make sense to worry about the UI in these.
And pass both `authorName` and `lastCreatedByUser` to the PDF reader.
The former can either come from `createdByUser` or be set directly on
the item (for group annotations dragged to personal libraries).
Update `DataObject::isEditable()` to take an optional `op` argument to
test individual operations as opposed to general library editing.
Erasing objects now tests `erase`, and `Item::isEditable()` allows
`erase` for unowned group annotations while disallowing the default
`edit`.
It's still up to the reader to handle this appropriately in the UI and
not allow operations it shouldn't, but this enforces it in the data
layer.
- Show "Export Note…"/"Export Notes…" if only notes or attachments
selected
- Don't show export option if only attachments and no embedded notes
(was previously disabled, and still is if all notes or a mixture of
empty notes and attachments)
Previously only individual objects from successful requests that
couldn't be processed for some reason would be added to the queue.
`Sync.APIClient.downloadObjects()` now returns clearer and more
consistent results. It now returns an array of promises for objects with
a `keys` array of requested keys and either a `json` array of returned
API JSON objects or an `error` Error, depending on whether the request
succeeded or failed. This makes it easier to detect remotely missing
objects and request failures.
This includes the `Zotero.RDF.getResourceURI()` fix in
zotero/translate@85b39a5be.
This position change here for `this._handleRelated()` for attachments
isn't necessary, since the attachment is already saved and already has
an id, but it's done for consistency with the call for notes (where the
note previously didn't yet have an id).
Extended Mendeley Import test to include a scenario where other users
attached an annotation to an item in a group library that also exists
in user's library.
This prevents metadata changes from clearing the isRead status of feed
items as long as GUIDs remain constant. Previously, feed items with
randomized properties (like URLs generated dynamically each time the
feed is served) would be incorrectly marked as unread on every update.
This test covers couple of scenarios downloading a 16MB file from a
local http server (simple and concurrently) using Zotero.File.download.
When running current implementation, this seems to fail persistently.
In real-world usage, current implementation seems to work
intermittently, failing more often for larger files.
This intermittent behaviour is most likely cause of #2216.
- Messages are shown once a day by default (within the same session for
id-less messages)
- Messages with an `id` attribute include a checkbox to not show again
for 30 days
- If an `infoURL` attribute is provided, a "More Information" button is
shown that launches that URL
- If `title` is provided, it's used for the dialog title. Otherwise
"Warning" is shown.
- Fixes selection events always being debounced
- Fixes some failing tests
- Ensures Select All command selects search matching children of
collapsed parents. Adds tests for this case
- Just a single huge commit. This has been developed over too long a
time, required many tiny changes across too many files and has seen too
many iterations to be separated into separate commits.
The original branch with all the messy commits will be kept around for
posterity
bb220ad0f2...adomasven:feature/react-item-tree
- Replaces XUL <tree> element across the whole zotero client codebase
with a custom supermegafast virtualized-table inspired by
react-virtualized yet mimicking old XUL treeview API. The
virtualized-table sits on top on a raw-to-the-metal,
interpreted-at-runtime JS based windowing solution inspired by
react-window. React-based solutions could not be used because they were
slow and Zotero UI needs to be responsive and be able to
display thousands of rows in a treeview without any slowdowns.
- Attempts were made at making this screen-reader friendly, but yet to
be tested with something like JAWS
- RTL-friendly
- Styling and behaviour across all platforms was copied as closely as
possible to the original XUL tree
- Instead of row-based scroll snapping this has smooth-scrolling. If
you're using arrow keys to browse through the tree then it effectively
snap-scrolls. Current CSS snap scroll attributes do not seem to work in
the way we would require even on up-to-date browsers, yet alone the ESR
version of FX that Zotero is on. JS solutions are either terrible for
performance or produce inexcusable jitter.
- When dragging-and-dropping items the initial drag freezes the UI for
a fairly jarring amount of time. Does not seem to be fixable due to
the synchronous code that needs to be run in the dragstart handler.
Used to be possible to run that code async with the XUL tree.
- Item tree column picker no longer has a dedicated button. Just
right-click the columns. The column preferences (width, order, etc) are
no longer handled by XUL, which required a custom serialization and
storage solution that throws warnings in the developer console due to
the amount of data being stored. Might cause temporary freezing on HDDs
upon column resize/reorder/visibility toggling.
- Context menu handling code basically unchanged, but any UI changes
that plugins may have wanted to do (including adding new columns) will
have to be redone by them. No serious thought has gone into how plugin
developers would achieve that yet.
- Opens up the possibility for awesome alternative ways to render the
tree items, including things like multiple-row view for the item tree,
which has been requested for a long while especially by users switching
from other referencing software
- Delete unused embedded images when note is closed.
- Load images as soon as they are downloaded.
- Introduce new notification for download event, and a test for it.
- Prevent simultaneous downloads of the same attachment.
Just don't consider items in the trash to be linked items in
item.getLinkedItem(). I'm not totally sure why we didn't do this many
years ago, since it's one of the biggest sources of confusion in Zotero.
This addresses #1648 and closes#1610, though not by undeleting and
overwriting the item in the trash. When deleting an item and then
re-dragging it from another library, I think most people would expect
the item in the trash to still exist (possibly with notes, etc.), rather
than having been automatically restored and overwritten with new data.
And since `Zotero.Libraries.isGroupLibrary()` just checked that
property, that hasn't worked either since `isGroup` was added in 2015.
There's no test for `.isGroup`, and the test for `isGroupLibrary()` used
`if()` instead of `it()`, so it never actually ran.
Also:
- Remove old code block in search.js that called `isGroupLibrary()`.
Since `isGroupLibrary()` didn't work, this block was unused, and its
logic was previously added elsewhere.
Among other things, if the name of a translator was changed, until
restart Zotero.Translators.getAllForType() would return the old cache
entry pointing to a file that no longer existed.
- Make a copy of the database after first initialization that can be
swapped in when reinitializing in resetDB()
- Avoid unnecessary one-second delay on every reset
Probably more that can be done, but this should take minutes off the
test runs
- Add/Remove Dictionaries window
- Better account for the (unlikely) possibility that a dictionary could
be replaced by another more popular dictionary provided by a different
extension id (tested)
- Better account for the (very unlikely) possibility that an extension
could bundle multiple dictionaries (untested)
- Use toolkit version comparator for proper extension version
comparisons
- Localize strings
- Add tests for updating
This connects the new feed processor to Zotero's existing feed reader. The new
feed processor assumes a content window environment, so a sandbox in a parent
window is used to load it.
This adds extra tests to check parsing behavior such as entities, tag handling,
CDATA, etc. This will help ensure the new feed processor matches the previous
behavior.
Filesystems care about byte length, not character length, so treat
maxLength as the byte length limit and truncate accordingly.
This will also now remove entire emoji characters without corrupting
them.
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
This expands the test filtering in the test runner so that you can supply e.g.
`test/tests/feed*` from your shell in the `zotero` directory and correctly
filter to all feed-related tests.
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.
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
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.
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.
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.)
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.
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