Commit graph

7558 commits

Author SHA1 Message Date
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
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
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
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
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
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
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
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