Commit graph

2199 commits

Author SHA1 Message Date
Damien Elmes
9cfd8af34e Fix add-on buttons not working in the editor (#3941)
* Fix add-on buttons not working in the editor

* Ensure old listeners are cleaned up

Thanks to iamllama: https://github.com/ankitects/anki/pull/3941#discussion_r2057066283

(cherry picked from commit 1e74e8e86e)
2025-04-24 15:30:41 +10:00
Damien Elmes
bfc87c0427 Use CSP to block inline JS content in editor (#3939)
* Revert "Sanitize field content in editor"

This reverts commit 1c156905f8.

* Use CSP to block inline JS content in editor

This blocks inline scripts, scripts in the media folder, and
handlers like onclick in the editor. This is nicer than the previous
solution - it doesn't make any permanent changes, and leaves other
content like SVGs alone. Thanks to Nil Admirari for the suggestion.

(cherry picked from commit ddb8573e8d)
2025-04-23 16:23:18 +10:00
Damien Elmes
82f3778340 Sanitize field content in editor
The editor already strips script tags from fields, but was allowing
through Javascript in things like onclick handlers. We block this now,
as the editor context has access to internal APIs that we don't want to
expose to untrusted third-party code.

(cherry picked from commit 1c156905f8)
2025-04-17 11:16:57 +10:00
Damien Elmes
038d85b1d9 Further tweaks to easy days
The previous commit added word-wrap, but it was not working after I'd
removed some other tweaks I'd made in testing, that I thought were not
required. I ended up switching to standard table columns and a fixed
layout, so that both the column and row headers will wrap properly.
2025-02-11 17:04:58 +07:00
Damien Elmes
348822a14b Quick hack to improve minimum deck options width
Partial fix for #3796
2025-02-11 16:11:43 +07:00
Jarrett Ye
0d9a11c19b
Add margin to the bottom of forgetting curve (#3805) 2025-02-11 15:46:36 +07:00
Luc Mcgrady
dda5973fdc
Remove forgetting curve radio buttons when only one radio button (#3804) 2025-02-09 15:53:05 +03:00
llama
da8c0f0e9b
clear io image field when resetting in add mode (#3794) 2025-02-06 22:58:49 +07:00
Danika-Dakika
6e7dcad542
Update Deck Options strings to clarify Timers (#3792)
* Update CONTRIBUTORS

added myself

* Update about.py

added myself

* Update scheduling.ftl

timers-related string changes

* Update deck-config.ftl

timers-related string changes

* Update help-page.ts

timers-related string changes
2025-02-06 15:17:30 +07:00
llama
8dea502689
add cut handler in TagInput (#3791) 2025-02-06 14:26:44 +07:00
llama
2cbcd79a84
Cap preview cols to prevent stall when csv is parsed with the wrong delimiter (#3786)
* cap csv import preview table at 1000 columns

* add fluent message

* show warning when preview table columns have been truncated

* simplify fluent message ($count will almost always be a big num)

* _tr -> tr
2025-02-06 14:23:43 +07:00
Luc Mcgrady
dd93691b9c
Added: SpinnerBox percentage symbol. (#3777)
* Added: Padded percentage symbol

* Added: Floating percentage

* ./check

* half finished comment

* Removed: redundant toStringValue function

* Removed: Accidental import

* Improved pointer-events:none

* Improve percentage alignment

* Improve leftmost percentage alignment

* Fix: Percentage sticks to left

* ./check

* Fix: IOS css

* ./check
2025-02-06 14:21:26 +07:00
Luc Mcgrady
93032cdceb
Delete y-axis titles for graphs (#3789)
* Remove simulator y axis labels

* Remove forgetting curve y-axis title

* ./check

* Mark the card-stats string as deprecated as well (dae)
2025-02-06 14:17:39 +07:00
Damien Elmes
169d85883d Reviews graph: orange -> blue
Closes #3764
2025-01-26 17:45:14 +11:00
Jarrett Ye
43e860783b
Fix/re-optimize FSRS if short-term param is weird (#3742)
* Fix/re-optimize FSRS if short-term param is weird

* Reset progress when another run is required (dae)

* only count the same-day steps

* Fix flicker when optimizing again (dae)
2025-01-26 10:42:17 +11:00
Damien Elmes
5883e4eae8 Move Optimize All action into main deck options page
Closes #3696

I have no strong feelings about the message/button wordings or
layout, so if people have better suggestions, they are welcome.
2025-01-25 22:57:05 +11:00
Ross Brown
dc37a28de0
Add translation strings for True Retention table (#3745)
* Add translation strings for True Retention table

* Hard-code strings to make pylint happy
2025-01-25 19:18:43 +11:00
llama
df808727c8
fix changes to tags not being reflected when editing in io mode (#3768) 2025-01-25 10:36:21 +03:00
Arthur Milchior
6c37d5fc70
Add percentage to FSRS spinner (#3679)
* Add percentage to FSRS spinner

This commit add a percentage option in SpinBox and SpinBoxFloatRow, set to False
by default.

If it's true, a percent symbol is added at the end of the line before
the increase/decrease button.

While the value is represented as a percentage without decimal places,
the internal representation is not changed. Which mean that a
multiplier must used to compute the string value, indicate to the
input field the min, max and step, and when updating the result.

* Remove unsightly percentage sign, and update historical retention too

https://github.com/ankitects/anki/pull/3679#issuecomment-2579636981

---------

Co-authored-by: Damien Elmes <gpg@ankiweb.net>
2025-01-25 18:17:02 +11:00
llama
8ec94e281c
Remove unfinished polygon when undoing and redoing in IO mode (#3759)
* make removeUnfinishedPolygon return whether a polygon was removed

* treat removing an unfinished polygon as a discrete undo step

* has to be handled when redoing as well, but not as a discrete step
2025-01-25 10:08:47 +03:00
Damien Elmes
2d1c6c64e8 Add a separate route for card info in the sidebar
The move to Sveltekit broke the 'card info during review' add-on and
its descendants. This didn't get noticed in 24.11 due to the old
card-info.js file still being shipped.

I considered adding back the card-info.js generation, but it ended up
being simpler to move parts of the add-on into a separate page instead.
This is a stop-gap solution - in the future I'd like to get us to a
point where such component compositions can be done by add-ons,
and don't need to be done as part of Anki's build process.

Related: #3187
2025-01-24 18:08:11 +11:00
Damien Elmes
774d57cdc8 Restore the missing external congrats page 2025-01-24 16:21:36 +11:00
Ross Brown
5b8d8247f8
Fix True Retention table clipping on overflow (#3735) 2025-01-18 16:00:13 +11:00
Jarrett Ye
ac2b44859e
Feat/add future projection to forgetting curve with today marker (#3732)
* Feat/Add future projection to forgetting curve with today marker

* format

* remove the vertical line
2025-01-18 15:54:53 +11:00
llama
9c0911891d
Fix "Create copy" for IO notes (#3730)
* expose get_image_occlusion_fields

* fix create copy for io

* revert current impl

* passthru original note id when creating copy

* add IOCloningMode

* fix create copy for io
2025-01-17 16:03:00 +11:00
wackbyte
b6afddd181
Reduce use of type casting (#3723) 2025-01-12 20:05:05 +11:00
wackbyte
493320fb33
Unpin svelte and update sveltekit-svg (#3722)
Warnings from enums were fixed in https://github.com/sveltejs/svelte/pull/14192
2025-01-12 18:06:54 +11:00
llama
b6d7bb190d
Fix IO editor always starting in "hide all, guess one" mode (#3709)
* update backend

* set hideAllGuessOne in mask editor instead
2025-01-09 23:14:02 +11:00
Jarrett Ye
c4ad27a2db
Feat/support new cards ignore review limit in simulator (#3707)
* Feat/support new cards ignore review limit in simulator

* ./ninja fix:minilints & ./ninja format

* use published crate

* make newCardsIgnoreReviewLimit reactive

* format

---------

Co-authored-by: Damien Elmes <gpg@ankiweb.net>
2025-01-09 22:49:13 +11:00
llama
f0e67c4cd3
Fix image field not being saved if a mask is created too quickly (#3706)
* commit image field immediately in setupMaskEditor

* use saveFieldNow instead
2025-01-09 22:29:34 +11:00
David Elizalde
1bdd7f706f
Issue 2563 - remove mhchem (#3705)
* Issue 2563 - remove mhchem

* Update CONTRIBUTORS
2025-01-09 22:24:39 +11:00
Luc Mcgrady
59391e96fb
Added colour to simulator tooltip (#3692)
* Added colour to simulator tooltip

* ./check
2025-01-09 21:44:54 +11:00
llama
9499473caa
Fix EasyDays not applying defaults correctly in deck options (#3691)
* fix EasyDays not applying defaults correctly

* remove the svelte-ignore that's no longer needed
2025-01-09 21:32:16 +11:00
Luc Mcgrady
16514727ff
Simulator legend tooltip (#3676)
* Added: Tooltip to simulator legend

* Added: Memorised tooltip

* Add: Per day text

* Added: Group name to tooltip
2025-01-09 20:33:10 +11:00
Arthur Milchior
d7fc98d4d8
Deck options without bridge (#3571)
* NF: Modify CONTRIBUTORS

Just so that I stop getting the warning

* NF: Create `deckOptionsReady`

* NF: rename _close to require_close

The method will have to be used outside of this class, so can't be private

* NF: simplify slightly some code

* NF: remove bridge command from deck options

* Remove unused import

* Remove superfluous comment with a typo
2025-01-08 21:30:30 +11:00
llama
769f302ea8
Fix "discard changes" appearing on deck options (#3689)
* patch original config after a preset is selected for the first time

* update comment
2025-01-07 17:41:52 +03:00
llama
d01d83e2c6
convert floats to single-precision before comparing in isModified (#3686) 2025-01-07 17:13:43 +03:00
Luc Mcgrady
f057ee465d
Prevent simulate button spam (#3670) 2025-01-07 16:58:22 +03:00
Ben Nguyen
d89e6f3bdd
IO: Prevent text masks from flipping (#3672)
* Lock scaling flip when creating new text mask

* Lock scaling flip on existing text masks
2025-01-07 15:43:28 +03:00
llama
4ee6dacaa3
fix card info failing to load with qt5 (#3681) 2025-01-07 15:39:51 +03:00
Ross Brown
9877e22fd2
Tweak how the True Retention stats table displays numbers (#3677)
* Tweak how the True Retention stats table displays numbers

- Always show fractional parts of numbers even if they are 0 (91.0% not 91%).
- Show "N/A" for percentages instead of 0% when there are 0 total reviews.

* Localise percentages correctly
2025-01-04 23:13:32 +03:00
Luc Mcgrady
c985acb9fe
Add memorized option to FSRS simulation graph (#3655)
* Added: Memorized option to graph

* Count -> Reviews

* Added: Margin to radio button input

* Fix: Labels

* ./check

* Check errors?

* bump fsrs to 1.4.6

* ./ninja fix:minilints

* Added: Don't show hidden simulator values.

* Bump to fsrs 1.4.7
2024-12-22 11:40:51 +10:00
Ross Brown
5637390b50
Make the "True Retention" table pretty (#3640)
* Make the True Retention table pretty

* Hide absolute pass/fail table for 'all'

* Run './ninja format'

* Manually run prettier on Svelte 5 components

* Refactor to not use {#snippet}

* Fix lint to pass check:eslint

* Fix lint to pass check:svelte

* Rename t9n -> tr to follow code style

* Replace hard-coded string with a translation string

* Use assertUnreachable(...) for exhaustively matching enum
2024-12-19 00:41:57 +11:00
Jarrett Ye
abef3f39ca
Fix/dataPoint index is off by one day in simulator & remove moving average (#3645)
* Fix/dataPoint index is off by one day in simulator

* remove movingAverage
2024-12-19 00:09:04 +11:00
Luc Mcgrady
482874d4f0
Fix Fsrs simulator input problems (#3642)
* Fix: min value for Additional new cards not 0

* Fix: New cards/day default value not starting value

* Preset defaults for review intervals and per day.

* Fix: "Additional new cards to simulate" localisation

* Revert "Fix: "Additional new cards to simulate" localisation"

This reverts commit 9be61d9f93.
2024-12-18 23:43:51 +11:00
llama
b061da73d3
Replace use of window.postMessage in card info (#3646)
* Use anki.updateCard instead of window.onmessage in card-info

* Make card-info placeholder text grey

---------

Co-authored-by: Abdo <abdo@abdnh.net>
2024-12-18 11:32:07 +03:00
Mani
65fd461ddc
Allow object to move to right edge and bottom edge and allow scroll of note fields when not using IO (#3630)
* allow drag and draw at right and bottom edge of canvas area

* allow scroll in fields, when mask editor hidden

* format code
2024-12-15 19:30:47 +03:00
Damien Elmes
d900506003 Fix 'type error: failed to fetch' in congrats screen
The previously-added catch was not working due to the implicit error
handling of the proto methods.

Closes #2895
2024-12-14 22:51:13 +11:00
llama
b726e28229
Remove use of window.location.href in CardInfoDialog (#3621)
* Replace window.location in CardInfoDialog with load_sveltekit_page

* Fix format

* Fix ForgettingCurve's reactivity

* Props' default args aren't reactive

* Add global _updateCardId fn to card-info

* Use _updateCardId to reactively update card-info

* Fix format

* Fix type

* Use dummy form instead of window global for client-side nav

* Fallback to window.location in case form hasn't been rendered

* Use window.postMessage instead of dummy <form>
2024-12-14 22:45:54 +11:00
OuOu2021
008edbba28
I18n: Improve i18n and multi-platform display of FSRS Simulator (#3611)
* Improve i18n and multi-platform display of FSRS Simulator

* Tweak the graph bounds to avoid overlapping of the y-axis tick values ​​and the y-axis title

* Update CONTRIBUTORS

* I18n for 4 more strings

* Reduce TitledContainer wrapper of fsrs simulator graph to maximize content display area

* Clean unused variables

* Update ftl/core/deck-config.ftl

* Update ftl/core/deck-config.ftl
2024-12-14 21:59:00 +11:00