Commit graph

362 commits

Author SHA1 Message Date
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
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
llama
fab939e0e1
add image context menu actions for io mask editor (#3779) 2025-01-31 00:06:29 +11:00
llama
56dd93b5be
Add drag/drop support when adding IO images (#3776)
* allow adding images via drag/drop when adding io

* support editing io notes as well

Co-authored-by: Abdo <abdo@abdnh.net>

---------

Co-authored-by: Abdo <abdo@abdnh.net>
2025-01-27 18:58:58 +03:00
llama
00501c267c
fix copying images with filenames containing reserved chars (#3775) 2025-01-27 16:57:31 +03:00
Damien Elmes
5ccc6304e3 Fix drag&drop on some Linux systems
Thanks to Ab_Bc:
https://forums.ankiweb.net/t/image-occlusion-not-working-jan-2025/54523/17

Closes #3767
2025-01-26 17:31:54 +11:00
llama
430d5f5639
Revert Editor.set_note's signature change with an alternative approach for #3730 (#3736)
* remove orig_note_id param

* add and use Note.orig_note_id instead

* add and use Editor.orig_note_id instead
2025-01-18 17:14:09 +11:00
llama
86c2887e56
Add support for copied image files when adding IO notes (#3733)
* unhardcode allowed_suffixes

* support pasting urls from clipboard when adding io notes
2025-01-18 15:59:36 +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
llama
ca6002fd58
remove image menu feature when on qt5 (#3685) 2025-01-07 15:30:51 +03:00
llama
91b3740554
Stop audio playback on editor close (#3666)
* stop audio playback on browser close

* revert fix

* add caller-aware versions of play_file and stop_and_clear_queue

* stop editor's audio autoplay on close

* remove superfluous stop_and_clear_queue from addcards
2025-01-04 18:55:40 +03:00
Ben Nguyen
128f54ed90
Fix reuse internal clipboard for primary selection pasting (#3613)
* Pass down clipboard mode

* Add type annotation
2024-12-09 15:38:52 +11:00
Ben Nguyen
a537d349b8
Enable strict_optional for aqt/editor.py (#3500)
* Enable strict_optional for aqt/editor.py

* Fix mypy errors in EditorWebView class

* Fix mypy errors in Editor class

* DRY

* Match same short circuiting behavior

* Convention
2024-10-16 01:08:24 +10:00
user1823
de3b1754fa
Add "open image" option to editor (#3431)
* Add "open image" option to editor

* Update qt/aqt/editor.py

Co-authored-by: Ben Nguyen <105088397+bpnguyen107@users.noreply.github.com>

* Update editor.py

* Remove unused import

* Fix "show in folder"

* Fix 'show in folder' on macOS

* Revert "Fix "show in folder""

This reverts commit cf2b33ee9422bcaf8d9e20bd4cce74e5061c13cf.

* Reimplement show_in_folder for Windows (dae)

- Avoid reusing call(), as the startupinfo we were passing in was
breaking the explorer invocation
- Attempt to bring explorer to the front after the window has been show,
as it otherwise appears under Anki (at least when running from source)

---------

Co-authored-by: Ben Nguyen <105088397+bpnguyen107@users.noreply.github.com>
Co-authored-by: Damien Elmes <gpg@ankiweb.net>
2024-10-04 20:51:55 +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
Damien Elmes
f3b0afcc62 Revert "Fix pasting from the primary selection (#3413)"
This reverts commit 0a879bd2ed.

Closes #3435
2024-09-25 20:59:10 +10:00
user1823
02d2566998
Add an option to show image from editor in folder (#3412)
* Add "Show in folder" option to images in editor

Credits: @abdnh's Reveal in File Manager add-on (https://github.com/abdnh/anki-misc/tree/master/reveal_in_file_manager)

* Refactor
2024-09-20 21:38:44 +10:00