Commit graph

2318 commits

Author SHA1 Message Date
Damien Elmes
b3a85a6515 Revert "Decide if element is bold by getComputedStyle (#2453) (#2579)"
This reverts commit 9ced6be03e.

Caused a regression:
https://forums.ankiweb.net/t/anki-24-10-beta/49989/150
2024-10-11 23:34:50 +10:00
Hikaru Y.
e79060487b
Fix broken tag editor in Svelte 5 (#3488)
* Fix temporary disappearance of a tag

https://forums.ankiweb.net/t/anki-24-10-beta/49989/47

* Fix incorrect behavior after tag deletion

* Fix tag addition/selection buttons becoming invisible

Once tags were selected, subsequent deselection or selection did not
mount 'TagAddButton' or 'TagsSelectedButton' components.
2024-10-11 23:21:00 +10:00
Tomas Fabrizio Orsi
d4a3e4828b
ts/src/app.html: Changed from favicon.png to favicon.ico (#3485)
Signed-off-by: Tomas Fabrizio Orsi <torsi@fi.uba.ar>
2024-10-11 22:25:58 +10:00
Jarrett Ye
a982720a42
Feat/Easy Days (#3442)
* Feat/Easy Days

* format

* add easy_days_percentages to deck_config

* configure Easy Days via table

* remove unused code

* add translatable strings & add default of easy days

* don't check easy_days_percentages when deserialize

* pass test::all_reserved_fields_are_removed

* consider next_day_at when interval_to_weekday

* remove y-axis-title created in last simulation

* EstimatedTotalKnowledge should be integer

* Reorder deck option sections (dae)

- Move FSRS to bottom left, to move it closer to the top, and so
the left and right columns appear roughly balanced when FSRS is
enabled.
- Move Easy Days above Advanced

* Don't crash if wrong number of days (dae)

* Use lower field number (dae)

Repeated fields are more compactly stored in the first 15 fields.
2024-10-11 19:47:44 +10:00
Hikaru Y.
407e2dc43b
Fix issues with 'Discard changes' confirmation dialog (#3478)
* Prevent memory leak

* Fix deck option changes not detected until focus is lost

* Accurately determine if there are any pending changes

This makes it so that the confirmation dialog appears when it should,
and not when it shouldn't.
2024-10-06 14:21:00 +10:00
Damien Elmes
80ebdf1988 Flip order of question/answer actions, and ascending/descending ease
https://forums.ankiweb.net/t/anki-24-10-beta/49989/53
2024-10-04 20:52:20 +10:00
Damien Elmes
85f034b144 Split true retention into multiple tables; display vertically
This prevents the page scrolling off screen on small devices. This is
a quick fix, and further tweaks to the layout are welcome.
2024-10-04 17:04:22 +10:00
mmjang
9ced6be03e
Decide if element is bold by getComputedStyle (#2453) (#2579)
* Decide if element is bold by getComputedStyle (#2453)

* Use getComputedStyle() for italics too (dae)
2024-10-02 19:37:40 +10:00
Taylor Obyen
d6aa95950d
Fix occlusion drift again (#3443)
* Fix occlusion drift

* Fix image editor occasionally not loading fully

* Fix occlusion disassociation when browsing

* Address oversights

* Fix translucent modifier applies to newly created shapes incorrectly

* Fix i-text turns yellow upon immediate note change

* Fix image occlusion hot keys not disabled when typing

* Improve text label creation experience

* Remove redundant functions

* Fix error when adding occlusion (dae)
2024-10-02 17:19:52 +10:00
Jarrett Ye
59969f62f5
polish graphs of simulator, true retention table and forgetting curve (#3448)
* polish graphs of simulator and forgetting curve

* True Retention: decrease precision of percentages

* apply uniform sampling rate to forgetting curve

* don't display time, only date when maxDays >= 365

* don't floor the totalDaysSinceLastReview

* correct cramming condition

* improve code-style

* polish ticks & tooltip of simulator

* remove unused import

* fix minor error of daysSinceFirstLearn

* filter out revlog entries from before the reset

https://forums.ankiweb.net/t/anki-24-10-beta/49989/63?u=l.m.sherlock

* use Math.ceil for windowSize

* fill currentColor for legend text

* remove mix-blend-mode: multiply

* tune the position of legend
2024-10-01 00:22:30 +10:00
Taylor Obyen
fdc69505e9
Fix incorrect canvas bounds calculations (#3457)
* Fix incorrect canvas bounds calculations

* Fix contributors

* Set variables to be constant
2024-10-01 00:03:38 +10:00
Jarrett Ye
79592730ee
Feat/forgetting curve in card info (#3437)
* add elapsed time into revlog-table

* add stability into revlog-table

* add Graph of forgetting curve

* fix eslint

* add radio buttons of timeRange

* add revlog filter && return [] for new card

* format

* translatable string & disable if using SM-2

* elapsedTime should skip manual or filtered review

* add HoverColumns

* fix eslint

* add stability to tooltip & use timeSpan

* reuse translatable strings

* distinguish daysSinceFirstLearn and elapsedDaysSinceLastReview

* Date x-axis & toLocaleString

* Temporarily hide elapsed/stability columns (dae)

https://github.com/ankitects/anki/pull/3437#issuecomment-2378851900
2024-09-27 19:32:40 +10:00
Damien Elmes
cf17ca2f84 Revert "Fix occlusion rounding bug (#3400)"
This reverts commit 96ff4f1a4a.

This change broke adding of new occlusions on desktop:

JS error /_anki/js/editor.js:100016 Uncaught TypeError: Cannot read properties of undefined (reading 'getBoundingRect')
2024-09-25 20:04:35 +10:00
Damien Elmes
221d995180 Fix header/extra fields being collapsed on mobile
+ use a class, since this element is repeated
2024-09-25 19:51:19 +10:00
Damien Elmes
a4002783a5 Fix Back Extra field not being added 2024-09-25 19:51:19 +10:00
Damien Elmes
740d95d53f Fix inability to save occlusions on mobile 2024-09-25 19:51:18 +10:00
Abdo
bf46a5f08c
Update to Svelte 5 (#3292)
* Update to Svelte 5

* Fix `<tr> is invalid inside <table>`

* Update sveltekit-svg to match svelte version

Fixes deck options failing to load, and a bunch of warnings with
./yarn dev

* Fix graph tooltips

* Fix editor loading

* Fix MathJax editor not loading

* Formatting

* Fix new formatting errors

* Merge remote-tracking branch 'origin/main' into svelte5

* Remove slot inside EditorToolbar

I think this is just stray code left over from a refactor, but I'm
not 100% sure.

Fixes
Error: Object literal may only specify known properties, and 'children' does not exist in type '{ size: number; wrap: boolean; api?: Partial<EditorToolbarAPI> | undefined; }'. (ts)
<div class="note-editor">
    <EditorToolbar {size} {wrap} api={toolbar}>
        <slot slot="notetypeButtons" name="notetypeButtons" />

* Fix component typing error

* Comment out svelte/internal exports, so editor loads

* Fix image occlusions in editor

* Revert "Remove slot inside EditorToolbar"

This reverts commit b3095e07ac,
which prevented the Preview button from showing in the browser.

This will break our tests again.

* Update vite

* Disable routes/tmp for now

* Fix references issue in routes/tmp
2024-09-25 18:49:07 +10:00
Jarrett Ye
3912db30bb
Feat/true retention stats (#3425)
* Feat/true retention stats

* ./ninja fix:minilints

* use translatable strings & update style

* remove card couts & add more translatable strings

* Update statistics.ftl

Co-authored-by: user1823 <92206575+user1823@users.noreply.github.com>

* add Estimated total knowledge (cards)

---------

Co-authored-by: user1823 <92206575+user1823@users.noreply.github.com>
2024-09-22 19:00:27 +10:00
Ben Nguyen
c2f3e63b90
Bug with “A 100 day interval will become X days.” (#3432)
* add name to about page

* use two decimal retention for calculations

* Update CONTRIBUTORS

* format

* Update CONTRIBUTORS

* Update CONTRIBUTORS

* Update CONTRIBUTORS
2024-09-22 18:24:32 +10:00
Arthur Milchior
b08e454f57
If deck options are modified, ask before closing (#3410)
* If deck options are modified, ask before closing

This imitates the way the note editor behaves. If a user assumes by
error that chanhges are automatically saved, it ensures they won't
lose them.

Also, this will eventually allows to have the same feature on
AnkiDroid. While, currently, we always ask the user whether they want
to close the deck options, even when there are no modification, which
seems to regularly frustate users (including myself).

I'm new to Svelte, please let me know whether there is a better way to
obtain the information from Svelte state that I missed.

Note that I ensured that only a boolean can be obtained. I didn't
cause the whole state to be accessible. May be useful for some
add-ons, I guess, but risks breaking too much things.

Regarding the deckoptions.py, I tried to imitate addcards.py way to
check whether the add card view can be closed. Reusing the same
function and variable name when possible.

* Update qt/aqt/deckoptions.py (dae)
2024-09-22 18:07:24 +10:00
Abdo
847f3f6714
Fix FSRS progress update issues (#3420)
* Delay optimal FSRS params alert to ensure progress updates are reported

* Ensure progress updates arrive synchronously
2024-09-20 21:18:02 +10:00
Taylor Obyen
96ff4f1a4a
Fix occlusion rounding bug (#3400)
* Fix occlusion rounding bug

* Fix contributors
2024-09-20 20:48:44 +10:00
Luke Bartholomew
1b7123aa94
Add comment about the usage of the input field in the statistics page (#3394) (#3398)
* Add comment about the usage of the input field in the statistics page (#3394)

* Fix formatting issues (#3394)

* Update ts/routes/graphs/RangeBox.svelte

Co-authored-by: Mike Hardy <github@mikehardy.net>

* Update ts/routes/graphs/RangeBox.svelte

Co-authored-by: Mike Hardy <github@mikehardy.net>

---------

Co-authored-by: Damien Elmes <dae@users.noreply.github.com>
Co-authored-by: Mike Hardy <github@mikehardy.net>
2024-09-20 20:47:04 +10:00
Abdo
21df287579
Fix minimum interval warning shown when FSRS is enabled (#3409) 2024-09-11 02:21:49 +07:00
Abdo
880c7d366c
Fix graph averages (#3406)
* Fix graph averages

* Fix formatting
2024-09-11 02:18:53 +07:00
Jarrett Ye
34809f2520
Fix/simulator crashes if no history (#3405)
* Fix/simulator crashes if no history

* ./ninja format

* remove (experimental) from ComputeOptimalRetention

* update to fsrs-rs v1.2.2
2024-09-10 23:15:33 +07:00
Damien Elmes
b241ab9492
Dependency updates (#3403)
* Bump Python deps

Primarily for flask-cors CVE

* Bump TS deps; pin license checker

Current checker is missing the binary
https://github.com/RSeidelsohn/license-checker-rseidelsohn/issues/118

* Update Rust deps

Hyper and axum are held back as we currently make use of the older
http library that reqwest pulls in
2024-09-04 12:21:50 +07:00
Abdo
58e25f12b2
Fix Svelte exports not working in Deck Options (#3382) 2024-08-29 19:12:18 +07:00
bpnguyen107
3661333185
Move 'ignore reviews before' to advanced (#3381)
* moved ignore setting to advanced

* Update CONTRIBUTORS

* Match width of other text inputs (dae)

The width was inconsistent before as well, but moving it next to
text inputs made it more obvious.
2024-08-29 19:11:56 +07:00
Damien Elmes
a179da3827
Update dprint (#3376)
* Update amd64 docker container to Debian 11

This bumps the minimum required glibc to 2.29, which is 2019
Ubuntu/Fedora, and 2021 Debian.

Also remove the unused download of ninja

* Update to latest dprint

Unblocked by the glibc upgrade
2024-08-22 18:24:56 +07:00
Jarrett Ye
8ed9f49bdc
Feat/FSRS Simulator (#3257)
* test using existed cards

* plot new and review

* convert learning cards & use line chart

* allow draw multiple simulations in the same chart

* support hide simulation

* convert x axis to Date

* convert y from second to minute

* support clear last simulation

* remove unused import

* rename

* add hover/tooltip

* fallback to default parameters

* update default value and maximum of deckSize

* add "processing..."

* fix mistake
2024-08-22 15:34:19 +07:00
Dillon Baldwin
a2b4b57390
Added name to contributors list as well as addressed issue #3343. Ran ninja check and the build compiled successfully. (#3345) 2024-08-07 16:15:50 +07:00
sorata
5216fa959e
Update AutoAdvance.svelte (#3313) 2024-07-21 20:49:42 +07:00
user1823
dccb7c9b27
Update references to tooltip strings (#3312)
* Update string reference

* Update FsrsOptionsOuter.svelte
2024-07-21 17:24:41 +07:00
sorata
087f957a36
Update Tooltip (#3288)
* Update Tooltip

updated the tooltips as described here: https://forums.ankiweb.net/t/update-tooltips/46849

* Update CONTRIBUTORS

* Update deck-config.ftl

* fixed punctuation, stylistic incoherence, etc.

* Update deck-config.ftl

https://github.com/open-spaced-repetition/fsrs4anki/pull/667

* Changed string requires new key (dae)

* Minor tweaks to tense for clarity (dae)

https://github.com/ankitects/anki/pull/3288#issuecomment-2223384500
2024-07-21 16:44:37 +07:00
Damien Elmes
194f35617d Switch mask editor to non-conflicting shortcut
In the absence of better ideas, I've added alt

Closes #3276 and #3278
2024-07-21 13:05:56 +07:00
Pedro Schreiber
799912cfe3
keep-text-in-occlusion (#3277) 2024-07-20 17:48:37 +07:00
Abdo
d108bff862
Fix remaining accessibility warnings (#3241)
* Remove unused build var

* Fix accessibility warnings in CollapseLabel

* Fix accessibility warnings in PlainTextBadge

* Add ARIA role to Autocompleteitem

* Fix accessibility warnings in HandleBackground

* Fix accessibility warnings in HandleControl

* Fix accessibility warnings in EditorField

* Fix accessibility warnings in RichTextBadge

* Fix accessibility warnings in StickyBadge

* Remove ignored a11y warnings
2024-07-10 19:55:08 +07:00
Damien Elmes
2a52639cd3 Update web deps
Vite held back, as current version is breaking the build
2024-07-06 18:40:37 +07:00
Abdo
fa47e905c5
Restore $deckOptions (#3265)
* Restore $deckOptions

* Avoid error in logs when using ./yarn dev or mobile clients (dae)
2024-06-28 19:38:18 +07:00
Abdo
6232d0aec8
Fix deck config input's background color regression (#3258)
* Fix deck config input's background color regression

* Move styles to base stylesheet
2024-06-28 18:52:51 +07:00
Jarrett Ye
6d13221ae5
Remove threshold of compute minimum recommended retention (#3246)
* remove threshold of compute minimum recommended retention

* update tool tip of compute-optimal-retention

* cargo clippy --fix

* Update FsrsOptionsOuter.svelte

* Remove 'from 0 cards' reference (dae)
2024-06-28 18:26:39 +07:00
Damien Elmes
0d8d816a0c Include error message text on page
Also remove the '500' h1 from the error

Closes #3248
2024-06-24 15:35:47 +07:00
Abdo
4221e54390
Fix image occlusion flicker caused by setupI18n() (#3253) 2024-06-24 08:48:49 +01:00
Abdo
9dc3b10fe9
Fix deck config input's background color in Qt5 (#3243) 2024-06-22 10:43:34 +01:00
Damien Elmes
e41c4573d7 Formatting fix 2024-06-20 20:43:43 +07:00
Damien Elmes
a8e3b46edd Fix deck options failing to show on Qt 5.14
https://forums.ankiweb.net/t/mac-intel-options-screen-doesnt-work-on-version-24-06-2-qt5/45819/8
2024-06-20 20:29:36 +07:00
Abdo
548066f92c
Fix missing i18n module in IO review screen (#3223) 2024-06-06 11:20:40 +01:00
Abdo
4ab0db3127
Another try at fixing IO events issue (#3210) 2024-05-28 10:29:21 +01:00
Mani
c2d565ee4f
do not recreate page when toggle button used (#3208) 2024-05-24 10:47:18 +01:00
Abdo
abacdcaeda
Fix future due search missing cards on last day (#3206) 2024-05-24 10:46:38 +01:00
Damien Elmes
c4cd8808f3 Fix import order 2024-05-17 17:11:28 +07:00
Damien Elmes
d64ea23e11 Enable svelte preprocess 2024-05-17 17:01:49 +07:00
Damien Elmes
f639c3660a Revert "Revert "Revert "Preserve HTML formatting inside clozes (#3038)"""
This reverts commit 9c733848b8.
2024-05-17 11:51:09 +07:00
Abdo
998b91c1fe
Fix IO event handlers being run on normal notes (#3195) 2024-05-15 12:48:58 +01:00
Abdo
50772eeece
Fix '366 of 365 days studied' (#3182)
* Fix '366 of 365 days studied'

* Apply nicing when GraphRange.AllTime is selected
2024-05-06 23:50:27 +10:00
RumovZ
8ad65d40ff
Clean up #3167 (#3186)
* Revert changes to ButtonToolbar from #3167

Flex gap is still not fully supported.
Keeps a small margin increase.

* Add margin to deck config header

* Move StickyHeader into import-page
2024-05-01 20:08:19 +10:00
Mani
995d7b1fa5
fix polygon tool draw (#3184) 2024-05-01 20:03:27 +10:00
RumovZ
9418bd9c7d
Improve and unify web dialog styling (#3167)
* Rework ChangeNotetypePage with existing components

* Use disabled Select instead of LabelButton

* Don't use  button for unclickable arrow

* Rework ImportLogPage with existing components

* Improve deck options styling

* Align spacing in ChangeNotetypePage further

* Use StickyContainer on ImportPage

* Format
2024-05-01 17:49:57 +10:00
Abdo
22ac77896f
Show review count for Evaluate/Optimize button (#3170)
* Revert "Show review count with FSRS evaluation results (#3165)"

This reverts commit b7e782c7e1.

* Show review count for Evaluate/Optimize button
2024-05-01 17:02:59 +10:00
Abdo
573af9cd4c
Use key instead of code in type-in field (#3166)
* Use key instead of code in type-in field

* Use event.key for Enter
2024-05-01 16:59:11 +10:00
Pedro Schreiber
074becc0ce
Add keyboard shortcuts for empty cards and toggle mask on image occlusion (#3136)
* Add keyboard shortcuts for empty cards and toggle mask on image occlusion

- add shortcut for empty cards
- add shortcut for toggle mask
- set tooltips with shortcuts

use unused shortcut for empty cards

* remove unnecessary shortcut added in main.py

* change empty cards shortcut and try to fix CI error in CONTRIBUTORS

* change shortcut for empty cards for universal support
2024-04-25 17:19:38 +10:00
Abdo
b7e782c7e1
Show review count with FSRS evaluation results (#3165) 2024-04-25 17:10:41 +10:00
Jarrett Ye
2c9accf595
update optimal retention and parameters tooltip (#3148)
* update optimal retention and parameters tooltip

* Revert "update optimal retention and parameters tooltip"

This reverts commit 32fdc5c1c3.

* update optimal retention and parameters tooltip

* check num of revlogs at first

* use new translation string

* Update deck-config.ftl

Co-authored-by: user1823 <92206575+user1823@users.noreply.github.com>

* Update deck-config.ftl

Co-authored-by: user1823 <92206575+user1823@users.noreply.github.com>

* Update deck-config.ftl

Co-authored-by: user1823 <92206575+user1823@users.noreply.github.com>

* Update ftl/core/deck-config.ftl

Co-authored-by: user1823 <92206575+user1823@users.noreply.github.com>

* fix position of translation string

* Update deck-config.ftl

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

* Update deck-config.ftl

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

* Update deck-config.ftl

---------

Co-authored-by: user1823 <92206575+user1823@users.noreply.github.com>
Co-authored-by: Damien Elmes <dae@users.noreply.github.com>
2024-04-24 02:38:52 +01:00
RumovZ
790c52f012
Svg icon (#3135)
* Add sveltekit-svg plugin to fix svg icon styling

Closes #3127.

* Unify svg icon usage

Moves all icons into ts/lib/components/icons.ts and uses a single component to render
them both with eslint and svelte-kit.

* Fix spinning revert icon not being centered

* Use svg earth icon for global label

* Add tooltip to global label icon

* Remove eslint-plugin-simple-import-sort

Imports are already sorted by dprint with conflicting rules.
2024-04-24 02:37:31 +01:00
Mani
f0f9535200
fix io draw in mobile client (#3160) 2024-04-23 22:39:26 +10:00
Damien Elmes
a188a59646 Fix adding/saving I/Os on mobile 2024-04-22 20:58:26 +10:00
Abdo
c62e2d8df0
Fix spacebar causing stutter when editing cards (#3150)
* Fix spacebar causing stutter when editing cards

* Remove IO toolbar event handlers on unmount

* Remove nested keydown handlers
2024-04-19 19:13:56 +10:00
RumovZ
ebc6c0847a
HMR on Windows (#3144)
* Enable hot module reloading on Windows

* Update VSC launch.json and tasks.json

* Bind vite server to 127.0.0.1 (dae)

Our frontend connects via IP, and on Windows, this fails if the server
is bound to 'localhost' instead.
2024-04-17 21:23:34 +10:00
Abdo
351aa96dfc
Fix IO text size in review screen (#2986)
* Store relative font size

* Handle multi-line text

Thanks to @glutanimate
2024-04-17 20:45:40 +10:00
Damien Elmes
e66adcca38 alertOnError should default to true
Regressed in svelte-kit port
2024-04-17 20:13:37 +10:00
Loudwig
d8f2782c26
Feature Show Reminder before answer (#3064) (#3119)
* Feature Question Action Show Reminder (#3064)

Added a option in the deck config that allow the user to choose in
Autoupdate mode between showing a reminder or revealing the card.
Also added my name to the contributors

* Update ftl/core/deck-config.ftl
2024-04-13 08:39:50 +01:00
Abdo
e486d6b513
Improve typing of custom fabric.Object properties (#3134)
* Ensure increasing ordinals of new masks

* Add fabric.d.ts

* Revert "Ensure increasing ordinals of new masks"

This reverts commit dedfeec9ad.
2024-04-13 08:36:08 +01:00
Mani
477f932f35
fix select all and change ordinal in edit mode in io (#3109)
* fix select all and change ordinal in edit mode in io

* make ordinal undefined for all shapes in group/ungroup

* fix group shapes and some ui fixes

* Don't add node_modules/* to dprint deps

* use minimum ordinal when shape merged, use max ordinal++ when ungrouped, in add mode no ordinal preset so NaN

* use state for ungroup shape

* maintain existing ordinal in editing mode

* fix order of ordinal in ungroup shape

* refactor: remove for loop, use forEach
2024-04-11 08:08:07 +01:00
Abdo
29bdc47482
Fix IO text masks being grouped (#3128) 2024-04-10 08:36:00 +01:00
Abdo
642f29cf5e
Fix IO mask position slightly off in edit mode (#3121) 2024-04-08 16:40:22 +01:00
Damien Elmes
3033b54890 Another attempt at fixing rounding issue with optimal retention
Also use the previously-added translation.
2024-04-05 18:22:45 +07:00
Mani
038a0189d0
highlight io shapes in answer side (#3098) 2024-03-31 10:14:11 +01:00
Abdo
31e2dc1409
Fix some cloze handling regressions (#3086)
* Place cursor inside empty clozes

* Remove empty <li> after being added
2024-03-31 10:01:17 +01:00
Damien Elmes
9c733848b8 Revert "Revert "Preserve HTML formatting inside clozes (#3038)""
This reverts commit e911b4b69a.

Trying again now that 24.04 is out.
2024-03-31 15:55:30 +07:00
Damien Elmes
9f55cf26fc
Switch to SvelteKit (#3077)
* Update to latest Node LTS

* Add sveltekit

* Split tslib into separate @generated and @tslib components

SvelteKit's path aliases don't support multiple locations, so our old
approach of using @tslib to refer to both ts/lib and out/ts/lib will no
longer work. Instead, all generated sources and their includes are
placed in a separate out/ts/generated folder, and imported via @generated
instead. This also allows us to generate .ts files, instead of needing
to output separate .d.ts and .js files.

* Switch package.json to module type

* Avoid usage of baseUrl

Incompatible with SvelteKit

* Move sass into ts; use relative links

SvelteKit's default sass support doesn't allow overriding loadPaths

* jest->vitest, graphs example working with yarn dev

* most pages working in dev mode

* Some fixes after rebasing

* Fix/silence some svelte-check errors

* Get image-occlusion working with Fabric types

* Post-rebase lock changes

* Editor is now checked

* SvelteKit build integrated into ninja

* Use the new SvelteKit entrypoint for pages like congrats/deck options/etc

* Run eslint once for ts/**; fix some tests

* Fix a bunch of issues introduced when rebasing over latest main

* Run eslint fix

* Fix remaining eslint+pylint issues; tests now all pass

* Fix some issues with a clean build

* Latest bufbuild no longer requires @__PURE__ hack

* Add a few missed dependencies

* Add yarn.bat to fix Windows build

* Fix pages failing to show when ANKI_API_PORT not defined

* Fix svelte-check and vitest on Windows

* Set node path in ./yarn

* Move svelte-kit output to ts/.svelte-kit

Sadly, I couldn't figure out a way to store it in out/ if out/ is
a symlink, as it breaks module resolution when SvelteKit is run.

* Allow HMR inside Anki

* Skip SvelteKit build when HMR is defined

* Fix some post-rebase issues

I should have done a normal merge instead.
2024-03-31 09:16:31 +01:00
Jarrett Ye
15506328e9
rename sm2 retention to historical retention (#3101)
* rename sm2 retention to historical retention

* ninja format

* keep sm2_retention in DeckConfSchema11

* update wording

* Update schema11.rs
2024-03-29 09:34:26 +00:00
Damien Elmes
6e1ae5231b Update optimal retention tooltip, and add a few extra translations 2024-03-28 16:02:05 +07:00
Damien Elmes
e911b4b69a Revert "Preserve HTML formatting inside clozes (#3038)"
This reverts commit 58b2475f42.

Rolling this back for now, as it may cause regressions. We can give it
another try at the start of the next beta-testing period.
2024-03-25 16:47:54 +07:00
Damien Elmes
0c02c669c1 Fix spurious warning when comparing optimal and desired retention 2024-03-25 16:44:07 +07:00
Abdo
5938456069
Disable ligatures in type-in highlighting (#3093) 2024-03-25 09:42:07 +00:00
RumovZ
426d5ae8a9
Fix summary string for notes failed to be imported (#3092) 2024-03-25 09:41:42 +00:00
Mani
f413274fba
better pan zoom with space for drag, shift for horizontal scroll and ctrl for zoom (#3080)
* more better pan zoom with space for drag, shift for horizontal scroll and ctrl for zoom

* use middle mouse button for drag

* improve panning with space + mousemove, remove middle mouse implementation

* handle tool change after mouseup event
2024-03-18 14:26:41 +00:00
Abdo
58b2475f42
Preserve HTML formatting inside clozes (#3038)
* Preserve HTML formatting inside clozes

* Place caret after/inside cloze

To match the old behavior

* Fix clozing in mathjax

* Formatting

* Avoid .extractContents() and handle partially covered tags

* Exclude range end if endOffset == 0

* Remove unnecessary branches

* Use nodeIsElement

* Let extractContents() handle partially selected nodes
2024-03-18 13:44:19 +00:00
Damien Elmes
c462f64862 Move (most) FSRS options into their own section 2024-03-17 18:25:25 +07:00
Damien Elmes
e9d3b46d47 Shift FSRS optimization into top level; shown optimize all tip after 30 days 2024-03-17 17:46:26 +07:00
Mani
5eafd82521
fix: ensure proper drawing of shape tools after pan/zoom (#3066)
* fix: ensure proper drawing of shape tools after pan/zoom

* remove sticky bottom toolbar

* make bounding-box not selectable after undo/redo

* fix: resize issue, added option to pan using alt/shift + mouse wheel

* drag with touchpad

* use isDesktop and move globalThis to index.ts

* gesture event not required, use preventDefault with passive false in wheel event

* use shift in mac and ctrl in pc
2024-03-16 14:05:51 +07:00
Jarrett Ye
8c9d7d64d9
refactor optimal retention to minimize workload per memorization & fix progress goes backwards (#3065)
* Feat/optimal retention for minimal workload per memorization

* ./ninja fix:minilints

* update to FSRS-rs 0.5.2

* update to FSRS-rs 0.5.3

* ./ninja fix:minilints

* 'estimated retention' -> 'predicted optimal retention'; add warning (dae)
2024-03-11 16:16:37 +07:00
Damien Elmes
de8b81ca7a Fix consolas not being used in editor 2024-03-10 12:52:53 +07:00
Mani
ea8f0c1491
fix: blur in io, remove panzoom and use fabricjs for panzoom (#3052)
* fix: blur in io, remove panzoom and use fabricjs for panzoom
- remove panzoom
- implement panzoom using fabricjs
- set background image for canvas
- add bounding rect for canvas
- draw or add point inside in bounding rect
- update zoom tool

* support pinch to zoom on mobile client

* fix lagging of canvas, zoom in draw mode

* panning in touch events
2024-03-09 10:35:23 +00:00
Jarrett Ye
f2acf40221
alert when the resp.weights is empty (#3061)
* alert when the resp.weights is empty

* format
2024-03-09 10:26:59 +00:00
Abdo
9228c87b3a
Show preset and original deck in card info (#3055)
* Show preset and original deck in card info

* Make original_deck optional
2024-03-07 07:47:55 +00:00
Damien Elmes
184ad8068e Clone "added" string for importing
https://forums.ankiweb.net/t/inquiry-about-adding-one-more-string-for-added/41998
2024-03-07 12:03:12 +07:00
Abdo
3d184073d7
Adjust HTML editor / add-on config editor font (#3054)
* Reduce font size of add-on config editor

* Change HTML editor font to Consolas

* Remove unused form
2024-03-05 07:29:05 +00:00
Abdo
631088cdca
Fix alert not appearing when FSRS parameters input is focused (#3053) 2024-03-05 06:43:57 +00:00
Damien Elmes
4fc535ec88
Dependency updates (#3040)
* Update JS deps

* Update semver-compat Rust deps

* Update some semver-incompat Rust deps

- hyper/axum held back because reqwests is not ready
- rusqlite held back due to burn-rs incompat version
- wiremock held back due to compile issue

* pylint wants changes to our _rsbridge.pyi

* Update Python deps

Also solves a security warning in orjson

Reformat with latest black
2024-02-28 16:28:04 +07:00
Abdo
60f8399aed
Show total review count when optimizing FSRS parameters (#3027)
* Show total review count when optimizing FSRS parameters

* Do not expose items
2024-02-26 13:27:22 +07:00
Kieran Black
d2ae0d9ada
fix text input custom style wiping out base user style (#3031) 2024-02-26 13:07:45 +07:00
Abdo
6843d65ed1
Check required review count for FSRS after filtering (#3019)
* Check for required review count for FSRS after filtering

* Remove unreachable check

* Update minimum review count in optimal retention calculation

* Fix review check in optimal retention routine too
2024-02-24 14:53:38 +07:00
Abdo
0018f126ea
Fix misaligned image occlusions in RTL languages (#3018) 2024-02-22 11:10:36 +07:00
Abdo
00c67fc0c7
Show message if current FSRS parameters are optimal (#3014)
* Show message if current FSRS parameters are optimal

* Fix message shown with default parameters

* Use alert()
2024-02-22 11:09:17 +07:00
Luc Mcgrady
8b18a08b3b
FSRS - Ignore revlogs before date while optimizing (#2922)
* Added: Date input button

* Added: ignoreDate to config

* Added: Backend

* Optimize function passes value

* Fix: Spelling

* Moved: filter logic from revlog_for_srs to update_memory_state

* fmt

* Copyright header

* ./check

* Fix: Test

* Renamed: Ignore_date -> Ignore_before_date

* Neaten parameters

* evaluate weights

* ./check

* Optimize all presets

* Added: Label localizations

* Removed globe label

* Added: Tooltip

* Changed error type

* fmt

* Moved filter to own function

* missing function call replacement

* Fix: Typo

* Apply suggestions from code review

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

* timestamp * 1000 -> timestamp_millis

* ignoreBefore -> ignore_before

* clarified ignore_before variables

* i64 -> TimestampMillis

* Un-traitified remove_revlogs_before

* Added: ms == 0 guard

* Added: Ignore_before affects scheduling

* Moved filter to fsrs_items_for_training

* removed filter from revlog_for_srs

* Tuple -> UpdateMemoryStateEntry

* Removed unused function

* Removed superfluous _ms from variables

* cid -> id

* Different ignore method

* Added: Unit test

* cid -> id

* Test: Exact ms edge case

* ./check

* Fix: re-learns could be before ignore date in cards without learning steps

* getignoreRevlogsBeforeMs -> getIgnoreRevlogsBeforeMs

* Removed pub(crate)

* Clarified unit test

* last_learn_entry -> first_of_last_learn_entries

* @user1823's method

* IOS fix

* ./check

* Fix: width defined twice
2024-02-22 11:01:10 +07:00
Lucas Scharenbroch
97dcb776de
Refactor text attribute button components (#3012)
* Factor out common code in bold/italic/underline/sub/sup buttons

* Update exclusiveNames' states on click

* Update exclusiveNames' states on keyboard shortcut
2024-02-18 13:09:05 +07:00
Lucas Scharenbroch
b80057440e
Fix visual behavior of modal buttons in editor (#3009)
* Fix behavior of justification buttons

* Make list buttons update each other when clicked
2024-02-14 20:35:37 +10:00
Abdo
4ef389b580
Keep previous FSRS parameters if they get worse when optimizing (#2996)
* Update to fsrs-rs 0.3.0

* Keep previous FSRS parameters if they get worse when optimizing
2024-02-11 16:26:04 +10:00
Abdo
80c14aa6e9
Maintain original IO cloze order in editing mode (#2987)
* Maintain original IO cloze order in editing mode

* Fix ordinal propery name
2024-02-07 13:42:47 +10:00
Lucas Scharenbroch
146a3d936e
Fix corner rounding of alignment buttons in editor (#2989)
* Fix corner rounding of alignment buttons in editor

* Fix formatting

* Fix cascading button-rounding issues
2024-02-07 13:11:14 +10:00
Jarrett Ye
2fffe4b7ba
update FSRS to v0.2.0 (#2977)
* update FSRS to v0.2.0

* update comments

* ./ninja fix:minilints

* 1000 -> 400 in translation (dae)
2024-01-30 16:27:12 +10:00
Mani
ec3698502b
add select all tool (#2981)
Co-authored-by: Damien Elmes <dae@users.noreply.github.com>
2024-01-30 15:43:15 +10:00
Pedro Lameiras
5849fc6f64
Make image occlusion's option buttons tabbable (#2966)
* Make image occlusion's option buttons tabbable

* Added myself to contributors

* Removed two-way binding
2024-01-29 12:49:28 +10:00
Abdo
0291847712
Fix Image field not hidden until user selects an image (#2960) 2024-01-23 14:24:12 +10:00
Abdo
eab5c02251
Add by creation date review sort order (#2957)
* Add by creation date review sort order

* Order by template after nid in ReverseAdded of filtered decks too
2024-01-21 20:29:19 +10:00
user1823
ee68da51b0
More precise percent of days studied (#2889)
* More precise percent of days studied

* Use localizedNumber & Format

* Update reviews.ts

* Update reviews.ts

* Update reviews.ts
2024-01-21 20:25:50 +10:00
Abdo
fe5ba1cce7
Fix MathJax editor not opening when navigating into blocks (#2953) 2024-01-19 16:06:27 +10:00
Abdo
8afd6480cb
Fix title of Auto Advance section (#2949) 2024-01-19 15:48:30 +10:00
Damien Elmes
db1aecd3d8 Ignore congrats fetch errors
The congrats page fetches data once a minute, and onRefreshTimer()
reloads the page once every 10 minutes. If a data fetch is in flight
when the page reload happens, it can cause a 'failed to fetch' error
to occur.

Closes #2895
2024-01-19 15:28:54 +10:00
Aristotelis
db9aaba929
Make tags and tag suggestions able to be styled by add-ons (#2941)
* Expose tag name to add-ons via data attribute

* Expose autocomplete items to add-ons as data attributes

* Use common data-addon* prefix for attributes
2024-01-18 10:09:06 +10:00
Abdo
cc81db0f9d
Fix undo handling of group and some other IO tools (#2931)
* Fix undo handling of group and some other IO tools

* Emit change signal inside onObjectModified

* Fix group lost after moving group then undoing

* Skip undo entry if canvas has not changed

The onObjectModified() call I added in a previous commit to deleteDuplicateTools results in a duplicate undo entry for the delete tool. Checking for duplicate entries seems simpler than having to think about where onObjectModified() should be called exactly

* Fix extra undo entry added after ungroup
2024-01-09 11:19:46 +10:00
Abdo
5d1fc9a591
Flip indent/outdent buttons for RTL (#2930) 2024-01-09 11:09:53 +10:00
Damien Elmes
bfea56c470 Clear out old FSRS progress as new operation starts
https://forums.ankiweb.net/t/inconsistent-number-of-reviews-when-clicking-optimize/39275/6
2024-01-08 13:23:25 +10:00
Mani
ddabbddeb1
add padding to control corner to shapes (#2919) 2024-01-01 14:08:24 +10:00
Mani
6608baa9da
fix: enable keyboard in mobile io note editor (#2916) 2023-12-28 18:00:07 +10:00
Jarrett Ye
0266de60b3
use new formula to calc ivl in getRetentionWarning (#2911)
* use new formula to calc ivl in getRetentionWarning

* format

* Use consistent casing (dae)
2023-12-27 12:26:58 +10:00
Damien Elmes
2b763ee0b2 Exclude suspended cards from FSRS optimizing
https://forums.ankiweb.net/t/anki-23-12-beta/37771/155
2023-12-25 09:40:24 +10:00
Abdo
f2e9c73b31
Do not close web pages when Esc is pressed and a modal is open (#2894)
* Prefer key over keyCode

* Do not close TS pages on Esc when floating elements are open

* Close pop-up when Escape is pressed regardless of keepOnKeyup

* Close help modals when Escape is pressed

* Avoid duplicate handling of Esc in WithFloating

* Formatting

* Handle closing of preset management modals

* Reset text input modal to initial value
2023-12-21 13:59:52 +10:00
Damien Elmes
9b00425209 Hack around overflow in some languages
The problem at the moment is that the two left buttons are not part
of the scrollable area on the right, and the scrollable area has been
manually positioned. We would need to move the buttons into the toolbar
area, and then hide them when using the desktop editor. For now, I've
just added wrapping/smaller text instead.

https://forums.ankiweb.net/t/image-occlusion-editor-buttons-overlap-in-some-languages/38499
2023-12-18 13:34:05 +10:00
user1823
c4656ccc44
Correct the description of FSRS Difficulty in Stats (#2888)
* Correct the description of FSRS difficulty

* Update DifficultyGraph.svelte

* Update statistics.ftl
2023-12-14 12:48:58 +10:00
Gustaf-C
1b0ccfd243
Change link to manual in help screen from icon to text (#2886)
* Change help screen link to manual from icon to text

* Fix auto advance manual link (dae)
2023-12-13 09:03:05 +10:00
Damien Elmes
129157eb21 Better approximate average retention/ease/difficulty
Our average calculation is based on pre-binned values, so it's not
entirely accurate, but using the midpoint of the bin brings us closer.
In the future we can solve this by calculating it on the Rust end instead.
2023-12-12 15:09:13 +10:00
Damien Elmes
00da2ac27b Fix unwanted border on macOS
https://forums.ankiweb.net/t/anki-23-12-beta/37771/106
2023-12-12 14:43:48 +10:00
Damien Elmes
980594252d Move globe icon into separate Svelte file
Confirmed correct layout in RTL mode.

I experimented with adding a tooltip as well, as suggested in
https://forums.ankiweb.net/t/anki-23-12-beta/37771/82, but it's
confusing as we already change the mouse cursor/underline when the user
hovers over a label. Given the help text universally starts with
"affects the entire collection", I think that's good enough.
2023-12-12 12:33:31 +10:00
Damien Elmes
70ee28b559 Fix underscores in MathJax breaking rendering
Report:
https://forums.ankiweb.net/t/anki-23-12-beta/37771/51

\ln ^{\alpha} x \text{______} x^{\beta}\text{______}a^{x}

Cause:
https://github.com/mathjax/MathJax/issues/2566#issuecomment-727579057
2023-12-11 15:00:56 +10:00
Damien Elmes
50796e53b4 Give a hint about optimizing all presets 2023-12-11 14:27:17 +10:00
Damien Elmes
1ec769f1ae Fix some issues with toggle mask shortcut
- We were registered another event handler for each card, which was a
resource leak, and would lead to the shortcut failing on every second card
due to the even number of toggles.
- We were allowing toggleMasks() to run even when the button wasn't visible
(e.g., when showing the question side of a card)
2023-12-11 14:02:19 +10:00
Damien Elmes
9933e2ab54 Split "auto advance" into a separate section 2023-12-11 13:47:34 +10:00
Damien Elmes
8157d88038 Invert seconds to show question/answer; tweak wording
The previous wording could be interpreted as 'time until showing question'
or 'time that question should be shown'. I'd intended the latter, and
I didn't notice that the original implementation was doing the former.
2023-12-11 13:40:44 +10:00
Damien Elmes
699a63b85a Allow decimal timer delays 2023-12-11 13:17:04 +10:00
Damien Elmes
4f10a2818f Fix incorrect search being used when evaluating parameters
https://forums.ankiweb.net/t/anki-23-12-beta/37771/89
2023-12-11 13:09:48 +10:00
Damien Elmes
b36f367030 Fix revert icon position in RTL 2023-12-11 09:20:10 +10:00
RumovZ
c11e40b11b
Fix Select component not reacting to changed list (#2885)
* Fix Select component not reacting to changed list

Fixes #2882.

* Add msys to path on Windows in VSC settings
2023-12-11 09:12:34 +10:00
Abdo
6f3550464d
Fix IO note count (#2884) 2023-12-10 12:55:47 +10:00
Damien Elmes
93738d1656 Don't allow HTML in Select fields
If there's somewhere where we do need it, we should make it opt-in,
as stripping is the safe default.

Closes #2883
2023-12-10 12:47:21 +10:00
Abdo
548aca5b4f
Persist mask group scaling (#2878)
* Persist mask group scaling

Handles the first issue in #2876

* Fix selection resizing
2023-12-10 10:02:47 +10:00
Damien Elmes
97f43fbd45 Further speed up deck options load
Profiling revealed that binding to clientWidth for each component in
the deck options was taking up a sizable amount of time, due to the
inefficient way it's implemented: https://github.com/sveltejs/svelte/issues/7583

In one case, we can instead defer checking clientWidth until we go to
display the popover. In the other case, we can achieve the revert button
positioning a different way.

The last change dropped the speed index in Chrome from 1.4s to 1s; this
change brings it down to 0.7s.

Also fixed the hovered select element from jiggling due to a different
border width when hovering.
2023-12-08 15:10:35 +10:00
Damien Elmes
f10a29a93d Make help button more obvious, and remove hover animations
There's been a fair bit of talk on the forums about users not discovering
the help info, so this will hopefully make finding it easier.

Ideally we'd use a single var(--fg), but it feels a bit too strong in
light mode.

The animations we were showing on hover/focus made the UI feel
laggy. This has come up before, and we already disable them for buttons.
I experimented with removing the transitions (but keeping the change on
hover) - it feels much more responsive, but I also didn't feel that it
was contributing anything useful - the user knows where they've placed
the mouse or cursor, and the extra movement feels like a bit of a
distraction. Happy to discuss if people feel differently, though.
2023-12-08 13:39:56 +10:00
Damien Elmes
29e98721b5 Fix slow deck options performance
column-count was causing progressively-worse performance. By switching
to manual left/right column assignment, we get faster performance and
retain the top-to-bottom/left-to-right flow.

This also removes the outer DynamicallySlottable, which as far as I'm
aware, is not used by any add-ons.

Closes #2877
2023-12-08 12:09:26 +10:00
Damien Elmes
7664248550 Add a globe icon to global icons
Currently 80% of voters favor the globe, so I'm going to tentatively
call it.

https://forums.ankiweb.net/t/activating-fsrs-on-one-preset-activates-it-on-all-presets/36947/16
2023-12-08 11:18:13 +10:00
Akash Reddy
a5bdb28849
Fix Mathjax can only be pasted once (#2869)
* Fix mathjax can be pasted only once

* Update about.py

* Update CONTRIBUTORS

* fix formatting
2023-12-05 10:01:25 +10:00
Hikaru Y
820b833a43
Fix image overlay not closing when clicking outside on Qt6.6 (#2861)
* Add type to createEventDispatcher

* Fix image overlay not closing when clicking outside on Qt6.6

Use Event.composedPath() instead of obsolete Event.path
https://chromestatus.com/feature/5726124632965120
2023-12-04 14:57:03 +10:00
Abdo
e2e9e37a31
Fix some RTL issues in help modals (#2857)
* Fix RTL position of close button in help modals

* Fix position of active button's border

* Fix margin of modal's title

* Fix alignment of modal buttons' text

* Add missing translation
2023-12-01 15:07:44 +10:00
Abdo
dc3bd3efde
Replace css_browser_selector with our own implementation (#2854)
* Replace css_browser_selector

* Add classes to root element instead of body

* Export addBrowserClasses() in reviewer_extras for mobile clients (dae)

* Avoid setting .mac on iOS devices (dae)
2023-11-30 10:57:33 +10:00
Damien Elmes
7252dd56b6 Fix inability to save deck options when FSRS not enabled 2023-11-27 13:34:42 +10:00
Damien Elmes
123474c455 Update TS deps
Due to a change in svelte-check 3.5.2 (likely https://github.com/sveltejs/language-tools/pull/2146),
we can no longer have composite enabled, as svelte-check spits out errors
about files in other project references not being listed in included files.
This should hopefully not make a difference to us, as we weren't taking
advantage of TypeScript's project compilation, as svelte-check doesn't support
it, and we use esbuild for JS conversion.
2023-11-27 13:34:42 +10:00
Damien Elmes
0b8443032e Fix JS proto definitions not getting tree-shaken 2023-11-27 13:34:42 +10:00
Damien Elmes
8b6abd3f8f Switch FSRS reschedule to a global option; don't persist
A global is easier to use in conjunction with the 'optimize all' action.
The value is no longer persisted, as doing so makes it too easy for users
to generate a lot of revlog entries when playing with different FSRS
weights/retention settings, such as in https://forums.ankiweb.net/t/possible-syncing-limitation-by-fsrs-manual-scheduling-data-accumulation/37610
2023-11-27 11:24:31 +10:00
Damien Elmes
452e012c71 Add option to calculate all weights at once 2023-11-27 11:24:31 +10:00
Damien Elmes
c67f510b9a Update to latest FSRS 2023-11-27 11:24:31 +10:00
Mani
046ae539fb
fix: shortcut update and shape corner transparent (#2847)
* fix: shortcut update and shape corner transparent

* no outline when using shortcut
2023-11-25 16:05:45 +10:00
Mani
be1f889211
fixes: remove unfinished shapes, remove selectable and make shapes remain inside canvas (#2809)
* remove unfinished polygon and remove selectable for shapes in polygon mode

* make group and polygon position remain inside canvas area

* click through transparent area in grouped object

* add some shortcuts for basic usages

* tools button icon in center & switch mode border

* fix load svg image

* basic rtl support, panzoom have issues in rtl mode

* better zoom option both in ltr and rtl

* handle zoom event in mask editor

* add h button to handle toggle mask

* add more mime type

* use capital M (shift+m) for toggle mask

* allow io shortcuts in mask editor only

* make other shapes also remain in canvas bound area

* better zoom implementation, zoom from center
add zoom to resize event listener

* add a border to corner to handle blend of control

* add refresh button to go to  selection menu

* add tooltip to shortcuts and also add shortcut for other tools

* make opacity remain in same state when toggled on

* opacity for group/ungroup objects

* update shortcuts implementation
2023-11-24 14:06:40 +10:00
Ben Olson
9a301665a4
Improve keyboard handling and accessibility for Select.svelte and refactor (#2811)
* resolve TagAddButton a11y
better comments to document tagindex reasoning

* resolved a11y for TagsSelectedButton
allow focus to TagsSelectedButton with Shift+Tab and Enter or Space to show popover

* safely ignore a11y warning as container for interactables is not itself interactable

* Update CONTRIBUTORS

* quick fix syntax

* quick fix syntax

* quick fix syntax

* quick fix syntax

* resolved a11y in accordance with ARIA APG Disclure pattern

* resolved a11y
ideally should replace with  with
a11y-click-events-have-key-events is explicitly ignored as the alternative (adding ) seems more clunky

* resolved SpinBox a11y
cannot focus on these buttons, so no key event handling needed (keyboard editting already possible by just typing in the field)
widget already properly follows ARIA APG Spinbutton pattern

* cleanup

* onEnterOrSpace() function implemented as discussed in #2787 and #2564

* I think this is the main keyboard handling of Select
Still need to fix focus and handle roles and attributes

* fixed the keyboard interaction

focus is janky because you need to wait until after the listed options load and for some reason that needs a tiny delay on onMount
I think this technically violates a11y, but it really doesn't since the delay is literally zero. But the code still needs it to happen.

* Select and SelectOption reference the same focus function

* SelectOption moved inside Select
+ started roles and a11y

* quick syntax and such changes

* finish handling roles and attributes

* fixed keyboard handling and only visual focus

* cleanup and slight refactoring

* fixed syntax

* what even is this?

* bug fixes + revert key selection

* fixed scrolling

* better control scrolling and focus

* Adjusted selection
Up/Down Arrows: start selection on active option
Enter/Space/Click: no initial selection, down arrow to first option, up arrow to last option

* Only set selected the first time Select is opened, all subsequent times use the previous selected
2023-11-21 14:23:18 +10:00
Hikaru Y
8de5cf9690
Fix misalignment of IO masks in Qt5 when image is vertically long (#2829)
* Revert "Fix I/O not showing in Qt5"

This reverts commit c478689e5a.

* Fix misalignment of IO masks in Qt5 when image is vertically long

Also, as in Qt6, constrain the IO image to fit in the viewport.
2023-11-16 10:30:54 +10:00
Abdo
390935d4ea
Persist FSRS weights search in preset (#2827) 2023-11-14 11:47:08 +10:00
Ben Olson
7bcb57b89e
Resolve a11y for tag options buttons (#2787)
* resolve TagAddButton a11y
better comments to document tagindex reasoning

* resolved a11y for TagsSelectedButton
allow focus to TagsSelectedButton with Shift+Tab and Enter or Space to show popover

* safely ignore a11y warning as container for interactables is not itself interactable

* Update CONTRIBUTORS

* quick fix syntax

* quick fix syntax

* quick fix syntax

* quick fix syntax

* resolved a11y in accordance with ARIA APG Disclure pattern

* resolved a11y
ideally should replace with  with
a11y-click-events-have-key-events is explicitly ignored as the alternative (adding ) seems more clunky

* resolved SpinBox a11y
cannot focus on these buttons, so no key event handling needed (keyboard editting already possible by just typing in the field)
widget already properly follows ARIA APG Spinbutton pattern

* cleanup

* onEnterOrSpace() function implemented as discussed in #2787 and #2564

* quick syntax and such changes
2023-11-14 11:40:04 +10:00
Damien Elmes
c478689e5a Fix I/O not showing in Qt5
Images still gets stretched, because Qt5 doesn't support the aspect-ratio
CSS property, but it's better than nothing.

https://forums.ankiweb.net/t/possible-occulusion-issue-on-ver-23-10-and-the-solution/36894
2023-11-13 15:31:50 +10:00
RumovZ
39a60bc3a4
Allow applying limits of inactive parents (#2824)
* Allow applying limits of inactive parents

* Tweak label/help text (dae)
2023-11-13 14:30:19 +10:00
RumovZ
f200d6248e
Allow im-/exporting with or without deck configs (#2804)
* Allow im-/exporting with or without deck configs

Closes #2777.

* Enable webengine remote debugging in launch.json

* Reset deck limits and counts based on scheduling

Also:
- Fix `deck.common` not being reset.
- Apply all logic only depending on the source collection in the
gathering stage.
- Skip checking for scheduling and only act based on whether the call
wants scheduling. Preservation of filtered decks also depends on all
original decks being included.
- Fix check_ids() not covering revlog.

* Fix importing legacy filtered decks w/o scheduling

* Disable 'include deck options' by default, and fix tab order (dae)

* deck options > deck presets (dae)
2023-11-13 13:54:41 +10:00
Damien Elmes
d9e5c85686 Fix some build steps being re-run a second time unnecessarily 2023-11-13 13:35:54 +10:00
Abdo
ae7b14bf40
Add auto-advance options to deck preset (#2765)
* Move stop-timer-on-answer strings to correct section

* Add auto-advance options to deck preset

* Implement answer actions

* Fix error when last card is answered before timeout

* Fix deserialization of answerAction

* Add answerAction to reserved key list

* Fix inverted boolean

* Add option to wait for audio to finish

* Add auto-advance toggle

* Add shortcut

* Disable auto-advance when main window state changes

* Start auto-advance timer after option is toggled

* Disable auto-advance when main window loses focus

* Use existing translations

* Add Answer Hard and Show Reminder
2023-11-13 10:41:51 +10:00
Abdo
c5e2564523
Fix jittery virtual table scrolling on mobile (#2810)
* Fix jittery virtual table scrolling on mobile

* Fix table body appearing above header on iOS (dae)
2023-11-13 10:19:33 +10:00
Damien Elmes
f73eb01047 More tweaks to API security
- Allow custom study methods in reviewer to prevent errors
- Ensure we 'fail closed' if referer header has been removed
- Ensure we ignore opaque POST requests from other origins

Thanks again to Daniel for the feedback.
2023-11-09 20:43:23 +10:00
snowtimeglass
b3da6f117b
Change tooltip strings for image occlusion center alignments (#2815)
- Fix the swapping of the strings

- Change the strings to make the meanings clearer

- Incidentally, add a name to CONTRIBUTORS
2023-11-09 12:02:51 +10:00
Abdo
d491622414
Hide "toggle masks" in "Hide One, Guess One" mode (#2817) 2023-11-09 09:59:01 +10:00
Damien Elmes
453c396216 Relax desired retention warning from 0.85 to 0.8 2023-11-08 11:28:08 +10:00
Damien Elmes
82aaa913a6 Change color of info box depending on retention; increase limit to 0.99
Closes #2803
2023-11-07 13:05:43 +10:00
Damien Elmes
e2ee6b7d44 Add an info box so the non-linear nature of desired retention can be seen 2023-11-06 12:04:31 +10:00
user1823
58904dcad8
(FSRS) Improve presentation of log loss and RMSE (#2805)
* (FSRS) Improve presentation of log loss and RMSE

The number of decimal places in log loss have been increased from 3 to 4. Can help in better comparison of weights especially when the log loss with both are same up to 3 places of decimal. Also makes it consistent with the Python optimizer.

RMSE has been expressed in percent, making it easier to interpret.

* Fix formatting

---------

Co-authored-by: Damien Elmes <gpg@ankiweb.net>
2023-11-05 13:56:20 +10:00
Damien Elmes
fb05e430c0 Handle stability < 0.5 in stability graph 2023-11-05 13:44:39 +10:00
RumovZ
02a5c2d526
Fix overflowing filenames displacing import button (#2806)
Fixes  #2793.
2023-11-05 12:43:43 +10:00
Damien Elmes
e0d2866f79 Prompt user to save preset changes before they compute weights
Closes #2797
2023-11-04 11:46:29 +10:00
Damien Elmes
d744a7cceb Add tooltip to mask editor button 2023-11-03 21:55:38 +10:00
Hikaru Y
01d5a9a3d2
Fix HTML editor not displaying properly when expanding field (#2792) 2023-11-01 07:48:13 +10:00
Damien Elmes
4a3785c03c Conflict handling -> Updates 2023-10-28 13:16:13 +10:00
Damien Elmes
55134435f2 Mention 'custom scheduling' and link to FSRS in manual 2023-10-28 12:47:55 +10:00
Damien Elmes
0cd0ad9b07 Start editing text immediately after adding text node
Closes #2781
2023-10-28 10:25:56 +10:00
Damien Elmes
6a0b96d7ea Fix I/O failing to load if image takes too longer 2023-10-28 07:59:06 +10:00
Damien Elmes
9600f033f7 Add reviewer_extras.css
Will help with https://github.com/ankidroid/Anki-Android-Backend/issues/313
2023-10-27 03:07:31 +10:00
Damien Elmes
9362ef9620 Tweaks to import screen
- Tweak wording
- Move conflict handling options to a disclosure
2023-10-26 11:23:24 +10:00
Damien Elmes
9a027a8c48 Warn users about rescheduling 2023-10-26 11:23:24 +10:00
Damien Elmes
2781d47d21 Relax sm2 retention limits 2023-10-26 11:23:24 +10:00
Damien Elmes
22736238c1 Disable rotation globally
As described on https://github.com/fabricjs/fabric.js/issues/6420#issuecomment-650747872

Fixes rotation marker appearing when selecting, and when ungrouping
2023-10-25 09:23:47 +10:00
Hikaru Y
252addf611
Fix shape selection malfunction after creating shapes in succession (#2773)
* Fix shape selection malfunction after creating shapes in succession

* Disable rotation when duplicating a shape
2023-10-25 09:02:44 +10:00
Abdo
0736cdb29c
Fix scaling of text objects (#2767)
* Fix scaling of text objects

* Do not transform scale factors
2023-10-25 08:47:54 +10:00
Damien Elmes
aab81f9f9a Add tooltips for image occlusions
Closes #2768
2023-10-23 12:03:22 +10:00
Aristotelis
8e828f2955
Allow disabling occlusion mask border (#2764)
* Allow setting occlusion mask border to zero

* Switch to multi-line if statements

cf. 9740393d72

* Enforce if statement braces in dprint

---------

Co-authored-by: Glutanimate <glutanimate@users.noreply.github.com>
2023-10-23 11:43:37 +10:00
Abdo
14940a617b
Fix IO groups breaking upon editing (#2766)
* Fix IO groups breaking upon editing

* Emit change signal after group/ungroup
2023-10-23 09:43:31 +10:00
Damien Elmes
9740393d72 Enforce curly bracket usage for one-statement ifs 2023-10-23 09:19:49 +10:00
Hikaru Y
a53806e24a
Indicate current occlusion type in pop-up menu (#2760)
* Simplify handling of occlusion types in editor code

- Unify updateIONoteInEditMode(), setOcclusionFieldInner() and
setOcclusionField() into updateOcclusionsField()
- Don't use `includeInactive` property of Shape class in editor code
- Drop `isEditMode`

+
Update the occlusions field every time a mask or text is updated, not
only in editing mode but also in adding mode, so that IO cards can be
previewed correctly in the card layout screen

* Indicate current occlusion type in pop-up menu

https://forums.ankiweb.net/t/anki-23-10-beta-5-6/35677/46

* Fix a11y warnings in Toolbar.svelte

* Drop `occludeInactive` parameter from `MaskEditorAPI.getShapes()`
2023-10-23 09:12:56 +10:00
Hikaru Y
f8edbcc686
Fix modified polygon not being saved when editing IO note (#2762) 2023-10-22 10:51:45 +10:00
Aristotelis
56f7d54900
Add APIs for IO mask editing (#2758)
* Add simple mask editor add-on API

* Signal completed mask editor image loading to Python

* Add API methods for querying mask editor state, fix formatting

* Use event forwarding to propagate image loaded event

Should fix mobile support by moving all bridgeCommand calls to `NoteEditor.svelte`

* Add shape classes to mask editor API

---------

Co-authored-by: Glutanimate <glutanimate@users.noreply.github.com>
2023-10-22 10:40:40 +10:00
Damien Elmes
3bfd828503 Fix browser query not matching stats
- Round instead of floor when binning
- Account for rounding in search

https://forums.ankiweb.net/t/anki-23-10-release-candidate/35967/4
2023-10-21 12:00:43 +10:00
Damien Elmes
80d807e08a Fix stability search query 2023-10-20 14:07:03 +10:00
Damien Elmes
5098ecce24 Tweak some of the graph descriptions 2023-10-20 12:58:07 +10:00
Damien Elmes
7bc4c3b78f Don't hide FSRS help when option is disabled 2023-10-20 10:30:09 +10:00
Abdo
8e1105144a
Commit addition of IO shapes immediately (#2750) 2023-10-20 09:38:03 +10:00
Aristotelis
c828a2eb6f
Add APIs for IO card rendering (#2739)
* Refactor: Add index to shapes package

* Add shape draw callback API to setupImageCloze

* Expose IO drawing API, switch away from image cloze naming

We currently use "image occlusion" in most places, but some references to "image cloze" still remain. For consistency's sake and to make it easier to quickly find IO-related code, this commit replaces all remaining references to "image cloze", only maintaining those required for backwards compatibility with existing note types.

* Add cloze ordinal to shapes

* Do not mutate original shapes during (de)normalization

Mutating shapes would be a recipe for trouble when combined with IO API use by external consumers.

(makeNormal(makeAbsolute(makeNormal())) is not idempotent,
and keeping track of the original state would introduce
additional complexity with no discernible performance benefit
or otherwise.)

* Tweak IO API, allowing modifications to ShapeProperties

* Tweak drawShape parameters

* Switch method order

For consistency with previous implementation

* Run Rust formatters

* Simplify position (de)normalization

---------

Co-authored-by: Glutanimate <glutanimate@users.noreply.github.com>
2023-10-20 09:36:46 +10:00
Abdo
bba67fdab4
Fix misleading warning when changing notetype from/to cloze (#2744) 2023-10-18 16:50:32 +10:00
user1823
4c17a6964e
Rename Analyze to Evaluate in FSRS Deck Options (#2741)
* Update deck-config.ftl

* Update FsrsOptions.svelte

* Update CONTRIBUTORS
2023-10-17 09:53:24 +10:00
Hikaru Y
bea4307d78
Another approach to preventing selected shapes from shifting (#2735)
* Revert "Fix selected shapes shifting to canvas origin"

This reverts commit d81b96fed0.

This introduced a regression where the selection of objects was cleared
when it should not have been. For example, if multiple objects were
selected and the mouse was released while moving them around, the
selection would be cleared.

* Another approach to preventing selected shapes from shifting

Prevent fabric objects from shifting to the wrong position when the
active selection contains multiple objects by calculating their
coordinates relative to the canvas, as in the case of the fabric.Group.
2023-10-15 10:11:23 +10:00
Damien Elmes
86f80ef926 Reduce maximum deck size in retention calculation
https://forums.ankiweb.net/t/anki-23-10-beta-5/35677/11
2023-10-14 12:00:22 +10:00
Abdo
5cde4b6941
Remove v1/v2 support from the backend (#2727)
* Remove v1/v2 support from deck list

* Remove v1/v2 support from most routines and show error

* Remove scheduler_version from preferences

* Fix formatting

* Remove v1/v2 conditionals from Python code

* Fix legacy importer

* Remove legacy hooks

* Add missing scheduler checks

* Remove V2 logic from deck options screen

* Remove the review_did_undo hook

* Restore ability to open old options with shift (dae)
2023-10-14 10:50:59 +10:00
Damien Elmes
fea1fc288b Keep badge out of natural tab order
If I've understood things correctly, this should allow regular
users to skip over the badge elements with Tab, while still
allowing screen reader apps to read/focus the badge elements.

https://github.com/ankitects/anki/pull/2721#issuecomment-1761740985
https://forums.ankiweb.net/t/anki-23-10-beta-5/35677/18
2023-10-14 10:20:14 +10:00
Damien Elmes
fc80793983 Fix reversed float left/right icons
Closes #2713
2023-10-13 13:04:42 +10:00
Damien Elmes
6e177851cc Add help entries for FSRS options 2023-10-13 12:50:15 +10:00
Damien Elmes
bfe340c163 Don't provide a button to copy estimated retention into desired retention
It's too easy for the user to end up with silly values if their configured
time/day is not reasonable.
2023-10-13 12:38:47 +10:00
Damien Elmes
8b4c57fbce Hide SM2-specific items in help pages when FSRS enabled 2023-10-13 11:00:51 +10:00
Damien Elmes
f4b760153f Hide loss aversion 2023-10-13 10:38:56 +10:00
Damien Elmes
003cdfd2ec Use sm2 retention when deriving memory state
Closes #2702
2023-10-13 10:37:35 +10:00
Hikaru Y
7cf19ea213
Fix selected shapes shifting to canvas origin (#2729)
* Fix selected shapes shifting to canvas origin

* Make only newly added shape selected even if it...

... overlaps with another
2023-10-13 09:58:43 +10:00
Aristotelis
a7e5d2a663
Change IO text background color to white (#2726)
Co-authored-by: Glutanimate <glutanimate@users.noreply.github.com>
2023-10-13 08:49:31 +10:00
Aristotelis
7ce1c4439a
Propagate editor UI state transitions to add-ons (#2711)
* Propagate editor UI state transitions to add-ons

* Also set initial Python state to EditorState.INITIAL

---------

Co-authored-by: Glutanimate <glutanimate@users.noreply.github.com>
2023-10-13 08:47:50 +10:00
Abdo
9e147c6335
Add text tool to image occlusion (#2705)
* Add text tool to IO

* Remove unnecessary parentheses

* Fix text objects always grouped

* Remove log

* Fix text objects hidden on back side

* Implement text scaling

* Add inverse text outline

* Warn about IO notes with only text objects

This will result in a different error message than the case where no
objects are added at all though, and the user can bypass the warning.
Maybe this is better to avoid discarding the user's work if they have
spent some time adding text.

* Add isValidType

* Use matches!

* Lock aspect ratio of text objects

* Reword misleading comment

The confusion probably comes from the Fabric docs, which apparently need updating: http://fabricjs.com/docs/fabric.Canvas.html#uniformScaling

* Do not count text objects when calculating current index

* Make text objects respond to size changes

* Fix uniform scaling not working when editing

* Use Arial font

* Escape colons and unify parsing

* Handle scale factor when restricting shape to view

* Use 'cloned'

* Add text background

* Tweak drawShape's params
2023-10-12 13:40:11 +10:00
Kenny
73eab9280d
Fix a11y issues with Badge component (#2721)
* fix: a11y issues in badge component

* fix: spacing issues with button element
2023-10-12 13:33:36 +10:00
Hikaru Y
b3f6edc323
Fix polygon tool not working (#2712)
* Fix polygon not converting correctly to cloze

* Fix first polygon disappearing when creating se...

...cond one during editing

Previously, a fabric object was passed directly to a `Shape` such as
`Rectangle` or `Polygon`, so mutating a non-primitive property of the
shape would lead to mutating the original fabric object as well.

* Commit addition of polygon immediately

Unlike the rect or ellipse tools, when the polygon tool was active,
clicking on the canvas did not fire the `object:removed` event and the
`change` event was not dispatched. As a result, an addition of a polygon
was not saved to the DB when switching to another note or closing the
editor in edit mode without performing an action that dispatched the
`change` event.
2023-10-10 13:51:35 +10:00
Aristotelis
4cd12ccd28
Refactor IO image pickers into separate component (#2710)
* Refactor IO image pickers into separate component

* Adjust import path

* Move styles to component and tweak class names

* Remove unused import

---------

Co-authored-by: Glutanimate <glutanimate@users.noreply.github.com>
2023-10-10 13:26:20 +10:00
Damien Elmes
9fd8a8bb40 Add stability graph 2023-10-01 15:44:33 +10:00
Damien Elmes
072cd37b42 Support rescheduling on weight/retention change 2023-10-01 15:20:58 +10:00
Damien Elmes
93499d4182 Display the default weights as a placeholder 2023-09-30 16:10:23 +10:00
Damien Elmes
50c8a1ba9f Update FSRS
- up to 10x performance increase in optimal retention
- expose loss aversion
- use SpinBoxes
2023-09-30 16:10:22 +10:00
Abdo
074f452762
Allow creating an image occlusion from the clipboard (#2689)
* Allow creating an image occlusion from the clipboard

* Refactor pasted image name construction into methods

* Reduce button's top padding

* Fix capitalization

* Fix quality parameter of pasted image

* Fix lint errors

* setup_mask_editor_for_file -> setup_mask_editor

* Select -> Paste

* Extract image reading logic

* Fix inlinedImageToFilename
2023-09-29 15:51:44 +10:00
Damien Elmes
da027bccd9 Tweak some wordings 2023-09-27 16:37:03 +10:00
Damien Elmes
65c2381f4d x% complete 2023-09-27 16:24:25 +10:00
Michael Eliachevitch
2580399552
Button to set desired FSRS retention to optimal/calculated (#2685)
* Draft set optimal/calculated retention button

Temporarily save the calculated optimal retention and display it with a button
that sets the desired retention above to this value.Don't show button until
attention had been calculated. Disable button when optimal and desired
attention are equal.

I find this nicer than the current alert-popup solution, as it avoids a popup
and gives a choice to the user to accept the calculated retention or not, while
also persisting the calculated retention on the screen for a bit.

TODO: What's still missing is that the `optimalRetention` variable is global and
persists when I change presets. When changing presets the variable should reset to
`undefined`, which would also makes the button disappear. Ideally it should also
disappear when changing the FSRS parameters. So probably it should be made part
of some deck options state and subscribe to some events. But with that I might
need some help. Also I thought whether that variable should go into the deck
options schema but tbh it's not something we want to persist between sessions,
users should recalculate it.

* Add me to contributors for tests so pass

* Add formatting ant type fixes to make tests pass

* Minor fixes (dae)

* Remove the period
2023-09-27 16:12:49 +10:00
Abdo
ab7e64865e
Implement "stop timer on answer" as a preset option (#2686)
* Implement "stop timer on answer" as a preset option

* Hide timer setting on AnkiMobile (dae)
2023-09-27 16:10:14 +10:00
Damien Elmes
aee6fcf456 Fix weight computation progress not showing 2023-09-26 14:02:12 +10:00
Michael Eliachevitch
2491b93ea6
More sensible lower FSRS progress indicator precision (#2684)
It's very helpful having a sub-permille precision in a progress
indicator, percent-precision or at most a tenth of a percent should be
sufficient for any indicator.

But in particular the compute-retention progress has 10 steps, i.e. the progress
increases in 10%-intervals (10%, 20%, ...), it *cannot* have sub-decimal
progress-percentages, see 2d5b19b494/src/optimal_retention.rs (L365-L368). So there integer percents should be
enough, everything else is misleading.

The compute-weights progress is currently (as of beta-2) not showing up at all.
Maybe if the bug is fixed it can show sub-percent percentages, so for know I changed that
to 0.1% precision. But I think integer percentages should be fine here as well,
so upon request I can fix that.

Also see my comment on this problem in https://forums.ankiweb.net/t/anki-23-10-beta/34912/39.
2023-09-26 14:01:05 +10:00
Abdo
bccc5b0995
Fix wrong mask position after merging groups (#2682) 2023-09-26 13:14:13 +10:00
Damien Elmes
bae8038178 Allow desired retention to be set to 0.7
https://github.com/open-spaced-repetition/fsrs-rs/issues/79#issuecomment-1733779005
2023-09-26 13:03:49 +10:00
Damien Elmes
8214aa42a1 Don't show multiple cancel buttons 2023-09-25 16:40:11 +10:00
Damien Elmes
17cfec5e35 Prohibit weight generation when reps < 1000 2023-09-25 16:17:00 +10:00
Damien Elmes
baae685dbb UI tweaks
https://forums.ankiweb.net/t/anki-23-10-beta-1/34912/19
2023-09-25 15:54:18 +10:00
Damien Elmes
3c62a8345a Cap optimal retention simulation to 10 years 2023-09-25 14:34:26 +10:00
Damien Elmes
ba9ee93fa8 Expose deck-then-random option in UI 2023-09-25 11:12:28 +10:00
Damien Elmes
c788f8ac8a Fix entire collection being used to calculate weights 2023-09-24 19:42:50 +10:00
Damien Elmes
e6fdfc20a9 Use FSRS difficulty when sorting by ease 2023-09-23 16:20:36 +10:00
Damien Elmes
2126ff9a16 Gate graph display on fsrs status 2023-09-23 15:59:02 +10:00