Commit Graph

10652 Commits

Author SHA1 Message Date
RumovZ
850043b49b
Tooltips for CSV import and import page refactoring (#2655)
* Make enum selector generic

* Refactor ImportCsvPage to support tooltips

* Improve csv import defaults

* Unify import pages

* Improve import page styling

* Fix life cycle issue with import properties

* Remove size constraints to fix scrollbar styling

* Add help strings and urls to csv import page

* Show ErrorPage on ImportPage error

* Fix escaping of import path

* Unify ImportPage and ImportLogPage

* Apply suggestions from code review (dae)

* Fix import progress

* Fix preview overflowing container

* Don't include <br> in FileIoErrors (dae)

e.g. 500: Failed to read '/home/dae/foo2.csv':<br>stream did not contain valid UTF-8

I thought about using {@html ...} here, but that's a potential security issue,
as the filename is not something we control.
2023-09-14 09:06:15 +10:00
platynowy
23823d3135
added Translator (#2653)
* added Translator

added myself to the list (translated Anki, AnkiMobile and Anki Manual to Polish

* Update CONTRIBUTORS
2023-09-12 14:13:08 +10:00
Hikaru Y
3742fa9f0c
Fix some issues with undo/redo in mask editor (#2649)
Issues:
- The `change` event was not dispatched in MaskEditor.svelte when an
undo/redo was performed. Therefore, if the user then closed the editor
or switched to another note without performing an operation that would
cause the `change` event to be dispatched, the undone or redone changes
were not saved to DB.
- When `IOMode.kind === "edit"` (i.e., Edit Current or Browse), the
beginning of the undo history was a blank canvas, not a canvas with
existing masks. Therefore, if you continued to undo to the beginning of
the history, the masks that existed when you opened the editor would be
lost, and they would not be restored even when you performed a redo.
- In the 'Add' dialog, the undo history was not reset when starting to
create a new IO note after adding an IO note.

Also add a small UI improvement:
The undo/redo buttons are now disabled when there is no action to
undo/redo.
2023-09-10 13:26:41 +10:00
Damien Elmes
bfef908c6c
Refactor media sync handling (#2647)
* Refactor media sync handling

- The media USN is now returned in sync/meta, which avoids an extra
round-trip.
- Media syncing is now automatically started by the syncing code at
the end of a normal or full sync, which avoids it competing for bandwidth
and resources, and avoids duplicate invalid login messages when the auth
token is invalid.
- Added a new media_sync_progress() method to both check if media is
syncing, and get access to the latest progress.
- Updated the sync log screen to only show the latest line, like AnkiMobile.
- Show media sync errors in a pop-up, so they don't get missed. Use a non-modal
pop-up to avoid potential conflicts with other modals.

* Remove print statement
2023-09-10 13:22:20 +10:00
Damien Elmes
89854ac2b9 Apply some fixes from Abdo
https://github.com/ankitects/anki/pull/2612#issuecomment-1712320801
2023-09-09 09:12:46 +10:00
Damien Elmes
71028207e0 Update translations 2023-09-09 09:06:24 +10:00
Damien Elmes
9d14fcf79d Add a missing word to translations 2023-09-09 09:06:18 +10:00
Michael Winkworth
42ac46fa28
Add ability to tab to DuplicateLink (#2646)
* Add ability to tab to DuplicateLink

The change that allows the DuplicateLink to be tabbed to is the removal of the `tabindex`. The other changes are to make the link only appear as wide as the text, otherwise the tab outline appears around the whole `<span>`, which makes it look weird.

* Fix formatting after attribute removal
2023-09-09 09:03:04 +10:00
RumovZ
14de8451dc
Merging Notetypes on Import (#2612)
* Remember original id when importing notetype

* Reuse notetypes with matching original id

* Add field and template ids

* Enable merging imported notetypes

* Fix test

Note should be updated if the incoming note's notetype is
remapped to the existing note's notetype.
On the other hand, it should be skipped if its notetype id is mapped
to some new notetype.

* Change field and template ids to i32

* Add merge notetypes flag to proto message

* Add dialog for apkg import

* Move HelpModal into components

* Generalize import dialog

* Move SettingTitle into components

* Add help modal to ImportAnkiPackagePage

* Move SwitchRow into components

* Fix backend method import

* Make testable in browser

* Fix broken modal

* Wrap in container and fix margins

* Update commented Anki version of new proto fields

* Check ids when comparing notetype schemas

* Add tooltip for merging notetypes.

* Allow updating notes regardless of mtime

* Gitignore yarn-error.log

* Allow updating notetypes regardless of mtime

* Fix apkg help carousel

* Use i64s for template and field ids

* Add option to omit importing scheduling info

* Restore last settings in apkg import dialog

* Display error when getting metadata in webview

* Update manual links for apkg importing

* Apply suggestions from code review

Co-authored-by: Damien Elmes <dae@users.noreply.github.com>

* Omit schduling -> Import all cards as new cards

* Tweak importing-update-notes-help

* UpdateCondition → ImportAnkiPackageUpdateCondition

* Load keyboard.ftl

* Skip updating dupes in 'update alwyas' case

* Explain more when merging notetypes is required

* "omit scheduling" → "with scheduling"

* Skip updating notetype dupes if 'update always'

* Merge duplicated notetypes from previous imports

* Fix rebase aftermath

* Fix panic when merging

* Clarify 'update notetypes' help

* Mention 'merge notetypes' in the log

* Add a test which covers the previously panicking path

* Use nested ftl messages to ensure consistency

* Make order of merged fields deterministic

* Rewrite test to trigger panic

* Update version comment on new fields
2023-09-09 09:00:55 +10:00
Abdo
ba7140ddec
Expose video driver options for Qt6 (#2643)
* Expose video driver options for Qt6

* Default to d3d11/metal/vulkan on Qt6

* Remove `pass`

* Add missing word to existing translation

* Default to OpenGL on Linux

* Exclude Vulkan from macOS

* Label default drivers
2023-09-09 08:59:49 +10:00
Damien Elmes
6cf38b0326 Update to the latest nextest; use --locked as recommended by them 2023-09-08 07:57:15 +10:00
Damien Elmes
a3d38bdad3 Fix syncStatus being called twice when auto sync disabled 2023-09-07 15:11:36 +10:00
Damien Elmes
b29c147a5d Improve error message when command fails to run 2023-09-07 14:55:52 +10:00
Damien Elmes
9595101065 Wrap backend in an outer Arc
Necessary to allow backend commands that run in the background instead
of blocking.
2023-09-07 14:10:50 +10:00
Damien Elmes
ffd392de21
Change Anki's version scheme; bump to 23.09 (#2640)
* Accept iterables as inputs to backend methods

* Shift add-on check to backend; use new endpoint

The new endpoint will return info on a suitable branch if found,
instead of returning all branches. This simplifies the frontend code,
and means that you can now drop support for certain versions without
it also remotely disabling the add-on for people who are running one of
the excluded versions, like in

https://forums.ankiweb.net/t/prevent-add-ons-from-being-disabled-remote-stealthily-surreptitiously/33427

* Bump version to 23.09

This changes Anki's version numbering system to year.month.patch, as
previously mentioned on https://forums.ankiweb.net/t/use-a-different-versioning-system-semver-perhaps/20046/5

This is shaping up to be a big release, with the introduction of FSRS and
image occlusion, and it seems like a good time to be finally updating the
version scheme as well. AnkiWeb has been updated to understand the new
format, and add-on authors will now specify version compatibility using
the full version number, as can be seen here:

https://ankiweb.net/shared/info/3918629684

* Shift update check to backend, and tidy up update.py

* Use the shared client for sync connections too
2023-09-07 12:37:15 +10:00
Damien Elmes
6d34d19808 Drop legacy schema option 2023-09-06 15:49:14 +10:00
Damien Elmes
28fa74feb3 Update crate name 2023-09-05 19:08:51 +10:00
Damien Elmes
0c6e3eaa93
Integrate the FSRS optimizer (#2633)
* Support searching for deck configs by name

* Integrate FSRS optimizer into Anki

* Hack in a rough implementation of evaluate_weights()

* Interrupt calculation if user closes dialog

* Fix interrupted error check

* log_loss/rmse

* Update to latest fsrs commit; add progress info to weight evaluation

* Fix progress not appearing when pretrain takes a while

* Update to latest commit
2023-09-05 18:45:05 +10:00
Damien Elmes
fe8cf5ae7d Read csv text in eagerly
This allows us to display a more useful "not utf-8" message, instead of a
generic "invalid csv" message when the metadata can't be fetched.
2023-09-05 18:33:23 +10:00
Damien Elmes
ecaba5e655 Fix stack overflow in request::Error mapping 2023-09-05 15:27:17 +10:00
evandrocoan
8d3debb6d4
Implemented support to audio_did_seek_relative (#2632)
* Implemented support to audio_did_seek_relative
2023-09-05 11:15:15 +10:00
Abdo
8e5bd2c3a1
Close import log page on error (#2639) 2023-09-05 10:47:49 +10:00
Abdo
c45f3cb0af
Do not show [object Object] (#2636) 2023-09-04 11:17:42 +10:00
Abdo
d3d67c2083
Support searching for custom data strings (#2634)
* Add extract_custom_data

* Add tests for has-cd

* Add `prop:cds` query
2023-09-04 11:17:13 +10:00
Damien Elmes
ff53625408 Update nightly formatter
Rustfmt is now capable of formatting let Some(..) else {} blocks
2023-09-02 16:13:50 +10:00
Abdo
064b973a2a
Allow searching for missing custom data properties (#2626)
* Allow searching for missing custom data properties

* Add has-cd query
2023-09-01 14:13:31 +10:00
Nil Admirari
9d3f01043b
Support AVIF (#2630) 2023-08-31 08:44:10 +10:00
Damien Elmes
25cab1c67a Revert "Revert "Pull in latest upstream n2 fixes""
Was some debug code in my status hiding patch; commit link updated.
2023-08-31 08:31:43 +10:00
Damien Elmes
1100bb6fe8 Revert "Pull in latest upstream n2 fixes"
This reverts commit e07e60495b.

Latest update has an issue on macOS.
2023-08-31 08:00:34 +10:00
Damien Elmes
e86cebd45e Fix importing link 2023-08-31 07:52:21 +10:00
Damien Elmes
e07e60495b Pull in latest upstream n2 fixes
- Fixes an issue where tasks would continue to appear active for a while
after they had finished on Unix platforms
- The latest n2 now behaves the same way as ninja when substituting
variables, so we no longer need to do the substitution ourselves.
2023-08-31 07:40:57 +10:00
Damien Elmes
740528eaf9 Update to Rust 1.72 2023-08-25 07:56:38 +10:00
Damien Elmes
408b48834b Fix clippy issues in Rust 1.72 2023-08-25 07:56:38 +10:00
Monty Evans
95f7d5a941
Change “Delete Note” shortcut to cmd+backspace (#2614)
* Changed delete note shortcut during reviewing to ctrl+backspace

* Added name to contributors

* Changed Mac shortcut
2023-08-25 07:15:11 +10:00
Damien Elmes
dcf91fcc50 Fix ninja compatibility 2023-08-25 02:45:16 +10:00
Aristotelis
b55cf11e0e
Update CONTRIBUTORS (#2623)
Re-register updated GH noreply email
2023-08-24 13:16:37 +10:00
Aristotelis
594267149d
[IO API] Create Python entry points for creating and editing IO notes (#2598)
* Create python API for adding and editing IO notes

Also: Refactor IO-related methods, tweaking their naming and moving them to a continuous section

* Ensure editor is loaded before setupMaskEditor call

---------

Co-authored-by: Glutanimate <glutanimate@users.noreply.github.com>
2023-08-24 12:35:38 +10:00
Damien Elmes
239e964c42
Shift output suppression into n2 (#2618)
After updating with tools/install-n2, you should now be able to see
the last line of long-running commands like cargo invocations.
2023-08-23 11:59:52 +10:00
Damien Elmes
3b7c5d71ab Update Rust deps 2023-08-23 11:44:33 +10:00
Damien Elmes
9122aab3ad Fix a deprecation warning in Svelte 2023-08-23 11:05:14 +10:00
Aristotelis
538ea31387
Fix typo: notetypeId → noteId (#2615)
IOEditingMode interface expects noteId
2023-08-21 15:00:05 +10:00
Damien Elmes
bc295b41c1 Update n2 to fix https://github.com/ankitects/anki/pull/2612#issuecomment-1685376149 2023-08-21 12:45:17 +10:00
Damien Elmes
70506aeb99 Temporarily turn off I/O support
Aristotelis has asked for a bit more time to work on it, and this unlocks
a new beta/stable release. Will revert this commit after the release is
out.
2023-08-20 08:41:35 +10:00
Damien Elmes
cdcd9bcce0 New collections now start with the v3 scheduler 2023-08-19 13:31:01 +10:00
Damien Elmes
f2fefbb052 Update translations 2023-08-19 11:53:37 +10:00
Damien Elmes
d2022d1a6d Avoid allocating in extract_latex() if possible; make public 2023-08-19 08:05:39 +10:00
Mani
87e2cf7976
fix: reset image button in io note editor (#2602) 2023-08-16 07:47:46 +10:00
Gabriel Heinatz
72ed482133
fixed and tested issue #2608 (#2611)
* fixed issue #2608
It was indeed the tabstop order.

* added my name and mail to fulfill test requirements

* fixed and tested issue #2608
There was a wrong name in the tabstop, so it could not resolve that name and skipped the element.
2023-08-16 07:26:50 +10:00
Damien Elmes
b73cb15888 Take another approach to dealing with conflicting flattened keys
The approach in #2542 unfortunately introduced a regression, as whilst
it ensured that duplicate keys are removed when downgrading, it no longer
prevented the duplicates from being removed when converting to a legacy
Schema11 object. This resulted in things like backend.get_notetype_legacy()
returning duplicate keys, and could break syncing:

https://forums.ankiweb.net/t/windows-desktop-sync-error/33128

As syncing and schema11 object usage is quite common compared to downgrading,
the extra Value deserialization seemed a bit expensive, so I've switched
back to explicitly removing the problem keys. To ensure we don't forget to
add new keys in the future, I've added some new tests that should alert us
whenever a newly-added key is missing from the reserved list.
2023-08-15 11:25:53 +10:00
Damien Elmes
c112236dd9 Support include_filtered=false, skip_default=true case 2023-08-08 15:34:43 +10:00