Commit graph

377 commits

Author SHA1 Message Date
Abdo
603b12967c Alow passing deck/notetype ID on AddCards init 2025-08-27 03:54:27 +03:00
Abdo
60f7df7210 Fix wrong arg name 2025-08-27 03:39:20 +03:00
Abdo
becac3f764 Simplify loadNote() arg passing 2025-08-27 03:30:19 +03:00
Abdo
efe76a24dc Only reload note on reopen if empty 2025-08-27 02:08:27 +03:00
Abdo
ba881d4e90 Fix selected notetype/deck reverting back to defaults 2025-08-27 02:01:10 +03:00
Abdo
829da5a84a Use defaults_for_adding() 2025-08-16 20:39:21 +03:00
Abdo
ae42f5685b Fix Create Copy 2025-07-26 22:29:19 +03:00
Abdo
7dac2fc4ff Add back legacy code as separate screens 2025-07-21 22:30:25 +03:00
Abdo
a32ef31382 Fix lint errors 2025-06-29 22:03:58 +03:00
Abdo
939d833e12 Merge branch 'main' into editor-3830 2025-06-29 22:01:28 +03:00
Abdo
f94d05bcbe
Switch to Ruff (#4119)
* Add check:ruff build action

* Add fix:ruff action

* Add Ruff config

Mostly generated by Cursor

* Handle rest of lints

* Fix formatting

* Replace black and isort with ruff-format

* Run ruff-format

* Fix lint errors

* Remove pylint disables

* Remove .pylintrc

* Update docs

* Fix check:format not just checking

* Fix isort rule being ignored

* Sort imports

* Ensure ./ninja format also handles import sorting

* Remove unused isort cfg

* Enable unsafe fixes in fix:ruff, and enable unused var warning

* Re-run on config change; enable unnecessary ARG ignores

* Use all pycodestyle errors, and add some more commented-out ones

Latter logged on https://github.com/ankitects/anki/issues/4135
2025-06-29 14:38:35 +07:00
Abdo
4e2f7445ba Fix duplicate triggerPageAction() call 2025-06-29 04:19:30 +03:00
Abdo
83e1f150fb Add a hide_while_preserving_layout() call
This should reduce flicker.
2025-06-29 03:21:25 +03:00
GithubAnon0000
cfeb71724d
CHANGE right-click in the editor to show option to open folder in linux (#4125)
* CHANGE right-click in the editor to show option to open folder in linux

* FIX checks

* Use heuristics

* ./ninja format

* Use fallback from main instead of xdg-open
2025-06-28 21:33:17 +03:00
Abdo
723b54830b Add missing editor.nid initialization 2025-06-24 15:28:40 +03:00
Abdo
c4a9ba254e Remove editor.note refs and fix some lint errors 2025-06-21 10:08:45 +03:00
Abdo
e0120309fa Fix Cards/Fields buttons 2025-06-21 09:32:14 +03:00
Damien Elmes
04996c77f3
Migrate build system to uv (#4074)
* Migrate build system to uv

Closes #3787, and is a step towards #3081 and #4022

This change breaks our PyOxidizer bundling process. While we probably
could update it to work with the new venvs & lockfile, my intention
is to use this as a base to try out a uv-based packager/installer.

Some notes about the changes:

- Use uv for python download + venv installation
- Drop python/requirements* in favour of pyproject files / uv.lock
- Bumped to latest Python 3.9 version. The move to 3.13 should be
a fairly trivial change when we're ready.
- Dropped the old write_wheel.py in favour of uv/hatchling. This has
the unfortunate side-effect of dropping leading zeros in our wheels,
which we could try hack around in the future.
- Switch to Qt 6.7 for the dev repo, as it's the first PyQt version
with a Linux/ARM WebEngine wheel.
- Unified our macOS deployment target with minimum required for ARM.
- Dropped unused fluent python files
- Dropped unused python license generation
- Dropped helpers to run under Qt 5, as our wheels were already
requiring Qt 6 to install.

* Build action to create universal uv binary

* Drop some PyOxidizer-related files

* Use Windows ARM64 cargo/node binaries during build

We can't provide ARM64 wheels to users yet due to #4079, but we can
at least speed up the build.

The rustls -> native-tls change on Windows is because ring requires
clang to compile for ARM64, and I figured it's best to keep our Windows
deps consistent. We already built the wheels with native-tls.

* Make libankihelper a universal library

We were shipping a single arch library in a purelib, leading to
breakages when running on a different platform.

* Use Python wheel for mpv/lame on Windows/Mac

This is convenient, but suboptimal on a Mac at the moment. The first
run of mpv will take a number of seconds for security checks to run,
and our mpv code ends up timing out, repeating the process each time.
Our installer stub will need to invoke mpv once first to get it validated.

We could address this by distributing the audio with the installer/stub,
or perhaps by putting the binaries in a .pkg file that's notarized+stapled
and then included in the wheel.

* Add some helper scripts to build a fully-locked wheel

* Initial macOS launcher prototype

* Add a hidden env var to preload our libs and audio helpers on macOS

* qt/bundle -> qt/launcher

- remove more of the old bundling code
- handle app icon

* Fat binary, notarization & dmg

* Publish wheels on testpypi for testing

* Use our Python pin for the launcher too

* Python cleanups

* Extend launcher to other platforms + more

- Switch to Qt 6.8 for repo default, as 6.7 depends on an older
libwebp/tiff which is unavailable on newer installs
- Drop tools/mac-x86, as we no longer need to test against Qt 5
- Add flags to cross compile wheels on Mac and Linux
- Bump glibc target to 2_36, building on Debian Stable
- Increase mpv timeout on macOS to allow for initial gatekeeper checks
- Ship both arm64 and amd64 uv on Linux, with a bash stub to pick
the appropriate arch.

* Fix pylint on Linux

* Fix failure to run from /usr/local/bin

* Remove remaining pyoxidizer refs, and clean up duplicate release folder

* Rust dep updates

- Rust 1.87 for now (1.88 due out in around a week)
- Nom looks involved, so I left it for now
- prost-reflect depends on a new prost version that got yanked

* Python 3.13 + dep updates

Updated protoc binaries + add helper in order to try fix build breakage.
Ended up being due to an AI-generated update to pip-system-certs that
was not reviewed carefully enough:
https://gitlab.com/alelec/pip-system-certs/-/issues/36

The updated mypy/black needed some tweaks to our files.

* Windows compilation fixes

* Automatically run Anki after installing on Windows

* Touch pyproject.toml upon install, so we check for updates

* Update Python deps

- urllib3 for CVE
- pip-system-certs got fixed
- markdown/pytest also updated
2025-06-19 14:03:16 +07:00
Abdo
4dd402334f Remove legacy editor code
We can worry about add-on compatibility later
2025-06-18 23:55:33 +03:00
Abdo
cf099ea508 Move Record Audio button 2025-06-18 23:55:33 +03:00
Abdo
e48a2a5b6a Move Attach Media button 2025-06-18 23:55:33 +03:00
Abdo
70a69cfdbe Move context menu logic 2025-06-18 23:55:26 +03:00
Abdo
d585916313 Fix lint errors 2025-06-12 05:00:33 +03:00
Abdo
13c2dd201a Move more image occlusion calls 2025-06-12 04:33:29 +03:00
Abdo
99396e5811 Start work on copy & paste handling 2025-06-09 18:04:57 +03:00
Abdo
545d3dbfed Move IO/cloze button toggles 2025-06-08 05:46:31 +03:00
Abdo
07d3b6d2b5 Fix lint errors 2025-06-02 06:14:15 +03:00
Abdo
05360e2d19 Add a temporary workaround for addcards 2025-06-02 06:04:17 +03:00
Abdo
b3aa8e93f3 Remove legacy routines moved to JS 2025-06-02 04:21:23 +03:00
Abdo
795aef09ee Move fields_check() 2025-06-02 03:59:29 +03:00
Abdo
8391761bc2 Move showDupes() 2025-06-02 03:42:23 +03:00
Abdo
0966cd4552 Move setupMaskEditor() calls 2025-06-02 02:59:24 +03:00
Abdo
a45add60df Move setCloseHTMLTags() 2025-05-28 11:40:45 +03:00
Abdo
4ab3970cd6 Move setShrinkImages() 2025-05-28 11:38:05 +03:00
Abdo
544b5f54d7 Move setMathjaxEnabled() 2025-05-28 11:28:36 +03:00
Abdo
15cbbeea24 Move setTagsCollapsed() 2025-05-28 10:35:43 +03:00
Abdo
9395b89b92 Move setColorButtons() 2025-05-28 09:25:47 +03:00
Abdo
423393107d Move fontMungeHack() 2025-05-28 06:36:40 +03:00
Abdo
436d76a81e Move setSticky() call 2025-05-26 02:53:53 +03:00
Abdo
35f0bc5af6 Reimplement editor_will_munge_html callbacks 2025-05-26 02:51:02 +03:00
Abdo
0a3710e967 Replace note save call for saveTags cmd 2025-05-25 21:24:17 +03:00
Abdo
8a87e6496c Remove legacy editor tagedit functions 2025-05-25 21:20:22 +03:00
Abdo
3073ef02b5 Remove editorReady()
bridgeCommand() looks cleaner here
2025-05-25 21:14:10 +03:00
Abdo
1809e793e6 Move note saving to TS 2025-05-25 19:23:55 +03:00
Abdo
053bd4380f Move some JS calls in loadNote() 2025-05-25 14:54:01 +03:00
Abdo
5cbb5242c8 Move editor code to ts/routes 2025-05-22 02:46:01 +03:00
Arthur Milchior
efaaae8ce4
Cloze button get disabled outside of cloze field (#3879)
* NF: replace `disabled` by `enabled`

This allows to remove the negations and, in my opinion, make the code
easier to understand and edit.

* Cloze button get disabled outside of cloze field

More specifically, if the user focus in a field that is not a cloze
field, the button are still there but appear as disabled. The shortcut
instead of adding the cloze context shows an alert explaining why this
can't be done.

While this message is already displayed when the user tries to add a
note with cloze in non-cloze field, I suspect it will save time to
stop the user as soon as possible from making mistake. This should
make very clear what is authorized and what is not.

It'll also be a reminder of whether the current field is a cloze or
not.

In order to do this, I added a back-end method (that I expect we may
reuse in ankidroid) to get the index of the fields used in cloze. This
set is sent to the note editor, which propagates it where needed.

In mathjax, the cloze symbol is removed when the selected field is not
a cloze field.
2025-04-24 18:37:41 +10:00
Damien Elmes
1e74e8e86e
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
2025-04-24 15:26:46 +10:00
llama
1d2d6e51b9
Fix error when middle clicking in editor on systems w/o global mouse selection (#3923)
* fix potential error when middle clicking in editor

* update about.py
2025-04-15 20:26:18 +10:00
llama
8b2a64852b
fix drag/drop breaking when editor is zoomed (#3916) 2025-04-13 14:44:28 +10:00