Commit Graph

10106 Commits

Author SHA1 Message Date
Damien Elmes
ed334fa45d Allow cloze/image occlusion notetypes to be restored to defaults 2023-04-19 15:04:18 +10:00
Damien Elmes
55f4ccdcbe Update translations 2023-04-18 14:12:07 +10:00
Damien Elmes
dd13e78eca
Add ability to restore a notetype to its original configuration (#2472)
* Store the original stock notetype kind in the notetype

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

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

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

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

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

Closes #2263
2023-04-12 16:12:41 +10:00
Damien Elmes
e40acd45a6 Add helper script for Intel cross compile on ARM Mac 2023-04-12 15:48:31 +10:00
Hikaru Y
b5fa47e307
Fix MathJax editor sometimes not properly sized / getting cut off (#2467)
* Fix MathJax editor sometimes not properly sized

Also fix an issue where when 'Reduce motion' is enabled, a popover
appears momentarily out of position and then shifts to the correct
position.

* Fix MathJax editor sometimes getting cut off

* Change max-width of MathJax editor
2023-04-12 09:43:57 +10:00
Damien Elmes
6fe9728b80 Bring chrono minimum back down for AnkiDroid
Accidentally bumped in recent deps update
2023-04-12 08:45:51 +10:00
Damien Elmes
0466e220f3 Move ascii_percent_encoding into a separate repo
This makes it easier to update independently, and means we don't need
to exclude it from formatting/tests.
2023-04-12 08:45:23 +10:00
Damien Elmes
781ff16683 Update from yanked crossbeam-channel 2023-04-12 08:29:26 +10:00
Damien Elmes
dc8c4438d7 Update iana-time-zone and windows crates, as windows 0.47 yanked 2023-04-12 08:25:53 +10:00
Damien Elmes
f0d430623c Update to Rumo's latest linkchecker code
cf838122a4 (r107719275)
2023-04-12 07:25:39 +10:00
Damien Elmes
b1ed4ade9d Upgrade to Qt 6.5 on Windows/Linux 2023-04-11 16:57:34 +10:00
Damien Elmes
5f542b895d Update spin-rs for bug fix
https://github.com/advisories/GHSA-2qv5-7mw5-j3cg
2023-04-11 16:23:32 +10:00
Damien Elmes
d9624819e9 Add a fully-random review order
https://forums.ankiweb.net/t/bug-the-random-option-in-the-review-sort-order-setting-is-not-truly-random/29199
2023-04-11 16:16:45 +10:00
Damien Elmes
1c73aeb433 Update translations 2023-04-11 16:16:45 +10:00
Damien Elmes
a14cdaf5e3 Update translations 2023-04-03 12:50:56 +10:00
Damien Elmes
c307b4e8b8 Clarify some translation terms 2023-04-03 12:50:35 +10:00
Damien Elmes
f2e61c8982 Fix a line failing cargo fmt with stable Rust
https://github.com/ankidroid/Anki-Android-Backend/pull/280#issuecomment-1493144833
2023-04-03 09:39:30 +10:00
Damien Elmes
82caffecbc Revert wheel upgrade
Will need to investigate why it's breaking bundles:

https://buildkite.com/ankitects/anki-ci/builds/5642#018735f6-5178-427a-9143-b6e610433408
2023-03-31 15:04:51 +10:00
Damien Elmes
26c640805c Update Rust deps
axum-client-ip excluded, as it will need further work.
2023-03-31 14:38:24 +10:00
Damien Elmes
f497bd6a33 Bump Rust version 2023-03-31 14:11:33 +10:00
Damien Elmes
0a0d17ff98 Update Python deps
- Black's formatting has changed
- Pylint has introduced a new lint
2023-03-31 14:04:05 +10:00
Damien Elmes
066db4bae8 Use type narrowing for extract-strings and transform-string
Fixes mypy errors in latest version
2023-03-31 14:02:50 +10:00
Damien Elmes
1f347d09d5 Update extract-strings.py and transform-string.py for ninja 2023-03-31 14:02:45 +10:00
Damien Elmes
f05e5b448d Fix yarn.sh failing with linked out folder 2023-03-31 13:08:59 +10:00
Damien Elmes
53c6714857 Bump version 2023-03-31 13:00:05 +10:00
Damien Elmes
0c1eaf4ce6 Ensure deck chooser is cleaned up
Fixes errors when stats closed and subsequent operations performed.
2023-03-31 12:32:25 +10:00
Damien Elmes
1cf945f349 Update translations 2023-03-31 12:02:17 +10:00
yellowjello
863f336d85
Add a deck selector to Stats (#2461)
* Add a deck selector to Stats

* Windows/Linux looks more aligned with 0 top margin

* Prevent Close button from becoming default

If user navigates to deck button with shift+tab, two buttons are highlighted
on Windows/Linux.

* Tweak deck change code

- Remove unneeded initiator argument
- Use our window as the parent, so a progress window will pop up
above the correct window if required.
2023-03-29 13:32:00 +10:00
Mani
2bf134dc72
Feature image occlusion (#2367)
* add note types with occlusions and image fields

* generate image occlusion cloze div data
- generate div element with data-* atrributes for canvas shape generate for reviewer

* getting image data & deck id and adding notes
the implementation added into backend
- added service index in backend.proto for image occlusion request
- created image_occlusion.proto with required message and service
- implementation in backend for getting image and adding notes, also during editing return imagecloze note and update notes
- add notes to selected deck, if no notetype then add image occlusion notetypes
- reuse notetype from stock notetypes when not exist

* script for generating shapes using canvas api in reviewer
- the flash issues fixed by loading image and using image size to draw canvas, also when image get resized, calculate scale using natural width and canvas width to draw shape at right position
- limit size of canvas for safari

* init image occlusion page in ts and build page
with
- fabricjs for editing shapes
- panzoom for drag and zoom
- pickr for color picker
- build page using web.rs

* implement top toolbar for canvas shapes
- undo & redo tools
- zoom in, zoom out and zoom fit
- group & ungroup
- copy & paste
- set transparency of shapes
- align tools

* implement side toolbar for drawing shapes
add top toolbar and the side toolbar contains following tools
- cursor for selecting shapes
- zoom for drag and zoom shapes in mask editor
- rectangle for creating it
- ellipse for creating it
- polygon for creating it using points
- shape fill color
- question mask color (currently only single color can be added for all shapes)

* add maskeditor page for editing mask
- add side toolbar and sidebar include toptoolbar
- load maskeditor in two mode
     - for adding note using path to image
     - for editing note using note id

* implement note editor page for adding notes
- the note editor page have simple button (B/I/U) and option to toggle html view
- option to select deck for adding notes into that deck
- option to generate to hide all, guess one & hide one, guess one notes

* add image occlusion page
add side toolbar, top toolbar, mask editor and note editor
- option to switch between mask editor and note editor

* implement generates notes and save notes
implemention to show toast components for messages

* removed pickr & implemented color picker component
- remove pickr
- implemented using html5 canvas
- range input for changing color
- another range input for opacity changes
- hex and rgba value support

* rename methods name & rust unwrap safety
- change plural names to singular
- create respone message in proto and return response with imagecloze note or error if not found with note id
- remove image_occlusion from post handler list
- rename service name in mediasrv.py
- rename methods name for image occlusion in backend and image_occlusion
- update frontend also for update functions' names
- handle error in frontend mask-editor.ts, when error getting notes then toast message shown to frontend

* extract to function & add comments & remove global
- extract function in mask-editor.ts to reduce duplicate
- remove unused global from css
- add comments to store.ts explaining usage
- changes id to noteId in lib.ts
- add comments for limitSize, becuase of duplicate implementation

* remove image_occlusion notetype
- remove from stock notetype, stdmodels
- add implementation for notetype to image occlusion
- add i18n for errors

* update smooth scroll, always show cursor tools
- change questionmask to qmask
- make selectable for shape true in all tools to simplify edits and draw shapes
- update image occlusion in reviewer ts to load image properly

* add and get notetype else return errors

* fix: not showing occlusion

* Use a oneof for ImageClozeNoteResponse

Makes it clearer that only one of them can be returned

* Don't crash if image filename not provided

The second unwrap should be ok, as the input is utf8

* Refactor get_image_cloze_note

- fixes crash when note doesn't exist - Ok(None) case was not covered
- decouples business logic from native error->proto error conversion
- no need for original copy
- field[x] is more idiomatic than field.get(x).unwrap()
- don't need mutable access to fields

* Fix crash if image file unreadable

+ Use our read_file helper for better error context

* Add metadata() helper

* Fix crash if file metadata can't be read

* remove color picker, qmask and shape color
- remove strings from ftl
- remove color picker component
- remove from cloze generation
- remove icons for two buttons
- use constant color for shapes

* update color in reviewer and ftl strings

* fix shape position in canvas & add border to shape
- rename mask to inactive shape and active shape color
- border witdth and border color
- change decimal point deserializing string and toFixed(2)
- add thin border in mask editor, may be image background was transparent

* fix shape position in canvas after modified
- do not draw fixed ratio shapes by turn of uniformScaling
- fix rectangle width,height
- fix ellipse rx,ry,width,height
- fix polygon postion and points
- draw outside of canvas also

* fix border width and color in reviewer canvas
- rename variable

* refactor cloze div generate and remove angle

* fix origin when drawn outside of canvas from right

* fix shape at boundry & not include rx,ry rectangle
- move shapes at boundry when pointer is outside of canvas
- include rx, ry for ellipse only
- include points for polygon only

* fix lint errors & update image size in editor canvas based on height and width

* remove unsupported layerX & layerX for touchscreen
- fix shapes at edges

* implemented undo redo with canvas state

- implemented undo redo using fabric canvas events
- polygon is special case and implemented only added and modified event
- rectangle and ellipse have object:added, object:modified and object:removed case
- change id to undo and redo

* remove background image from canvas and used css to put image tag below canvas editor

- set image width and height after adding image

* fix for polygon points, add br in cloze strings, & toogle masks button

- fix shapes at edges
- toggle masks button to show/hide masks
- hide clozes string, it contains <br>
- set height for div container (used 'relative' in css)

* refactor top toolbar, add space and border radius
- rename cursor tools
- add left and right border

* fix undo after undo happen, use transparent color in draw mode
2023-03-29 12:33:19 +10:00
Kieran Black
c691c9bcf6
bump walkdir from 2.3.2 to 2.3.3 (#2460)
* bump walkdir from 2.3.2 to 2.3.3

Build was failing on windows due to walkdir matching . as any folder starting with . instead of as the cwd.

* change name in CONTRIBUTORS

* change name back in CONTRIBUTORS
2023-03-29 11:54:27 +10:00
Damien Elmes
5613113ff4 Update translations 2023-03-28 15:36:58 +10:00
Kieran Black
fe591f6be7
fix stats calendar incorrect due to daylight savings time (#2456)
* fix stats calendar daylight saving time offset bug

Previously, when computing counts for the calendar in the stats menu, it was assumed that days had 86,400 seconds. However, this assumption does not hold true on the day when daylight savings occurs.

* add self to CONTRIBUTORS and about.py

* fix stats calendar anki day to calendar day mapping

Since Anki days don't necessarily roll over at midnight, mapping an Anki day into a calendar day needs to have a linear shift applied. By providing the frontend with access to the scheduler's rollover hour, we can account for this offset.
2023-03-28 15:35:06 +10:00
Hikaru Y
0e0436f850
Allow Shift+Tab to move focus from tag area to last field (#2458) 2023-03-28 14:13:21 +10:00
Fabricio Duarte
bbaa6c24ec
Prevent the sticky from hiding in the stats page (#2457)
* Prevent the sticky from hiding in the stats page

* Replace height:auto with height:initial in the import CSV page

To match with the other pages (deck options and graphs), making it easier to possibly simplify the CSS code in the future. Doesn't really cause any changes.
2023-03-26 15:23:50 +10:00
Damien Elmes
96841df5f8 Ensure sync spinner spins when reduce motion is on 2023-03-26 14:49:49 +10:00
Damien Elmes
39e503d0aa Add time of date to browser date columns 2023-03-26 14:49:49 +10:00
dependabot[bot]
b86bf5f204
Bump openssl from 0.10.45 to 0.10.48 (#2455)
Fixes some security issues.

Bumps [openssl](https://github.com/sfackler/rust-openssl) from 0.10.45 to 0.10.48.
- [Release notes](https://github.com/sfackler/rust-openssl/releases)
- [Commits](https://github.com/sfackler/rust-openssl/compare/openssl-v0.10.45...openssl-v0.10.48)

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

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-03-25 13:09:18 +10:00
Damien Elmes
516748c782 hasUrls() may be true even if there are no URLs
Silences the error on https://forums.ankiweb.net/t/error-message-with-forvo/28529
2023-03-22 16:24:50 +10:00
Damien Elmes
77a45365cb Start debug console with text area focused
See PR#2435
2023-03-22 15:52:55 +10:00
RumovZ
20072c566d
Fix new ignore review limit help (#2452) 2023-03-22 15:48:47 +10:00
Damien Elmes
d0ab7acb7f Update translations 2023-03-20 07:55:25 +10:00
Abdo
946eb46813
Add option to exclude fields from search (#2394)
* Add option to exclude fields from unqualified searches

* Use temp tables instead

This is slightly faster according to my (very rough) tests.

* Make query a bit more readable

* exclude_from_search -> excludeFromSearch

* Remove superfluous notetypes table from query

* Rework to use field search logic

Thanks to Rumo for the suggestion: https://github.com/ankitects/anki/pull/2394#issuecomment-1446702402

* Exclude fields from field searches too

* Fix error on notetypes with no included fields

* Add back the exclude_fields function

This approach seems to perform better on average than the previously
benchmarked ones.

* Use pure-SQL approach to excluding fields

* Change single field search to use new approach

* Fix flawed any_excluded/sortf_excluded logic

* Support field exclusion in the nc operator

Also fix search text being wrapped in % in the any_excluded=true case.

* Support field exclusion in the re and w operators

* Label field exclusion as being slower

* Unqualified search should be wrapped in % in all cases

I was under the impression that it shouldn't be wrapped with the new
field exclusion logic.

* Remove unnecessary .collect()

* Refactor some complex return types into structs

* Do not exclude fields in field searches

* Add a test and docstring for CollectRanges

* Avoid destructuring in closures

* Remove the exclude_fields function

Minor wording tweaks by dae:
* num_fields -> total_fields_in_note
* fields -> field_ranges_to_search
* fields -> fields_to_search
* SingleField -> FieldQualified
* mid -> ntid
2023-03-20 07:46:03 +10:00