Commit graph

8995 commits

Author SHA1 Message Date
Adomas Venčkauskas
6be2faa9c2 Fix note citation insertion breaking when citing the same item in a note 2021-03-02 17:43:10 -05:00
Adomas Venčkauskas
1401550230 Allow citing items in notes with only property 2021-03-02 17:43:10 -05:00
Dan Stillman
787641dc17 Fix display of item pane after pinned-note changes
Stacked mode is still broken
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
Martynas Bagdonas
3701b84116 Proof of concept note view in tab mode 2021-03-02 17:43:08 -05:00
Martynas Bagdonas
783f9c50d5 Tab bar: Fix tabs on Windows & Linux 2021-03-02 17:40:24 -05:00
Martynas Bagdonas
2f505862d7 Tab bar & Reader: Rewrite and connect everything 2021-03-02 17:40:24 -05:00
Martynas Bagdonas
43c55594c1 Store PDF state in .zotero-pdf-state 2021-03-02 17:40:24 -05:00
Martynas Bagdonas
76e77d4422 Improve PDF import/export 2021-03-02 17:40:24 -05:00
Dan Stillman
e99f76b40c Tab bar: Update styling on macOS 2021-03-02 17:40:24 -05:00
Dan Stillman
b5f7255da2 Tab bar: Close current tab with Cmd/Ctrl-w
And use keydown, not keypress, for moving between tabs
2021-03-02 17:40:24 -05:00
Dan Stillman
5b947a3896 Tab bar: Add comment for tab navigation in keypress handler 2021-03-02 17:39:39 -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
2ca1618627 Tab bar: Change tab with Ctrl-Page-Up/Page-Down 2021-03-02 17:39:39 -05:00
Dan Stillman
a47d7e4d9c Fix possible selection bug after closing tab 2021-03-02 17:39:39 -05:00
Martynas Bagdonas
a89f7e8ec7 Improve PDF reader 2021-03-02 17:39:39 -05:00
Dan Stillman
875e9f674f Initial tab bar implementation 2021-03-02 17:39:37 -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
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
7ea14aa34e Add Zotero.Item::isStoredFileAttachment()
And replace most uses of isImportedAttachment(), which doesn't include
embedded-image attachments

There might not be much reason to keep isImportedAttachment() around.
2021-03-02 17:36:05 -05:00
Dan Stillman
bdec99f103 Update DB compatibility for annotations and noteSchemaVersion 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
acc3a70083 Remove SQL sort by parentItemID in Zotero.Sync.Data.Local.getUnsynced()
Now handled by Zotero.DataObjects.sortByParent()
2021-03-02 17:36:05 -05:00
Dan Stillman
8f5662ee6a Better error logging on sync engine upload failure 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
3c6ae0e656 Throw on missing parentItemID in Attachments.importEmbeddedImage() 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
427a227370 Rename 'area' annotations to 'image' annotations 2021-03-02 17:36:05 -05:00
Martynas Bagdonas
05318b3021 Improve note editor and backups 2021-03-02 17:36:05 -05:00
Martynas Bagdonas
bce50e8e9c Add old note backup and preview 2021-03-02 17:36:05 -05:00
Martynas Bagdonas
4d8a9ed753 Replace all note local URIs at the first sync time 2021-03-02 17:36:05 -05:00
Martynas Bagdonas
af57565acf Reorganize and improve notes 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
63a416db40 Fix display of note titles on startup (regression from noteSchemaVersion) 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
Martynas Bagdonas
2543a695e8 Introduce PDF reader and note editor 2021-03-02 17:36:05 -05:00
Dan Stillman
cbeb5881e9 Hide annotations from items list 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
Dan Stillman
8026f744c5 Remove old HTML snapshot annotation support
Any data trapped in these tables hasn't been accessible in many years.
2021-03-02 17:36:04 -05:00
Dan Stillman
b54d4e78b7 Save createdByUserID and lastModifiedByUserID for group items 2021-03-02 17:36:04 -05:00
Dan Stillman
bb0a1dab13 Don't normalize primary data values in Item.setField()
Just enforce proper data types
2021-03-02 17:36:04 -05:00
Dan Stillman
cca5dc0314 Don't send unnecessary format=json in sync download requests 2021-03-02 17:36:04 -05:00
Dan Stillman
0941a14a65 Remove 'lastsync' assignment from Zotero.Collection constructor 2021-03-02 17:36:04 -05:00
Dan Stillman
b4522535e8 Add _hasFieldChanged()/_getChangedField/_getLatestField() to DataObject
Make it easier to use the new `_changedData` approach to object
modifications (currently used only for `tags` and `deleted`) where
changed data is stored in a separate object rather than in the primary
variables. _getLatestField() can be used to return either the new
unsaved value or the current saved value.
2021-03-02 17:36:04 -05:00
Dan Stillman
c9eb661f25 Update locales from Transifex 2021-02-25 18:54:07 -05:00
Dan Stillman
b2b909b42c Update submodules 2021-02-25 18:45:28 -05:00
Dan Stillman
33528d0f36 Fix "New Collection" button when My Publications is selected
Fixes #1955
2021-02-25 18:30:33 -05:00
Dan Stillman
ba7f7e3250
Merge pull request #1962 from fletcherhaz/context-menu
Add context menu for React textboxes to Create Parent Dialog
2021-02-25 17:57:09 -05:00
Dan Stillman
3ff92e2795 Add "More Information" button to invalid-data sync error 2021-02-25 16:08:54 -05:00
Fletcher Hazlehurst
8c00510835 Remove XUL overlay, but keep functionality. 2021-02-24 16:11:19 -07:00
Fletcher Hazlehurst
60d8beece3 Add context menu for React textboxes to Create Parent Dialog 2021-02-22 20:14:07 -07:00
Dan Stillman
31478d1fba Use multi-line editor for all title fields (e.g., Case Name)
https://forums.zotero.org/discussion/87286/suggestion-multi-line-case-name-display-in-info-panel
2021-02-09 17:05:50 -05:00
Dan Stillman
843bcbb68a Show invalid-data warning in sync button tooltip for group libraries
Instead of showing warning button on toolbar

Otherwise if one person in a group upgrades to a beta with new fields,
everyone in the group will get a warning, even if they're already on the
latest release version. In a personal library, the user can upgrade to
the same version.
2021-02-09 16:36:06 -05:00
Dan Stillman
b919143630 Skip conflict resolution for remote objects that can't be saved
E.g., if a local item has been modified in a way that conflicts with a
remote item that also has a new, unknown field, don't show the CR
window -- just add the item to the sync queue and show the
some-data-could-not-be-downloaded error.
2021-02-07 16:49:01 -05:00
Dan Stillman
254695f4b3 Skip extra sync download after some conflicts
If an upload fails with a 412, and then we download, and then we go to
upload but there was nothing to upload (e.g., because the remote version
was chosen or there was an error saving it), there's no reason to do a
download again after that.
2021-02-07 16:38:14 -05:00
Dan Stillman
61e29aa8eb Don't set non-working 'tooltiptext' in React Button
Follow-up to ba9c7ae739
2021-02-06 23:51:28 -05:00
Dan Stillman
e9e434cd2e Fix tooltips for tags box icons
Addresses #1947

If we're going to need this regularly we should just create a React
Image element that does this automatically for 'title'.
2021-02-06 23:51:11 -05:00
Dan Stillman
01819d68d1 Show tag selector Actions menu on mousedown, not click 2021-02-06 23:37:56 -05:00
Dan Stillman
ba9c7ae739 Fix 'title' attribute on React Button component
E.g., Actions menu in tag selector

Neither 'title' (HTML) nor 'tooltiptext' (XUL) works on HTML elements in
XUL documents, so add a mechanism to fake tooltip behavior and use it in
our Button component. This can be triggered by other React components if
necessary.

This is (mostly) mirroring Firefox tooltip behavior, which is a bit less
sophisicated than macOS behavior. If we end up using this for
everything, we can improve the behavior (e.g., start the delay when
entering the element, not when the mouse stops).

Fixes #1947
2021-02-06 23:37:32 -05:00
Dan Stillman
cf132fdd29 Log POST request body for server requests 2021-02-05 17:51:59 -05:00
fletcherhaz
55acf9a0c0
Do not send back saveSingleFile: true if saving a PDF snapshot. (#1950) 2021-02-05 15:31:34 -05:00
Dan Stillman
293bf07c03 Temporarily increase sync upload timeout from 60 to 120 seconds
This shouldn't be necessary, but currently items with thousands of
creators can be very slow to save.
2021-02-03 16:18:30 -05:00
Dan Stillman
fd94d731d4 Update locales from Transifex and merge new English strings 2021-01-27 10:10:43 -05:00
Dan Stillman
ff9471fe2c Add English strings for Word for Mac ARM-is-supported warning 2021-01-27 00:59:18 -05:00
Dan Stillman
b3220e83b1 Don't pass nested collections to translators as top-level collections
While we need to pass all items from descendant collections to
translators, only the immediate child collections of the selected
library or collection should be returned from Zotero.nextCollection().

I'm not sure how long we've been doing this wrong, but it resulted in
duplicated subcollections when round-tripping Zotero RDF. (TEI is the
only other translator that uses nextCollection(), so its exports were
probably similarly incorrect.)

https://forums.zotero.org/discussion/87135/export-import-creates-numerous-duplicate-subcollections
2021-01-25 03:58:04 -05:00
Dan Stillman
10ca05e22e Return array instead of iterator for Collection.getChildCollections(true) 2021-01-25 03:58:04 -05:00
Diego de la Hera
05e56acf77
Fix Input component doesn't work if autoComplete=false (#1939)
The Input component doesn't work if its autoComplete prop is set to false, as described here: https://groups.google.com/g/zotero-dev/c/vKdxvZJL8UQ
2021-01-20 20:58:09 -05:00
Dan Stillman
2adf0e6d3c Encourage reporting of startup errors in the forums
We're now flagging the DB for repair on startup errors, so if that fixes
the problem (e.g., because of our undiagnosed skipped-schema-update-step
problem), we'd still like to know about it.
2021-01-17 04:19:33 -05:00
Dan Stillman
9152012368 Restore DB table reconciliation during integrity check
But skip it at startup, even if flagged on, if there are schema update
steps to perform, to avoid creating tables that aren't expected to exist
yet.

Originally added in 5b9e6497a but disabled in c4cc44528 and 7a434df53
2021-01-17 03:36:38 -05:00
Dan Stillman
a2dc7f23cd Switch to HTML progress element for main window progress bar
In an unsuccessful attempt to get an animation on macOS in indeterminate
mode, but might as well switch it anyway
2021-01-17 01:52:22 -05:00
Dan Stillman
e45ca4edad Support deleted property for collections and searches
This lays the groundwork for moving collections and searches to the
trash instead of deleting them outright. We're not doing that yet, so
the `deleted` property will never be set (except for items), but this
will allow clients from this point forward to sync collections and
searches with that property for when it's used in the future. For now,
such objects will just be hidden from the collections pane as if they
had been deleted.
2021-01-13 00:49:12 -05:00
Dan Stillman
5a4d78578b Zotero.DataObject updates for changedData fields
changedData is the new approach to updating DataObject data, storing the
new values in a separate object until save so that they don't actually
change the object unless the save goes through.

- Add DataObject._getLatestField() to return either the changed value or
  the last-saved value
- Clarify that _markFieldChange() takes different values depending on
  whether the field uses 'changed' or 'changedData'
- Fix bug calculating hasChanged() when a 'changedData' value is a
  boolean
2021-01-12 04:38:25 -05:00
Dan Stillman
22addb3afd Create logs/upgrade.log in data directory after schema updates
For debugging future problems with schema updates
2021-01-11 23:48:11 -05:00
Dan Stillman
f9c03058f1 Add Zotero.Debug.addListener() and .removeListener()
For getting all log lines during a particular period
2021-01-11 23:48:11 -05:00
Dan Stillman
5edad5f70a Update citeproc-js to 1.4.61 2021-01-11 23:48:11 -05:00
Dan Stillman
2094a6023c Restore fallback DB creation in retractions.js
Removed in 5b9e6497af, but then we reverted missing-table creation via
schema integrity check
2021-01-11 13:29:03 -05:00
Dan Stillman
4003c3d1fc Update locales from Transifex 2021-01-10 14:58:37 -05:00
Dan Stillman
80b8280e9d Update submodules 2021-01-10 14:58:37 -05:00
Dan Stillman
7b9bad1d52 Don't sync group on push notification if not selected for syncing
If a group library was deselected in the "Choose Libraries…" window, a
remote change would still trigger a sync if auto-sync was enabled. (My
Library was not affected.)
2021-01-09 14:58:51 -05:00
Dan Stillman
a1267bc68e Fix rerendering of React-based icons in HiDPI mode
With the variable in the outer scope, "@2x" keeps getting added to the
URL.
2021-01-07 04:11:15 -05:00
Fletcher Hazlehurst
4db61b8dc7 Do not modify saveOptions argument since it may be used again
If we add the notifier queue, another save function will use that queue
but not necessarily know that it needs to commit. Instead, we only use
the notifier queue for this function.
2020-12-30 11:33:07 -07:00
fletcherhaz
98a75931b0
Fix double saving snapshots (#1937)
* Fix double saving snapshots

https://forums.zotero.org/discussion/86796/duplicated-snapshots

I was able to replicate it by adding a 5 second delay here:
a72ae14816/chrome/content/zotero/xpcom/translation/translate_item.js (L196)

This was caused from a race condition and (a72ae14) did not fully
solve the problem. Now this is tested and fixed.
2020-12-27 03:31:30 -05:00
Dan Stillman
591ffcc83e
Merge pull request #1930 from fletcherhaz/ace-editor
Use Ace editor for Run JavaScript
2020-12-24 02:57:01 -05:00
Dan Stillman
c1976098e9 Run JavaScript: Hide spurious linting error 2020-12-24 02:55:33 -05:00
Dan Stillman
874c4044e5 Ace: Add commented-out language_tools lines in case we want them later
We may want this if we enable code completion, though it's a little
dumb. (It seems to show suggestions regardless of context.)
2020-12-24 02:55:00 -05:00
Dan Stillman
1040ba0b5e Run JavaScript: Detect await at the beginning of a line 2020-12-24 02:46:55 -05:00
Dan Stillman
018f04f369 Scaffold: Focus code editor when selecting tab 2020-12-24 02:46:19 -05:00
Dan Stillman
2ed4bb1c8f Ace: Config adjustments in Run JavaScript window
- Use the "Chrome" theme
- Hide the gutter
- Don't highlight the active line
- Remove default iframe borders
- Focus the editor on window open

Ace instances (e.g., Scaffold) are now responsible for setting their own
theme (to avoid a flash of Monokai before a lighter theme appears).
2020-12-24 02:45:37 -05:00
Dan Stillman
e095dbb031 Ace: Fix path to ace.html (#1930) 2020-12-24 02:41:51 -05:00
Dan Stillman
8b9d32c65b Update locales from Transifex and merge new English strings 2020-12-23 23:29:00 -05:00
Dan Stillman
0f36f9a7c3 Remove ellipsis for "Create Parent Items", since no prompt 2020-12-23 23:16:30 -05:00
Fletcher Hazlehurst
a81b494ce1 Add back in ability to create multiple empty parent items
Closes #1934
2020-12-23 15:37:08 -07:00
Dan Stillman
33abc76c88 Remove old unused (and broken) storage function 2020-12-22 23:54:34 -05:00
Adomas Venčkauskas
5798926093 Fix number inputs and adjust linux styling for the prefs pane 2020-12-21 12:20:17 +02:00
Dan Stillman
7a434df539 Disable creation of missing tables/indexes in Schema.integrityCheck()
Originally added in 5b9e6497a. We stopped running the integrity check
before userdata upgrades in c4cc44528 because this new behavior was
breaking upgrades, but it could still be run when coming from the DB
Repair Tool, which could cause problems if, say, you recovered a
database from a computer that had an older version of Zotero and ran the
DB Repair Tool on it. Disabling this for now until we have a better
solution.
2020-12-21 01:50:13 -05:00
Dan Stillman
43e6493997 Don't convert "Type: article" in Extra to Document item
CSL 1.0.2 clarified that type 'article' is meant for preprints and
working papers, so until we have a Preprint item type, just leave it in
Extra.

Discussion: https://github.com/zotero/translators/pull/2248#discussion_r492009958
2020-12-21 01:11:28 -05:00
Dan Stillman
aeceb67a07 Add Zotero.isBigSurOrLater, in case we need it later 2020-12-20 04:25:21 -05:00
Dan Stillman
e918b430b6 Fix Quick Format dialog appearance on Big Sur, and tweak on <=10.15
The Quick Format dialog's shape is based on the OS window corners, and
that changed on Big Sur, which resulted in whitespace along the bottom
edge and a misaligned search results box.

The tops of the citation bubbles were also cut off (at least for me) on
Catalina.
2020-12-20 04:23:38 -05:00
Dan Stillman
7b6b608de7 Update locales from Transifex and merge new English strings 2020-12-20 02:18:30 -05:00
Dan Stillman
44603d1ec6 Add localized strings for Word for Mac ARM warning (#26) 2020-12-20 02:07:58 -05:00
Fletcher Hazlehurst
0bb1588f22 Use Ace for Run JavaScript code editor
Closes #1928
2020-12-18 10:45:52 -07:00
Fletcher Hazlehurst
36d81e839c Use ace-builds NPM package 2020-12-18 10:45:38 -07:00
Dan Stillman
31c928a3ff Don't let invalid translators break all translation
If a translator couldn't be parsed, `_translatorInfo` wouldn't be set,
and that would somehow cause the translator info for subsequent
detections to be out of sync with the code loading, and nothing would
work. Putting a try/catch around the eval() allows subsequent
translators to continue to work normally. (There might be a better fix,
but this seems to work.)

This was happening for Better BibTeX translators that were still
installed without the extension (which they need to be parsed properly),
causing all imports to break.

https://forums.zotero.org/discussion/86613/error-id-1093166052-upload-of-ris-and-bibtex-data-failed
2020-12-10 03:58:17 -05:00
Dan Stillman
558ad20ce6 Scaffold: Improve cookie handling
- Use cookies from browser pane when running detectWeb or doWeb
- Use cookies from document when running or updating tests

This should fix various cases where translators can't be properly
developed or tested in Scaffold (e.g., [1]).

[1] https://github.com/zotero/translators/pull/2296#issuecomment-739116620
2020-12-06 03:09:13 -05:00
Dan Stillman
01646f1f8f Fix regression in 84730e610c
Only switch item types in fromJSON() if one was actually parsed out of
Extra
2020-11-27 18:04:03 -05:00
Dan Stillman
a249cd1608 Update citeproc-js to 1.4.50 2020-11-27 17:50:20 -05:00
Dan Stillman
84730e610c Don't delete valid item/CSL type from Type in Extra on sync
After a local item change, Zotero uploads the JSON and then applies the
saved JSON returned from the API to the local object using `fromJSON()`,
the same as it would apply any other remote change.

`fromJSON()` is meant to migrate Extra lines into real types and fields
after future item type/field changes. It calls
`Z.Utilities.Internal.extractExtraFields()`, which looks for valid item
type or CSL type values in Type lines in Extra, handles the rest of
parsing accordingly, and passes back the parsed item type. `fromJSON()`
wasn't handling `itemType` in the response object, so the item type
didn't get applied and the Type line was stripped. This fixes that.

Since valid type values are now parsed, if you have a Journal Article
item with a Pages field and enter "Type: song" into Extra and sync, the
item will be converted to Audio Recording and `Pages: 123` will be
placed in Extra.

https://forums.zotero.org/discussion/comment/369221/#Comment_369221
2020-11-27 17:50:20 -05:00
Adomas Venčkauskas
ddcbb47538 Fix number inputs and adjust linux styling for feed settings 2020-11-24 15:10:06 +02:00
Dan Stillman
c4cc44528c Fix error upgrading old databases after errors 5b9e6497af
Creating missing tables breaks schema update steps that assume those
tables don't exist, so we'll need another solution here. For now,
disable the automatic integrity check and make a couple recent schema
update steps more forgiving for people on the beta who already triggered
this.
2020-11-23 23:49:50 -05:00
Dan Stillman
304a38083c Update locales from Transifex and merge new English strings 2020-11-20 16:46:10 -05:00
Dan Stillman
75497e14c7 Item context menu: "Create Parent Item" → "Create Parent Item…"
Now that a dialog is displayed asking for further input

Follow-up to #1901
2020-11-20 16:35:29 -05:00
fletcherhaz
86b77cc45e
Add an option to create parent item from identifier (#1901) 2020-11-20 16:17:48 -05:00
Dan Stillman
07874d84bd
Merge pull request #1909 from fletcherhaz/snapshot
Update SingleFile for bug fixes
2020-11-17 16:02:13 -05:00
Dan Stillman
7c0cfd9420 Fix case of data dir not being created for new profile
If there was an existing ~/Zotero directory, another profile was already
pointing to it, and there was a Firefox profile pointing to a custom
data directory or with an embedded 'zotero' directory, the Firefox data
directory would be used instead of creating a new data directory named
after the new profile.

This skips the Firefox logic for new profiles when there's an existing
profile pointing at ~/Zotero and just creates the new data directory.
2020-11-17 15:57:16 -05:00
Dan Stillman
e575097e34 Missing line from 5b9e6497 to check schema integrity after crash 2020-11-17 01:26:46 -05:00
Dan Stillman
5b9e6497af Schema integrity check improvements
- Create userdata tables and indexes that are missing
- Delete tables and triggers that should no longer exist
- Run schema integrity check before user data migration
- Run schema integrity check after restart error

This is meant to address two problems:

1) Database damage, and subsequent use of the DB Repair Tool, that
   results in missing tables

2) A small number of cases of schema update steps somehow not being
   reflected in users' databases despite their having updated userdata
   numbers, which are set within the same transaction. Until we figure
   out how that's happening, we should start adding conditional versions
   of schema update steps to the integrity check.

This is currently only running the update check after a restart error,
which might not occur for all missed schema update steps, so we might
want other triggers for calling setIntegrityCheckRequired().
2020-11-16 18:13:48 -05:00
Dan Stillman
6bcc8af86b Add Zotero.DB.columnExists(table, column) 2020-11-16 17:50:52 -05:00
Dan Stillman
b0e065a4ae Don't return relative path from .attachmentFilename for linked files
https://forums.zotero.org/discussion/86139/zotero-item-attachmentfilename-should-only-return-filename
2020-11-13 11:43:00 -05:00
Dan Stillman
b43bfcaca0 Update locales from Transifex 2020-11-04 15:02:42 -05:00
Fletcher Hazlehurst
a72ae14816 Fix bug with double saving of snapshots. 2020-11-02 17:24:14 -07:00
Fletcher Hazlehurst
c0ec91f26d Fix bug for empty title when a translator does not provide one. 2020-11-02 17:24:14 -07:00
Fletcher Hazlehurst
a2620b757d Update SingleFile and fix several bugs
- Using `sandboxPrototype` properly uses window as prototype
- This commit removes the need for our patch in babel-worker.js:
3d0bc4cf9f
- We properly inject into frames in the client if we ever include frames
2020-11-02 17:24:14 -07:00
Dan Stillman
367fea1847 Zotero.File.copyDirectory(): Fix copying of subdirectories on Windows
This fixes copying of the previous extracted SingleFileZ snapshots
between libraries.
2020-11-01 18:51:55 -05:00
fletcherhaz
d16512c84f
Fix bug with async translate process never returning. (#1910)
When using `doImport` a promise is returned, but was lacking a catch a
statement to ensure completion.

This fixes #1882
2020-10-29 02:30:47 -04:00
Dan Stillman
a0aef25de1 Update locales from Transifex and merge new English strings 2020-10-27 02:40:48 -04:00
Dan Stillman
2e2a4bca7f Follow automatic tags prefs when retrieving PDF metadata by ISBN
https://forums.zotero.org/discussion/85777/retrieve-metadata-for-pdf-creates-automatic-tags-even-when-pref-is-off
2020-10-27 01:27:57 -04:00
Dan Stillman
38b997bee9 Update strings for Word Startup folder misconfiguration
Follow-up to 3a684308cd
2020-10-27 00:48:36 -04:00
Dan Stillman
9fdf82aca5 Resolve relative attachment URLs with proxy: false
4bc8fab4f5 added support for `proxy: false` on attachment URLs in
translators, but it made that flag skip `resolveURL()` altogether, which
meant that relative URLs weren't resolved, rather than just skipping
proxying.

This may fix PDF downloads for some ScienceDirect pages (though I can't
test this one):

https://forums.zotero.org/discussion/85884/problem-downloading-pdf-via-zotero
2020-10-26 23:29:40 -04:00
Dan Stillman
29f48476a9 Use UnexpectedStatusException in Zotero.HTTP.loadDocuments()
Follow-up to 76ae5d9f59, which changed loadDocuments() to pass/throw an
Error on a non-2xx response code
2020-10-24 00:04:01 -04:00
fletcherhaz
76ae5d9f59
Switch back to SingleFile from SingleFileZ (#1904)
Our SingleFileZ integration would save images inside directories following the
SingleFileZ format. However, Zotero does not support syncing sub-directories of
attachments. This commit switch back to a single HTML file with base64 encoded
resources. We think that the 33% increase in resources will be offset by the
compression of HTML and removal of JavaScript and unused CSS.

This commit does not fix past snapshots that were saved using SingleFileZ.
2020-10-23 19:39:07 -04:00
Adomas Venčkauskas
3a684308cd Add strings for Word plugin install failure 2020-10-23 13:37:58 +03:00
Dan Stillman
679a1acb90 Fix "Web Page" showing in New Item menu for new databases 2020-10-15 16:24:17 -04:00
Dan Stillman
e9afd153e9 Log HTTP error bodies when responseType is explicitly set to 'text'
Previously they were only logged if responseType wasn't set
2020-10-14 19:33:46 -04:00
Dan Stillman
828ec4010e Don't allow items to be set as their own parents, and correct existing 2020-10-14 19:33:46 -04:00
Dan Stillman
6b626ba992 Fix error in Mendeley import (regression from 8fc316f727)
"Zotero.Relations.getByPredicateAndObject(...).filter is not a function"
2020-10-13 16:45:31 -04:00
Fletcher Hazlehurst
bb0ddbd872 Fix server not handling empty body in multi-part request
An empty body is still valid. Was causing an issue for empty favicons.

https://forums.zotero.org/discussion/85600/bug-report-no-snapshot-in-zotero-beta
2020-10-12 15:06:11 -06:00
Dan Stillman
1ac79c0974
Merge pull request #1896 from fletcherhaz/snapshot
Fix CORS issues in SingleFile
2020-10-11 23:18:11 -04:00
Fletcher Hazlehurst
ed304b56e0 Remove crossorigin attributes in snapshots.
When loading a snapshot locally, same-origin of null will not load them
2020-10-11 18:19:41 -06:00
Fletcher Hazlehurst
dadc64e0d5 Extract SingleFile config so we can share with connector 2020-10-11 17:25:18 -06:00
Dan Stillman
479f01fa9c Fix in-client SingleFile saving on Windows
https://forums.zotero.org/discussion/85538/zotero-5-0-91-beta-not-saving-snapshots-d672469174
2020-10-08 18:44:50 -04:00
Dan Stillman
71550deb98 Fix URL resolving during translation in Zotero client
Regression in c0b6712923

The URL constructor isn't available in XPCOM.
2020-10-05 23:38:28 -04:00
Dan Stillman
d3c481fcf6 Fix bundled attr() when attribute doesn't exist
Regression from 4efc0af119
2020-10-05 23:36:06 -04:00
Dan Stillman
bb44841a80 Update locales from Transifex 2020-10-04 18:18:46 -04:00
Dan Stillman
987b9ce4cb Fix zotero://open-pdf links with page for PDF Expert
https://forums.zotero.org/discussion/comment/365610/#Comment_365610
2020-10-04 18:05:03 -04:00
Dan Stillman
328865299b Add SingleFileZ to about window 2020-10-03 17:57:59 -04:00
Fletcher Hazlehurst
37cdba6f40 Clean up code from SingleFile error handling fix 2020-09-28 12:00:36 -07:00
Fletcher Hazlehurst
1c5cefaffd Fix handling of network errors for SingleFile save 2020-09-28 10:43:32 -07:00
Dan Stillman
20c8cede4d
Merge pull request #1846 from fletcherhaz/snapshot
Use SingleFile to create snapshots of web pages
2020-09-24 18:08:34 -04:00
Dan Stillman
cae2aab70f Reduce startup time from retraction key caching 2020-09-23 22:58:53 -04:00
Fletcher Hazlehurst
0fba08b3c9 Use SingleFile to create snapshots of web pages 2020-09-23 09:37:09 -07:00
Dan Stillman
693cd926d5 Apply subtitle capitalization to dependent styles based on parent
If a style specifies a style like APA that wants uppercase subtitles,
the dependent style should have them too.

https://forums.zotero.org/discussion/comment/364864/#Comment_364864
2020-09-22 17:07:40 -04:00
Dan Stillman
c5f01bc2f3 Make sure item returned from getLinkedItem() has all data loaded
Follow-up to 8fc316f727
2020-09-15 01:12:56 -04:00
Dan Stillman
4efc0af119 Translator sandbox: Update attr()/text() and add innerText()
- Remove TODO comment to add a warning if a Document is passed, since a
  document will always be required when operating on something other than
  the main page (e.g., for multiples).
- Always return a string instead of null. A translator can always use
  querySelector() if it really needs to know if a node exists.
- Automatically trim the returned string
- Add innerText() function that uses .innerText instead of .textContent,
  since there are situations where that might be helpful. Some of those we
  currently address with trimInternal(), but there can be other
  cases where .innerText gives cleaner, user-centric output.

Translators won't be able to rely on these changes for a while, so we'll
need to be careful to watch for problems here, or translators will need
to include a v3 polyfill.

Addresses zotero/translators#1913
2020-09-14 23:51:12 -04:00
Dan Stillman
8fc316f727 Fix potential error dragging to library that hasn't been loaded
https://forums.zotero.org/discussion/85136/unable-to-copy-items-between-libraries

Zotero.Relations.getByPredicateAndObject() is now async.
2020-09-14 23:49:22 -04:00
Tom Najdek
eff19923ef Parse creatorIndex string value as a number #1874
Sending value as a string to "removeCreator" breaks the logic in the
loop in that method which is supposed to remove target creator and shift
remaining creators in the array. This in turn triggers undesired removal
of the last creator in the array.
2020-09-10 01:31:25 -04:00
Tom Najdek
02e4bdfdb0 Blur edited creator field prior to deletion #1874
Resolves an issue where when trying to remove creator, while it is being
edited, next creator is removed instead.
2020-09-10 01:31:25 -04:00
Dan Stillman
e40fff6a7d Limit corrupted-login-manager warning to once per minute 2020-09-10 01:18:58 -04:00
Dan Stillman
0e74a91f6b Fix parsing of SQL dates without seconds
Previously, "2020-09-09 23:33" would be treated as a multipart date,
with "23:33" left in the visible field and "d" showing in the indicator.
2020-09-09 23:37:02 -04:00
Dan Stillman
4ac35ecda3 Fix invalid HTML in note from Quick Copy
A <body> was included with the note element outside of it.
2020-09-09 23:36:18 -04:00
Dan Stillman
4838726b87 Throw invalid-data error on unknown attachment link mode in fromJSON() 2020-09-09 18:01:50 -04:00
Dan Stillman
c0b6712923 Utilities.Translate.resolveURL() tweaks
- Use `new URL()`, available in all modern environments, instead of
  various other methods. In addition to being consistent and simple,
  this allows setting the base URL explicitly, regardless of the
  environment.
- Default protocol-relative URLs to 'https' if no document location
  (though I'm not sure if that ever happens)
2020-08-11 03:55:32 -04:00
Dan Stillman
8214c85bee Remove outdated comment after 8614e73aa8 2020-08-07 19:36:34 -04:00
Dan Stillman
8614e73aa8 Throw clearer error when 'storage' is a broken symlink
Instead of '(NS_ERROR_FILE_ALREADY_EXISTS) [nsIFile.create]', throw
"Broken symlink at <path>".

Closes #1834
2020-08-07 18:23:44 -04:00
Dan Stillman
7c201f5d59 Big Sur style fixes
- Restore active <tab> label
- Fix appearance of tabs in item pane
2020-07-28 00:15:11 -04:00
Dan Stillman
b97413b963 Update locales from Transifex 2020-07-22 18:50:53 -04:00
Dan Stillman
164701450c Limit schema diagnostics to dev builds 2020-07-22 18:38:42 -04:00
Dan Stillman
7f92220ef9 Restore detection of some types of DB corruption at startup
1e0ad3aba changed the test for DB corruption to look for "database disk
image is malformed", but at least Sqlite.openConnection() can throw a
"Could not open connection" error with "2152857611"
(NS_ERROR_FILE_CORRUPTED) in it.
2020-07-22 16:14:17 -04:00
Dan Stillman
785b6dd408 Update citeproc-js to 1.4.11
This fixes the "invalid language tag" error when there are invalid
language tags in Language (beta only).

https://forums.zotero.org/discussion/84224/zotero-error-refreshing-report-id-337976002
2020-07-18 19:21:36 -04:00
Dan Stillman
ab3a5ddbd8 Scaffold: Include mimeType: text/html for attachments in test output
The connector includes this, so the new CI translator test runner in
zotero/translators was showing erroneous mismatches.
2020-07-16 17:40:48 -04:00
Dan Stillman
c1a06a5dea Add reminder to keep CSL mappings in sync with connector 2020-07-14 18:39:55 -04:00
Dan Stillman
f923af4f31 Update citeproc-js to 1.4.7
Includes fixes for https://github.com/Juris-M/citeproc-js/issues/140
and https://forums.zotero.org/discussion/83567/uppercase-letter-problem-in-turkish
2020-07-14 09:39:05 -04:00
Dan Stillman
71af747df0 Fix unnecessary style updating at startup in timezones > UTC
https://forums.zotero.org/discussion/comment/360144/#Comment_360144
2020-07-12 04:53:29 -04:00
Adomas Venčkauskas
8e4ac40174 Decrease translator test timeout 2020-07-07 13:14:20 +03:00
Adomas Venčkauskas
19880e4ded Translator tester updates for running in CI 2020-07-07 12:21:10 +03:00
Adomas Venčkauskas
419953f478 Perform integration document updates in reverse order
Fixes issues when integration plugin field appearance order
in the document is hard-linked and fields can be nested,
which breaks those links when updating a field with nested fields, in
the process removing the nested fields and upsetting document field
order.

Report: https://forums.zotero.org/discussion/83840/error-while-refreshing-a-large-document
2020-06-26 11:13:03 +03:00
Dan Stillman
381fad3681 Remove outdated comment in retraction code
We're already detecting retractions that were removed from the list, so
I don't think this applies anymore.
2020-06-25 20:53:20 -04:00
Dan Stillman
7422c50076 Fix detection of retractions for items with DOI in Extra
Affected items should be detected on the next retraction updates check
2020-06-25 20:53:20 -04:00
Adomas Venčkauskas
6bbb7ddc09 Ignore leading comma in citation dialog search. Closes #1839 2020-06-22 10:00:18 +03:00
Dan Stillman
1ec2615eee More debug info for incomplete schema upgrades
Include info on whether the data directory is in a cloud storage folder
and whether the DB passes a quick integrity check.
2020-06-21 05:24:42 -04:00
Dan Stillman
b4320fbc4c Add Zotero.DB.quickCheck(), and speed up integrityCheck()
https://www.sqlite.org/pragma.html#pragma_quick_check

And limit both checks to 1 error (e.g., integrity_check(1))
2020-06-21 05:21:48 -04:00
Dan Stillman
3e8f0af583 Schema upgrade debugging
Include flags in repo update checks indicating whether a database table
that was previously supposed to be removed was removed and whether a new
table was created. This should help us figure out whether we can safely
perform schema update steps or whether we need to figure out why some
schema update steps aren't being applied.
2020-06-21 03:08:03 -04:00
Adomas Venčkauskas
42ac976f1e Do not attempt to update bibliography when no citations are present 2020-06-18 16:13:47 +03:00
Dan Stillman
01b8b550b8 Update locales from Transifex 2020-06-14 18:04:24 -04:00
Dan Stillman
68ec841f35 Warn on "Box" in data directory path 2020-06-14 17:15:12 -04:00
Dan Stillman
482b8b6f75 Update locales from Transifex 2020-06-11 04:21:07 -04:00
Dan Stillman
bccf5ff0b2 Fix endless WebDAV loops if server has wrong mtimes but hash matches
Possibly caused by a third-party client uploading mtimes that then
aren't synced, or that differ from what get synced. When we detect this,
try to correct it by updating mtimes on WebDAV and the API to match the
local file.

https://forums.zotero.org/discussion/83554/zotero-loop-syncs-2000-items
2020-06-09 01:26:11 -04:00
Dan Stillman
a8c682bf4b Preserve linked-object and replaced-item relations when merging items
https://groups.google.com/d/msgid/zotero-dev/6f764822-ed7c-46eb-8068-ce9ed1a1538c%40googlegroups.com

Regression from 617564982c
2020-06-06 17:16:09 -04:00
Dan Stillman
bb220ad0f2 Update to citeproc-js 1.3.22 2020-06-02 17:07:31 -04:00
Dan Stillman
b2e902746a Strip HTML tags from titles when generating filenames 2020-06-02 17:06:42 -04:00
Dan Stillman
13349df380 strToDate(): More boring way of fixing 0620b16d3e 2020-05-28 06:38:39 -04:00
Dan Stillman
0620b16d3e strToDate(): Don't parse 01/01/08 as the year 8
Regression from b7dc0d8b0a (5.0.81)
2020-05-28 06:19:42 -04:00
Dan Stillman
c882488ef7 Add "(APA)" and "(ASA)" to style list in Document Preferences
Hopefully this will help people not select ASA 6th when they're looking
for APA 6th.

https://forums.zotero.org/discussion/comment/357135/#Comment_357135
2020-05-28 06:19:41 -04:00
Dan Stillman
b0fd7adcbe Ignore useDataDir pref if no dataDir pref 2020-05-28 04:35:14 -04:00