Commit graph

10144 commits

Author SHA1 Message Date
Damien Elmes
9ec4bcbfd2 Log mpv invocation failure for debugging
https://forums.ankiweb.net/t/i-received-this-error-while-reviewing-a-deck-with-cards-that-had-video-mp4/30105
2023-05-11 14:47:23 +10:00
Hikaru Y
2431bfc3ea Fix custom font preloading sometimes not working (#2493)
It didn't work if both a reference to an external style sheet and
a description of a custom font are present in a style element.
2023-05-11 14:10:29 +10:00
Damien Elmes
635048414c Fix a panic when user sets a huge learning step 2023-05-11 09:10:22 +10:00
Damien Elmes
e6547bb9ab Automatically fetch win32 audio tools in .\run.bat 2023-05-11 09:10:22 +10:00
Hikaru Y
9a7a5a3574 Refactor CSS/image preloading; implement custom font preloading (#2356)
* Refactor CSS preloading

- Rename css.ts to preload.ts
- Rename type/function names
- Automatically remove style/link element on load/error event

* Refactor image preloading

- Reuse template element
- Change timeout value from 100ms to 200ms, as it often takes more than
  100ms to load even a single small image on a low-spec machine
- Refactor preloadAnswerImages():
  - Use 'new Image()' instead of <link rel=preload>
  - Stop calculating images that only appear on the answer side as
    cached images are resolved immediately

* Update tsconfig.json

es2020.string -> String.matchAll()
es2018.regexp -> RegExprMatchArray.groups

* Implement custom font preloading

Font files for some languages such as Chinese and Japanese can be as
large as 20MB, so we set the timeout value to 800ms for font preloading.
2023-05-10 13:26:02 +10:00
Damien Elmes
f1f1015d5a Fix unreadable bootstrap buttons when hovering
Closes #2297
2023-05-09 17:04:12 +10:00
Damien Elmes
47a8154c3a Update translations 2023-05-09 16:45:27 +10:00
XeR
912ad0d374 Fix sync client ignoring directories (#2490)
* Fix sync client ignoring directories

Current implementation of the sync client does not properly send requests to a
self-hosted sync server if the URL has directories.

If the self-hosted sync URL is `https://example.org/foo/bar/`, Anki is expected
to send requests to `https://example.org/foo/bar/sync/hostKey`. Instead, it will
discard the directories and wrongly send requests to
`https://example.org/sync/hostKey`.

Fixes: 1e6686f ("Fix panic with invalid sync server URL with port")

* Add XeR to contributors
2023-05-08 11:40:57 +10:00
Ren Tatsumoto
f54b3053d5 Enchance reviewer with new settings (#2489)
* add grading shortcuts

* add a new setting: grade with space

* new key: u for undo

* run ./ninja format

* rename property

* rename translation

* run ./ninja format
2023-05-08 11:04:18 +10:00
Matthias Metelka
3312ce03a9 Prevent skewing of resized images in editor (#2488)
* Unset inline size when shrinking images

to prevent skewing (https://forums.ankiweb.net/t/is-there-a-way-to-prevent-the-squish-skew-of-the-image-in-the-browser-editor/29925)

* Unset inline width/height for all images when shrinking is enabled
2023-05-05 19:16:06 +10:00
Damien Elmes
1d8c1f2c6d Stop printing dbus errors to the terminal
Even at every 5 minutes, it can be noisy.
2023-05-02 17:53:19 +10:00
Damien Elmes
809d43fba6 Update fcitx plugin
Closes #2487
2023-05-02 15:57:24 +10:00
Damien Elmes
3b8e875177 Update flask for security update
CVE-2023-30861

It doesn't look like it affects us.
2023-05-02 14:43:04 +10:00
Damien Elmes
20e47e2982 Fix CFBundleExecutable
https://forums.ankiweb.net/t/macos-version-of-anki-including-parent-dir-with-cfbundleexecutable-value/29900
2023-05-02 14:20:55 +10:00
Damien Elmes
97201add77 Mention that checkout path should not include spaces 2023-05-01 15:39:03 +10:00
Damien Elmes
2c8800d5bf Bump version 2023-05-01 12:26:37 +10:00
Damien Elmes
a174a04893 Update translations 2023-05-01 11:47:30 +10:00
Damien Elmes
da139071e6 Avoid firing click event in floatables when user drags the mouse
Alternative approach at fixing #2484
2023-05-01 11:44:24 +10:00
Damien Elmes
7f794f32fb Revert "Prevent MathJax editor from closing unexpectedly when selecting text (#2484)"
This broke mouse selection of dropdowns, as code that set closeOnInsideClick never
got a click signal as the floating area is closed before the click fires.

https://forums.ankiweb.net/t/anki-2-1-62-beta-release-candidate/29302/21

This reverts commit 389852ac17.
2023-05-01 11:17:09 +10:00
Damien Elmes
6bc07006f8 Update translations 2023-04-28 11:58:27 +10:00
Hikaru Y
389852ac17 Prevent MathJax editor from closing unexpectedly when selecting text (#2484)
* Prevent MathJax editor from closing unexpectedly when selecting text

* Revert "Prevent MathJax editor from closing unexpectedly when selecting text"

This reverts commit b43d33a6de.

* Prevent floating/overlay element from closing when selecting text

Apply suggestions from code review.

Use a 'mousedown' event instead of a 'click' event so that releasing
the mouse button at the end of a text selection operation when the
pointer is outside a floating/overlay element does not close it.

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

---------

Co-authored-by: Damien Elmes <dae@users.noreply.github.com>
2023-04-28 11:39:50 +10:00
Damien Elmes
191e11a1f2 Improve import messaging when notetype has changed (#2483)
* Fix file extension not being appended on export

Regressed in #2427

* Improve import messaging when notetype has changed

- If the local notes are up to date, we don't need to warn about the
changed notetype, as no updates are required.
- Make it clearer that a changed notetype only affects updates.

Will update the docs as well.
2023-04-28 11:39:18 +10:00
Ren Tatsumoto
577e87878c Add a hook that allows to edit a note before it is added. (#2481)
* add note_will_be_added hook

* attempt to fix Tests.buildkite/linux/entrypoint

* attempt to fix Tests.buildkite/linux/entrypoint

* apply patch
2023-04-27 15:34:33 +10:00
Damien Elmes
55b95c580b Bump pyqt6-sip version 2023-04-27 11:43:01 +10:00
Damien Elmes
76380131a1 Add new pyqt6.5 checksums
Because the version number was not changed, this was breaking new installs.

https://www.riverbankcomputing.com/pipermail/pyqt/2023-April/045257.html
2023-04-26 22:07:59 +10:00
Damien Elmes
dd9cd6a514 Tweak unit test to reduce likelihood of flake under heavy load
https://buildkite.com/ankitects/anki-ci/builds/5698#0187bd42-c032-4078-909d-035a57892e0e
2023-04-26 21:38:04 +10:00
Damien Elmes
d611709cb7 Fix a few more cases where missing profile keys would lead to an error 2023-04-26 21:10:24 +10:00
Damien Elmes
6be2dce06f Use correct default values for missing keys 2023-04-26 19:11:48 +10:00
Damien Elmes
75f04326c0 Tolerate missing keys in profile DB
https://forums.ankiweb.net/t/crash-with-error-keyerror-mainwindowstate/29689
2023-04-26 19:07:59 +10:00
Damien Elmes
c9a04bb8fb Support scheduled Rust cache clearing 2023-04-26 17:19:00 +10:00
Damien Elmes
6b8f7289d9 Cleanup tmp files after CI run 2023-04-26 17:11:24 +10:00
Damien Elmes
3cf6b3f00c Update translations 2023-04-26 16:09:10 +10:00
Damien Elmes
331df24f3a Clarify warning in notetype reset 2023-04-26 16:08:48 +10:00
Mani
3b1345440a fix image height issues in iOS safari (#2480)
* use i18n message when not showing image

* fix height for iOS

* some ui styling

* fix polygon draw in panzoom

* more ui styling and fixes
2023-04-26 16:01:04 +10:00
Hikaru Y
5a11652e75 Refactor plain/rich text input toggling code; fix focus loss (#2479)
* Refactor plain/rich text input toggling code; fix focus loss

Fix:
- Issue where field loses focus when plain/rich text input is closed

Refactoring:
- Call refocus() inside the reactive statement in
  Plain/RichTextInput.svelte to eliminate the need for polling
  with requestAnimationFrame
- Introduce 'Flag' class
- Move 'on:toggle' handlers from inline to functions defined in
  the <script> section for better readability

* Improve code clarity based on feedback from code review

- Rename method and add comment to it
- Add 'private' access modifier to property
2023-04-22 16:08:25 +10:00
Damien Elmes
070f26dadd V -> ValueType
https://github.com/ankitects/anki/pull/2472#issuecomment-1513507162
2023-04-19 16:43:23 +10:00
Damien Elmes
1fea0dfd71 Bump h2 version
https://github.com/hyperium/h2/issues/674
2023-04-19 15:31:13 +10:00
Damien Elmes
c2302605bb Various tweaks to I/O code (#2478)
* Allow user to select I/O notetype instead of enforcing a specific name

* Display a clearer error when I/O note is missing an image

Opening the card layout screen from "manage notetypes" was showing an
error about the Anki version being too old.

Replacement error is not currently translatable.

* Preserve existing notetype when adding I/O notetype

* Add a 'from clipboard' string

The intention is to use this in the future to allow an image occlusion
to be created from an image on the clipboard.

* Tweak I/O init

- Use union type instead of multiple nullable values
- Pass the notetype id in to initialization

* Fix image insertion in I/O note

- The regex expected double quotes, and we were using single ones
- Image tags don't need to be closed

* Use more consistent naming in image_occlusion.proto

* Tweaks to default I/O notetype

- Show the header on the front side as well (I presume this is what
users expect; if not am happy to revert)
- Don't show comments on card (again, I presume users expect to use
this field to add notes that aren't displayed during review, as they
can use back extra for that)

* Fix sticky footer missing background

Caused by earlier CSS refactoring
2023-04-19 15:30:18 +10:00
Damien Elmes
c5934bedf8 Allow cloze/image occlusion notetypes to be restored to defaults 2023-04-19 15:04:18 +10:00
Damien Elmes
efe963bdfd Update translations 2023-04-18 14:12:07 +10:00
Damien Elmes
6c2128fed0 Add ability to restore a notetype to its original configuration (#2472)
* Store the original stock notetype kind in the notetype

Will allow us to provide a command to restore a notetype to its default
settings/templates.

* Add a new action to restore a notetype to its original state
2023-04-18 14:07:51 +10:00
RumovZ
4ce1b40adb Add emojis for graphs in hourly breakdown tooltip (#2464) 2023-04-17 16:16:10 +10:00
Damien Elmes
44a4a86294 Revert Windows build to Qt 6.4; update to 6.4.3
Multiple users have reported that 6.5 is behaving sluggishly

https://forums.ankiweb.net/t/anki-2-1-62-beta/29302/9
2023-04-14 12:05:34 +10:00
dependabot[bot]
deb2b0f001 Bump h2 from 0.3.16 to 0.3.17 (#2471)
Bumps [h2](https://github.com/hyperium/h2) from 0.3.16 to 0.3.17.
- [Release notes](https://github.com/hyperium/h2/releases)
- [Changelog](https://github.com/hyperium/h2/blob/master/CHANGELOG.md)
- [Commits](https://github.com/hyperium/h2/compare/v0.3.16...v0.3.17)

---
updated-dependencies:
- dependency-name: h2
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-04-14 08:26:19 +10:00
Damien Elmes
6de86a246d Use original deck name if card is in filtered deck
https://forums.ankiweb.net/t/inconsistent-read-deck-name-and-seed-from-ctx-will-recognize-the-filtered-deck-as-the-deck-name/29327
2023-04-13 14:46:47 +10:00
Damien Elmes
bfef10e2de Update to the latest TypeScript version
Required a svelte-preprocess upgrade for compatibility.
2023-04-12 16:42:28 +10:00
Damien Elmes
18796934f0 Remove some dead code and an invalid import from types.ts 2023-04-12 16:36:15 +10:00
Damien Elmes
4f3abe81e2 Update to the latest wheel package; make code work with it 2023-04-12 16:17:00 +10:00
Damien Elmes
20deace2b7 Upgrade to Qt 6.5 on Mac
This bumps the minimum required macOS version to 11 for Qt6.

Closes #2263
2023-04-12 16:12:41 +10:00
Damien Elmes
f8a221e76d Add helper script for Intel cross compile on ARM Mac 2023-04-12 15:48:31 +10:00