Commit graph

9078 commits

Author SHA1 Message Date
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
WesleyFord
657832521f Fix background color of the dropdown menu. 2021-03-09 13:24: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
a7b7f5f8b4 Update locales from Transifex and merge new English strings 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
Dan Stillman
301c13befb Remove unused strings 2021-03-03 00:44:33 -05:00
Dan Stillman
79e52beb38 Update text of outdated doc template warning 2021-03-02 18:12:25 -05:00
Dan Stillman
2fbb7d404a Fix visual bugs in progress bar and Quick Format dialog on macOS
Fix extra whitespace and misaligned Z icon

Update to e918b430b6 after some recent changes
2021-03-02 18:12:25 -05:00
Dan Stillman
f861249fce Tweak error for Add Note when beta features are disabled
And remove from localized strings
2021-03-02 18:12:25 -05:00
Dan Stillman
03ac62e71e Tweak PDF reader checkbox label 2021-03-02 18:12:25 -05:00
Dan Stillman
5fd7f097f3 Add "Learn more" link below PDF reader checkbox 2021-03-02 18:12:25 -05:00
Dan Stillman
94871dade6 Add Cancel button to prompt for PDF reader checkbox 2021-03-02 18:12:24 -05:00
Adomas Venčkauskas
607cb733da Adds a friendly date and subsequent note line for note insertion
Closes #66
2021-03-02 18:12:24 -05:00
Adomas Venčkauskas
91ac847bab Inform connector about PDF build to enable Add Note button in Google Docs 2021-03-02 18:12:24 -05:00
Adomas Venčkauskas
02fc8bf39f Add an error message when using the Add Note button with beta disabled
Closes #67
2021-03-02 18:12:24 -05:00
Martynas Bagdonas
3aa79f40d7 Populate PDF reader tab title immediately 2021-03-02 18:12:24 -05:00
Martynas Bagdonas
17abf87bcf Improve notes list UI:
- Show both sections even on search
- Add new note creation popups with an option to create from annotations
- Hide child notes section if no parent item
2021-03-02 18:12:24 -05:00
Dan Stillman
ca15e03701 Add commas to "[x] more…" count in notes pane 2021-03-02 18:12:24 -05:00
Dan Stillman
590b6b4a34 Adjust sizing of notes pane search bar and + buttons 2021-03-02 18:12:24 -05:00
Dan Stillman
ebf45a3232 Fix tab bar initialization on macOS after isPDFBuild change 2021-03-02 18:12:24 -05:00
Adomas Venčkauskas
e166a04876 Fix outdated template warning for Mac Word 2021-03-02 18:12:24 -05:00
Dan Stillman
7cd861a9e1 Change PDF reader beta pref to a general beta pref
The PDF reader pref is now "Use Zotero PDF reader and new note editor
(beta, My Library only)". Toggling the pref prompts to restart, and
Zotero.isPDFBuild -- which currently controls the PDF reader, new note
editor, and tabs UI -- is set based on that pref at startup.
2021-03-02 18:12:24 -05:00
Dan Stillman
557a75c90f Fix quotes in invalid-field error messages 2021-03-02 18:12:24 -05:00
Dan Stillman
1e8f2b94d4 Don't show annotation fields in advanced search for now
Since annotations don't show up as items yet
2021-03-02 18:12:24 -05:00
Martynas Bagdonas
7bdd34596d Improve notes list UI:
- Always show both sections
- Do not show empty sections when searching
- Collapse notes list when all tabs are closed
- Work around search input to take full width without breaking its stuff
2021-03-02 18:12:24 -05:00
Martynas Bagdonas
83109fc076 Fix and attach image annotation renderer 2021-03-02 18:12:24 -05:00
Dan Stillman
3e4ad18b2a Show friendlier date in PDF reader notes list
Using new Zotero.Date.toFriendlyDate() function

- Time if today
- Day of week if earlier this week
- Date with two-digit year otherwise

We could consider adding 'Yesterday' as well.
2021-03-02 18:12:24 -05:00
Dan Stillman
0c17829b27 Set isPDFBuild permanently to true
While the code can technically disable various things (e.g., tab bar) to
behave like 5.0, other things (e.g., word processor plugins) would be
tricky to do conditionally.
2021-03-02 18:12:24 -05:00
Dan Stillman
afa989c3a8 Use getExportableNote() for word processor note insertion 2021-03-02 18:12:24 -05:00
Dan Stillman
eb29b69d58 Use typographic quotes around highlights in notes 2021-03-02 18:12:24 -05:00
Dan Stillman
2c66133c7e Add "Add Note from Annotations" menu option on items
Shows as a menu option when there's a single PDF attachment with
annotations and as a submenu containing titles when there are multiple
(even if there's only one attachment that actually has annotations)

Also removes "Create Note from Annotations" on attachment items for now.
(It might make sense to add that back, though "Add" would be a little
weird for creating a sibling note, while using a different label would
be confusing.)
2021-03-02 18:12:24 -05:00
Dan Stillman
3e37d31a49 Sort notes reverse chronologically in note insertion search results 2021-03-02 18:12:24 -05:00
Martynas Bagdonas
5a6424e591 Limit notes count in contextPane notes list 2021-03-02 18:10:44 -05:00
Martynas Bagdonas
e409c8bc27 Improve navigation to specific PDF page 2021-03-02 18:10:44 -05:00
Martynas Bagdonas
4b622f074d Add function to export note with dataURI images 2021-03-02 18:10:44 -05:00
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
Martynas Bagdonas
b00325942a Improve reworked context pane:
- Show child notes at top of notes list, with separate headers for "Item
  Notes" and "All Notes"
- Fix "New Child Note" option
- Add parent item title above note editor when editing child note
- Cleanup

TODO:
- Search on parent item title for child notes
2021-03-02 18:10:44 -05:00
Dan Stillman
db0bd56688 Prevent possible error if schema check occurs before schema update
Not sure if this can happen, but if there's any way for the schema
integrity check to run before the global schema is updated, use -1 for
the annotation itemTypeID.
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
50dae87b07 Add a warning dialog for an outdated doc template 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
dba841770c Rework context pane in PDF reader
- Remove item pane tabs
- Show all notes in notes pane, showing the parent title where
  appropriate
- Show drop-down menu for "New Note" button in notes pane that allows
  creating standalone or child notes
- Add some temporary styling for notes in the notes pane

TODO:

- Show child notes at top of notes list, with separate headers for "Item
  Notes" and "All Notes"
- Fix "New Child Note" option
- Add parent item title above note editor when editing child note
- Search on parent item title for child 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
Martynas Bagdonas
f52c50f055 Use synced pageIndex 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
Martynas Bagdonas
d0bdc45b9f Fix "Add to Note" for not yet created note 2021-03-02 18:10:44 -05:00
Martynas Bagdonas
aa836d77af Improve editor ir merge dialog 2021-03-02 18:10:44 -05:00
Martynas Bagdonas
a225c498ec Get rid of image natural dimensions 2021-03-02 18:10:44 -05:00
Dan Stillman
eb865e2625 setAttachmentPageIndex() → setAttachmentLastPageIndex() 2021-03-02 18:10:44 -05:00
Martynas Bagdonas
580d800286 Add support for PDF navigation to pageLabel 2021-03-02 18:10:44 -05:00
Martynas Bagdonas
16650b4ddf Improve note creation from annotations 2021-03-02 18:10:44 -05:00
Martynas Bagdonas
d23e0e30bb Fix annotation insertion 2021-03-02 18:10:44 -05:00
Martynas Bagdonas
7fa68690dd Do not insert citation for parentless PDF 2021-03-02 18:10:44 -05:00
Martynas Bagdonas
8d87eeae35 Capitalize acronyms 2021-03-02 18:10:44 -05:00
Martynas Bagdonas
1a4b2e8c7d Use isPDFBuild for editor switch, fix merge dialog 2021-03-02 18:10:44 -05:00
Dan Stillman
bb9237e82d Better comment for Zotero.Item.prototype._getPageIndexSettingKey() 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
Martynas Bagdonas
8eff0bf5d4 Reverse button fragment images 2021-03-02 18:10:44 -05:00
Dan Stillman
bb79686ce8 Add unused code to switch between the tab bar and the unified toolbar 2021-03-02 18:10:44 -05:00
Dan Stillman
28c1504cdd Use old toolbar if not a PDF build 2021-03-02 18:10:44 -05:00
Dan Stillman
e1c0f6c1a0 Rename zotero-note-editor submodule to note-editor 2021-03-02 18:10:42 -05:00
Dan Stillman
88dc6638fe Add Zotero.isPDFBuild feature flag
Currently limited to PDF opening (which is then dependant on
the beta.useInternalPDFReader pref)
2021-03-02 17:58:29 -05:00
Dan Stillman
10f41547aa Search for words separately in PDF reader notes pane 2021-03-02 17:58:29 -05:00
Dan Stillman
a1655e5643 Remove colon from "[n] notes:" line at top of notes panes 2021-03-02 17:58:29 -05:00
Martynas Bagdonas
224eb6bc84 Fix navigation to specific PDF page 2021-03-02 17:58:28 -05:00
Dan Stillman
f0816cc8fb Add temporary prefs checkbox to use internal PDF reader
And use when opening PDFs in My Library from items list and
zotero://open-pdf

This also adds "Zotero" to the main PDF reader pref, which will be the
real way to set this, but that option is hidden for now so that group
library items will still open with the configured reader.
2021-03-02 17:58:28 -05:00
Martynas Bagdonas
04c64fe9fc Use old editor in group libraries 2021-03-02 17:58:28 -05:00
Martynas Bagdonas
66bed2529c Fix various PDF reader and note editor issues 2021-03-02 17:58:28 -05:00
Dan Stillman
4a4a54da7b Clear annotation change state after save 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
Martynas Bagdonas
a19693fa7a Improve PDF importing and introduce rendering 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
2a203afb20 Redo Zotero.File.generateDataURI() without XPCOM and type sniffing
Now async and takes a contentType parameter
2021-03-02 17:58:28 -05:00
Martynas Bagdonas
c13ac32ad2 Use new attachment fields for annotations import 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
Martynas Bagdonas
232ffba2ab Improve note content insertion 2021-03-02 17:58:28 -05:00
Dan Stillman
404eaf13d0 Remove obsolete line from Zotero.Reader.open() 2021-03-02 17:58:28 -05:00
Martynas Bagdonas
a96c16a33d Fix resizing for all vertical panes on macOS 2021-03-02 17:58:28 -05:00
Adomas Venčkauskas
5bc41e250b Fix citing with automatic citation updates disabled 2021-03-02 17:58:28 -05:00
Dan Stillman
c73f51faef Always await callback in ZoteroPane.viewAttachment()
The recent change to sniff for PDFs when an attachment didn't have a
content type resulted in a ZoteroPane test failing, because a stub for
Zotero.launchFile() wouldn't be called by the time the viewAttachment()
promise resolved.
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
688298af7f Add Zotero.Item::isPDFAttachment()
Returns true for stored or linked PDFs
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
ea04c32c9d Fix running of tests after adding tab bar 2021-03-02 17:58:28 -05:00
Dan Stillman
5eeae576b4 Fix item pane tab appearance in PDF tab on Big Sur 2021-03-02 17:58:28 -05:00
Dan Stillman
9254bcbd03 Remove no-op line in ReaderInstance::_getAnnotation()
And clarify variable name for item vs. JSON
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
Martynas Bagdonas
51f760fe1a Improve the new UI:
- Revert `notesList` to standalone notes mode only
- Fix splitter styling on Windows
- Fix `contextPane` performance fixes
- Add a customizable throttle function to `Zotero.Utilities`
- Fix reader tab selection issues
- Improve error handling in the new editor
- Update pdf-reader and zotero-note-editor submodules
- Fix contextPane child notes list
- Properly notify editor about new images
- Fix note title and body snippet extraction
- Persist right-hand pane state when switching tab
- Hopefully fix two panes visible at the same time
2021-03-02 17:58:28 -05:00
Martynas Bagdonas
c6a196b999 Tab bar: Improve tab close button 2021-03-02 17:58:28 -05:00
Flachware
f440b52aa5 Add xmark icon. 2021-03-02 17:58:28 -05:00
Dan Stillman
0d4ad01201 Fix attachmentSyncedHash for embedded-image attachments 2021-03-02 17:58:28 -05:00
Dan Stillman
d44ab7efbb Fix attachmentSyncedModificationTime for embedded-image attachments 2021-03-02 17:58:28 -05:00
Martynas Bagdonas
62c6f561a6 Fix missing PDF attachment MIME type on opening 2021-03-02 17:58:27 -05:00
Flachware
15a0415eba Update item and notes icons. 2021-03-02 17:58:27 -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
901a10f0b6 Fix note citations being inserted in reverse order 2021-03-02 17:58:27 -05:00
Adomas Venčkauskas
50bef8dffe Optimization of note insertion API 2021-03-02 17:58:27 -05:00
Adomas Venčkauskas
06e1c404bd Changes to note insertion for MacWord 2021-03-02 17:58:27 -05:00
Martynas Bagdonas
45a3e96e68 Improve the new UI:
- Rollback all redundant changes made in the last few months
- Introduce `contextPane`
- Show child notes in the notes pane
- Fix splitter styling
- Various bug fixes
- Fix contextPane switching and states persistence
- Persist reader sidebar open/close state
- Fix bottom pane placeholder updating concurrency issues
- Fix toolbar placeholder width updating
- Display titles for split button
- Fix toolbar position when switching tabs
- Add PDF tab loading cover
- Improve notes and citations insertion
- Clean up and refactor code
- Fixes and cleanups to PDF reader
2021-03-02 17:54:48 -05:00
Dan Stillman
ab04468342 Item pane improvements for contextual/pinned modes
- Show item title at top of item pane in contextual mode not in a
  library tab
- Show "All Notes" at top of standalone notes pane
- Add background color when clicking notes in standalone notes list
- Clean up back buttons

Mode button is still a placeholder but uses emoji to show the mode
2021-03-02 17:43:10 -05:00
Martynas Bagdonas
bb5075e8b8 Experiment with the new item pane UI 2021-03-02 17:43:10 -05:00
Adomas Venčkauskas
36cc18e8cf Add root html tags if not present for note insertion 2021-03-02 17:43:10 -05:00
Dan Stillman
b2b9be381e Clean up temporary note slider 2021-03-02 17:43:10 -05:00
Martynas Bagdonas
8e3dc61070 Improve menubar for reader tab and window 2021-03-02 17:43:10 -05:00
Adomas Venčkauskas
51db52a5ea Changes for note insertion in non-GoogleDocs 2021-03-02 17:43:10 -05:00
Martynas Bagdonas
8709ddd657 Experiment with the new UI 2021-03-02 17:43:10 -05:00
Adomas Venčkauskas
52f3945aa4 Disable switching to the classic dialog when inserting a note 2021-03-02 17:43:10 -05:00
Dan Stillman
393807f487 Don't match attachments or annotations for titleCreatorYearNote search 2021-03-02 17:43:10 -05:00
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