Commit graph

9467 commits

Author SHA1 Message Date
Damien Elmes
5039db0e17 Avoid progress window pop-up when application not focused
A 10ms delay was chosen as it tends to result in the progress window
appearing immediately when clicking into the unfocused window, preventing
another action from being started before the progress window appears.

Closes #1873
2022-05-26 12:35:39 +10:00
Damien Elmes
da9e3c97ff Fix duplicate Anki icons appearing in dock
MPV was previously stored in the MacOS/ folder, which made macOS think
it should have a dock icon.

Fixes #1812
2022-05-26 11:05:36 +10:00
wisherhxl
806a5d9c56 Fix ibus first keystroke goes two (#1886)
Calling `moveCaretToEnd()` when `richText` is empty will cause the first keystroke of
ibus-based input methods with candidates to goes double. For example, if you
type "a" it becomes "aa". This problem exists in many linux distributions.
When `richText` is empty, there is no need to place the caret, just return
as a workaround.
2022-05-26 10:47:55 +10:00
Damien Elmes
856b89d88e Make editor.cleanup() idempotent
Hammering the esc key as a dialog loads can cause it to be run more
than once, leading to an error message.
2022-05-25 22:04:50 +10:00
Damien Elmes
f51d6aaace Possible fix for Qt 6.3 crashes
As mentioned on #1879, the dialog.deleteLater() call appears to be
causing crashes on some systems on Qt 6.3. Explicitly destroying the page
prior to the containing webview appears to work around the issue.
2022-05-25 21:46:47 +10:00
Damien Elmes
e0e807986b Fix deck options sticky bar at top disappearing on scroll
Issue was introduced in 7922f18296
when the styling was moved into base.scss. From what I can tell, there
are two locations where the current styling is required:

- the editor, to ensure the tags are shown at the bottom
- the change notetype screen, which requires this styling for a sticky
bar at top

I'm no CSS guru, so if someone thinks this could be solved in a better
way, please submit a follow-up PR.

Closes #1782
2022-05-23 16:10:45 +10:00
Henrik Giesel
f7b57b1c4e Add getNoteId to exports (#1884) 2022-05-23 09:14:36 +10:00
Damien Elmes
57ff1097e4 Switch editor to full MathJax package to fix broken autoloads
Re: https://forums.ankiweb.net/t/anki-2-1-53-release-candidate/20122/2

Autoloads in MathJax are asynchronous, and the caller is expected to
use asynchronous APIs when they are in use [1]. The editor uses the synchronous
tex2svg(), which throws a "MathJax retry" error when an autoload package
has not yet loaded. Attempting to use the package before it has loaded
appears to break future invocations as well, so the package fails to work
at all until a new webview is created.

The following HTML will reproduce the issue when added to a single card
in a new profile:

```
<strong>6&nbsp; &nbsp;&nbsp;</strong>Every combination of <anki-mathjax>\boldsymbol{v}=(1,-2,1)</anki-mathjax> and <anki-mathjax>\boldsymbol{w}=(0,1,-1)</anki-mathjax> has components that add to&nbsp; _____.<br>
```

Ideally we'd switch the MathJax rendering to be asynchronous, but that
didn't work well when I tried it in #1862. For now I've just switched
to the full package, which adds about 130KB to the final minified JS
(2.76MB), and likely slows down editor loading somewhat.

[1] https://github.com/mathjax/MathJax/issues/2557#issuecomment-727655089
2022-05-21 14:01:38 +10:00
Damien Elmes
866e92d55e Update setting for latest Rust Analyzer 2022-05-21 13:34:19 +10:00
Damien Elmes
2afe18c914 Bump version 2022-05-20 18:01:41 +10:00
Damien Elmes
8a2cae512e Update translations 2022-05-20 17:58:16 +10:00
Damien Elmes
d603fd3227 Rework display of available cards in custom study
In v3, it's more informative to show the count of child decks separately,
since increasing the limit of the current deck does not increase the limits
of child decks. When we rework the decks list in the future, a tooltip
will hopefully provide an easier way for users to see where cards are
available, and where limits are being applied.

Closes #1868
2022-05-20 17:52:02 +10:00
Damien Elmes
5d83f29c03 Update translations 2022-05-19 12:49:38 +10:00
Damien Elmes
991a69a3bb Reveal cloze answers in MathJax preview
Closes #1862
2022-05-19 12:48:12 +10:00
Abdo
6116c2d084 Add the previewer_did_init hook (#1882) 2022-05-19 11:10:12 +10:00
BlueGreenMagick
8bdef07449 Fix graphs tooltip incorrect position (#1872) 2022-05-19 11:08:57 +10:00
Abdo
5f06829be4 Add the reviewer_will_replay_recording hook (#1877) 2022-05-18 13:44:56 +10:00
RumovZ
46c371e71a Fix Rust Analyzer recommendation (#1878) 2022-05-18 13:40:10 +10:00
RumovZ
c597ccb277 Fix #1874 (#1875)
Probably a race condition. `.get_row()` is not a reliable check for card
or note existence, because it returns from an outdated cache,
if the backend is currently blocked.
2022-05-18 13:34:51 +10:00
Henrik Giesel
d1dfa77578 Allow style tags in HTML editor (#1870) 2022-05-17 16:37:20 +10:00
Damien Elmes
646e08544c Fix new card positions being included in future due graph
Introduced in dfa8d50a9d

https://forums.ankiweb.net/t/anki-2-1-52-qt6-stats-bug-future-due-backlog/20016
2022-05-16 15:14:15 +10:00
Henrik Giesel
e16647cfa4 Update Svelte to 3.48.0 (#1867) 2022-05-16 14:47:38 +10:00
Henrik Giesel
74294a6d72 Transform <br> in Mathjax to newlines (#1866)
* Transform <br> in Mathjax to newlines

* Add missing quantifier
2022-05-16 14:42:10 +10:00
Damien Elmes
bf57e5c263 Allow alt tags when pasting images
https://forums.ankiweb.net/t/do-not-strip-alt-attribute-when-pasting-images-from-the-web/20007
2022-05-16 14:32:24 +10:00
Damien Elmes
8c583032c6 Only organize Python imports automatically
It's causing changes that aren't reproduced/picked up by prettier:

https://github.com/ankitects/anki/pull/1862#discussion_r870395750
2022-05-13 13:44:48 +10:00
Henrik Giesel
da9e444cd3 Use same config for editor and reviewer Mathjax (#1865)
* Remove custom config and use tex-chtml-full for editor Mathjax

* Add mathjax package in /ts

* Share mathjax config between tex-svg and tex-chtml

* Use "[+]" in Mathjax config again

* Remove mention of MathJaxReady

* Satisfy eslint
2022-05-13 13:23:35 +10:00
Abdo
1d9699fb5b Add some helper functions to AVPlayer (#1864) 2022-05-13 13:08:05 +10:00
Henrik Giesel
2593b8efd1 Implement cloze buttons in Mathjax editor (#1860)
* Introduce RichTextClozeButtons

* Implement cloze buttons in Mathjax editor
2022-05-13 13:04:20 +10:00
Henrik Giesel
83fa4726e4 Move focus into HTML editor when shown (#1861)
* Move focus into input field, when input is shown

* Change trapFocusOut to move focus into available inputs

- This means that e.g. closing the HTML editor with focus in it will
  focus the visual editor in turn

* Prevent Control+A unselecting tag editor when no tags exist
2022-05-13 13:02:03 +10:00
Henrik Giesel
316e5fe5f5 Change how resizable images work (#1859)
* Add ResizableImage.svelte in ts/editable

* Set image constrained via attributes instead of managed style sheet

* Implement new constrained size method

* Turn WithImageConstrained.svelte into normal ts file

* Introduce removeStyleProperties

Removes "style" attribute if all style properties were cleared

* Avoid --editor-width and use one variable set on container

* Disable shrinking if already smaller than shrunken size

* Add button to restore image to original size

* Don't allow restoring original size if no custom width set

* Bottom-center HandleLabel

* Satisfy svelte-check
2022-05-13 12:57:07 +10:00
BlueGreenMagick
c224cd1431 remove image.style.height on resize (#1856) 2022-05-11 10:06:34 +10:00
Damien Elmes
42d2c3d956 Update translations 2022-05-10 13:18:07 +10:00
RumovZ
5abe50f254 Fix review queue if limit is reached (#1855) 2022-05-10 12:11:35 +10:00
Henrik Giesel
b55dae8834 Change sequence of Mathjax escaping (#1854) 2022-05-10 11:54:06 +10:00
Henrik Giesel
b4582c45d2 Set editor size to 1.6 on Windows as well (#1853) 2022-05-10 11:48:11 +10:00
Henrik Giesel
311d6c3f74 Fix activeName updating wrongly when selecting previous tag from invalid tag (#1851) 2022-05-10 11:45:41 +10:00
Abdo
0715831a96 Store rendered side in TemplateRenderContext (#1852)
* Store rendered side in TemplateRenderContext

* Move _question_side up with the other simple properties (dae)
2022-05-10 11:44:44 +10:00
BlueGreenMagick
86ff90e362 select all tags with Ctrl+A (#1847) 2022-05-10 11:39:54 +10:00
Damien Elmes
cb0312ba85 Mention eslint --fix in docs
https://github.com/ankitects/anki/pull/1847#issuecomment-1120954217
2022-05-10 11:39:15 +10:00
BlueGreenMagick
a0e7152814 Fix when tooltip changes before tooltipObject is created (#1845)
It can happen in TagWithTooltip.svelte
when a tag is normalized beause of leading/trailing delimiter
2022-05-10 11:36:54 +10:00
RumovZ
066bd5f7c2 Fix undisruptive formatting issues (#1848)
* Skip unparsable pylib files with black

This was causing black to return a non-zero code, preventing the
subsequent isort from running.

* Organise imports on save
2022-05-09 20:00:20 +10:00
BlueGreenMagick
dafaf2fa75 fix typo. Shortcut uses on:action not on:click (#1846) 2022-05-09 19:55:35 +10:00
BlueGreenMagick
02983a6fdc Fix caret jumping to start when unselecting autocomplete suggestion (#1844) 2022-05-09 11:15:56 +10:00
BlueGreenMagick
8eeb656561 align tag icon and text (#1843) 2022-05-09 11:15:44 +10:00
Abdo
bb7fc2d3d7 Add the av_player_will_play_tags hook (#1842)
A general version of the reviewer_will_play_question_sounds and reviewer_will_play_answer_sounds hooks
2022-05-09 11:08:34 +10:00
Damien Elmes
adf6220bb9 Fix for crash with invalid dates on Windows (#1837)
https://forums.ankiweb.net/t/bug-report-crashing-when-opening-deck-browser/19768

Caused by a note mtime that was 1000x larger than it should have been.
Check DB will now fix this case (but there are others it still does not
cover, such as invalid card/note IDs).

https://docs.rs/chrono/0.4.19/x86_64-pc-windows-msvc/src/chrono/sys/windows.rs.html#128
2022-05-07 10:30:23 +10:00
Henrik Giesel
e979d31d8b Replace sequences of whitespace into single space in AddTags (#1840) 2022-05-07 09:16:57 +10:00
Henrik Giesel
a267e4299b Make TagAddButton focusable and simulate click on focus (#1838) 2022-05-07 09:15:58 +10:00
Damien Elmes
e5cb6c3f8e Add more progress + abort points to export code
The old `media_files_did_export` hook has been kept around for use with
the legacy apkg exporter (an add-on uses it), and a new 
`legacy_export_progress` hook has been added so we can get progress
from the new colpkg exporter until we move over fully to the new code.
2022-05-06 15:32:23 +10:00
Damien Elmes
e733e4e23e Update translations 2022-05-06 09:27:15 +10:00