Edit Field During Review

<10kB. Updated 2020-09-11.

The author has shared 30 other item(s).

Description

IMPORTANT WARNING DON'T USE IT WITH CLOZE, LATEX OR AUDIO FIELDS Don't use the add-on with audio fields. The "[sound:...]" tag will be lost after editing. Don't use the add-on with cloze fields, i.e. don't change {{cloze:Text}} to {{edit:cloze:Text}}. It won't work and some data will be lost after editing, either the text inside clozes will be lost or cloze tags, and it can only be restored from the backup - ---------- Edit Field During Review (Cloze) ---------- There's the updated, if not a completely new, version of the add-on by BlueGreenMagick with cloze support added and multiple improvements - ---------------------------------------------------------- HOW TO USE Open the Card Template and replace {{Field}} with {{edit:Field}}. This is similar to {{type:Foreign Word}} or {{hint:MyField}}. During review click on the field, edit it and click outside of it or press Esc to save it, or press Ctrl+Z to undo any changes. Press Tab or Shift+Tab to switch between different editable fields. And it looks like it's possible to use Ctrl+B (bold), Ctrl+I (italic) and Ctrl+U (underline) shortcuts too. The implementation is very simple. The addon just replaces any {{edit:Field}} with <div contenteditable="true">{{Field}}</div> to make it editable. Tag "div" can be replaced with tag "span" to make it inline by updating the add-on's config file (Tools - Add-ons - Edit Field During Review - Config). The relevant post on Reddit - IMPORTANT NOTE & WARNING P̵l̵e̵a̵s̵e̵ ̵n̵o̵t̵e̵ ̵t̵h̵a̵t̵ ̵a̵s̵ ̵f̵o̵r̵ ̵n̵o̵w̵ ̵t̵h̵e̵ ̵a̵d̵d̵-̵o̵n̵ ̵i̵s̵ ̵p̵r̵e̵t̵t̵y̵ ̵d̵u̵m̵b̵ ̵a̵n̵d̵ ̵i̵f̵ ̵t̵h̵e̵ ̵e̵d̵i̵t̵a̵b̵l̵e̵ ̵f̵i̵e̵l̵d̵ ̵i̵s̵ ̵s̵t̵i̵l̵l̵ ̵a̵c̵t̵i̵v̵e̵ ̵a̵n̵d̵ ̵s̵o̵m̵e̵t̵h̵i̵n̵g̵ ̵h̵a̵p̵p̵e̵n̵s̵ ̵t̵h̵a̵t̵ ̵c̵h̵a̵n̵g̵e̵s̵ ̵t̵h̵e̵ ̵c̵u̵r̵r̵e̵n̵t̵ ̵c̵a̵r̵d̵,̵ ̵t̵h̵e̵ ̵e̵d̵i̵t̵a̵b̵l̵e̵ ̵d̵a̵t̵a̵ ̵m̵a̵y̵ ̵b̵e̵ ̵s̵i̵l̵e̵n̵t̵l̵y̵ ̵w̵r̵i̵t̵t̵e̵n̵ ̵i̵n̵ ̵t̵h̵e̵ ̵w̵r̵o̵n̵g̵ ̵c̵a̵r̵d̵,̵ ̵i̵.̵e̵.̵ ̵i̵n̵ ̵t̵h̵e̵ ̵n̵e̵w̵ ̵c̵a̵r̵d̵ ̵i̵n̵s̵t̵e̵a̵d̵ ̵o̵f̵ ̵t̵h̵e̵ ̵o̵l̵d̵ ̵c̵a̵r̵d̵.̵ ̵P̵l̵e̵a̵s̵e̵ ̵s̵e̵e̵ ̵t̵h̵e̵ ̵c̵h̵a̵n̵g̵e̵l̵o̵g̵ ̵f̵o̵r̵ ̵2̵0̵1̵9̵-̵0̵3̵-̵0̵5̵ ̵b̵e̵l̵o̵w̵.̵ ̵I̵ ̵c̵a̵n̵'̵t̵ ̵r̵e̵p̵r̵o̵d̵u̵c̵e̵ ̵i̵t̵ ̵w̵i̵t̵h̵ ̵t̵h̵e̵ ̵r̵e̵v̵i̵e̵w̵ ̵w̵i̵n̵d̵o̵w̵,̵ ̵b̵u̵t̵ ̵i̵t̵ ̵s̵t̵i̵l̵l̵ ̵m̵a̵y̵ ̵h̵a̵p̵p̵e̵n̵. Fixed 2020-01-29 Old version of the add-on contained a bug that resulted in a broken image if the edited field contained a picture. It can be fixed by following the instructions on OTHER NOTES By default, if the contenteditable field isn't active anymore, it's possible to undo the last edit by using Edit - Undo option. But if the current card has been edited and this option is enabled, it'll be impossible to Undo Review and move back to the previous card. Please edit the add-on's config file and change "undo": true to "undo": false to disable it or maybe open the cards browser and search for rated:1 (CHANGELOG 2019-01-05 Initial release 2019-01-13 Updated plain JavaScript to jQuery 2019-01-13 Added a fix to support Speed Focus Mode add-on - An experimental Anki add-on to be able to edit text in a field during review without opening the edit window.DON'T USE IT WITH CLOZE, LATEX OR AUDIO FIELDS Don't use the add-on with audio fields. The "[sound:...]" tag will be lost after editing. Don't use the add-on with cloze fields, i.e. don't change {{cloze:Text}} to {{edit:cloze:Text}}. It won't work and some data will be lost after editing, either the text inside clozes will be lost or cloze tags, and it can only be restored from the backup - https://apps.ankiweb.net/docs/manual.html#backups There's the updated, if not a completely new, version of the add-on by BlueGreenMagick with cloze support added and multiple improvements - https://ankiweb.net/shared/info/385888438 Open the Card Template and replace {{Field}} with {{edit:Field}}. This is similar to {{type:Foreign Word}} or {{hint:MyField}}. During review click on the field, edit it and click outside of it or press Esc to save it, or press Ctrl+Z to undo any changes. Press Tab or Shift+Tab to switch between different editable fields. And it looks like it's possible to use Ctrl+B (bold), Ctrl+I (italic) and Ctrl+U (underline) shortcuts too.The implementation is very simple. The addon just replaces any {{edit:Field}} with {{Field}} to make it editable. Tag "div" can be replaced with tag "span" to make it inline by updating the add-on's config file (Tools - Add-ons - Edit Field During Review - Config). The relevant post on Reddit - https://www.reddit.com/r/Anki/comments/acvx71/edit_field_during_review P̵l̵e̵a̵s̵e̵ ̵n̵o̵t̵e̵ ̵t̵h̵a̵t̵ ̵a̵s̵ ̵f̵o̵r̵ ̵n̵o̵w̵ ̵t̵h̵e̵ ̵a̵d̵d̵-̵o̵n̵ ̵i̵s̵ ̵p̵r̵e̵t̵t̵y̵ ̵d̵u̵m̵b̵ ̵a̵n̵d̵ ̵i̵f̵ ̵t̵h̵e̵ ̵e̵d̵i̵t̵a̵b̵l̵e̵ ̵f̵i̵e̵l̵d̵ ̵i̵s̵ ̵s̵t̵i̵l̵l̵ ̵a̵c̵t̵i̵v̵e̵ ̵a̵n̵d̵ ̵s̵o̵m̵e̵t̵h̵i̵n̵g̵ ̵h̵a̵p̵p̵e̵n̵s̵ ̵t̵h̵a̵t̵ ̵c̵h̵a̵n̵g̵e̵s̵ ̵t̵h̵e̵ ̵c̵u̵r̵r̵e̵n̵t̵ ̵c̵a̵r̵d̵,̵ ̵t̵h̵e̵ ̵e̵d̵i̵t̵a̵b̵l̵e̵ ̵d̵a̵t̵a̵ ̵m̵a̵y̵ ̵b̵e̵ ̵s̵i̵l̵e̵n̵t̵l̵y̵ ̵w̵r̵i̵t̵t̵e̵n̵ ̵i̵n̵ ̵t̵h̵e̵ ̵w̵r̵o̵n̵g̵ ̵c̵a̵r̵d̵,̵ ̵i̵.̵e̵.̵ ̵i̵n̵ ̵t̵h̵e̵ ̵n̵e̵w̵ ̵c̵a̵r̵d̵ ̵i̵n̵s̵t̵e̵a̵d̵ ̵o̵f̵ ̵t̵h̵e̵ ̵o̵l̵d̵ ̵c̵a̵r̵d̵.̵ ̵P̵l̵e̵a̵s̵e̵ ̵s̵e̵e̵ ̵t̵h̵e̵ ̵c̵h̵a̵n̵g̵e̵l̵o̵g̵ ̵f̵o̵r̵ ̵2̵0̵1̵9̵-̵0̵3̵-̵0̵5̵ ̵b̵e̵l̵o̵w̵.̵ ̵I̵ ̵c̵a̵n̵'̵t̵ ̵r̵e̵p̵r̵o̵d̵u̵c̵e̵ ̵i̵t̵ ̵w̵i̵t̵h̵ ̵t̵h̵e̵ ̵r̵e̵v̵i̵e̵w̵ ̵w̵i̵n̵d̵o̵w̵,̵ ̵b̵u̵t̵ ̵i̵t̵ ̵s̵t̵i̵l̵l̵ ̵m̵a̵y̵ ̵h̵a̵p̵p̵e̵n̵. Fixed 2020-01-29 Old version of the add-on contained a bug that resulted in a broken image if the edited field contained a picture. It can be fixed by following the instructions on https://ankiweb.net/shared/info/574601404 By default, if the contenteditable field isn't active anymore, it's possible to undo the last edit by using Edit - Undo option. But if the current card has been edited and this option is enabled, it'll be impossible to Undo Review and move back to the previous card. Please edit the add-on's config file and changetoto disable it or maybe open the cards browser and search for cards answered today ) and maybe sort by the "changed" column ( "changed" tracks the last time changes were made to the card (e.g., when you reviewed the card and the review history and interval were updated) ).2019-01-05 Initial release 2019-01-13 Updated plain JavaScript to jQuery 2019-01-13 Added a fix to support Speed Focus Mode add-on - https://ankiweb.net/shared/info/1046608507 2019-01-21 Added cards browser preview window 2019-01-24 Support Tags field - https://apps.ankiweb.net/docs/manual.html#special-fields 2019-02-13 Support Undo button to revert back the last edit 2019-02-26 Unescape filenames on save 2019-03-05 Disable cards browser preview window ( bug #1 bug #2 ) 2019-03-09 Added config option to disable Undo button 2019-07-02 Basic support for Anki 2.0 2020-01-29 Fix a bug when changes could have been written to a different card Nickolay

Download

As add-ons are programs downloaded from the internet, they are potentially malicious. You should only download add-ons you trust.

2.1.0-2.1.26 (updated 2020-01-30)

2.1.27+ (updated 2020-09-11) Supported Anki versions:

To download this add-on, please copy and paste the following code into Anki 2.1:

1020366288

If you were linked to this page from the internet, please open Anki on your computer, go to the Tools menu and then Add-ons>Browse & Install to paste in the code.

This add-on previously supported Anki 2.0. You can download the last version supporting 2.0 here. As Anki 2.0 has been discontinued, no support is available for this version.

All Anki 2.1.x Add-Ons Contact Author

Reviews

Great add-on! Could u pls also tweak to make it compatible with the wrap text add on? Here's the link: https://ankiweb.net/shared/info/2028179508

Thanks in advance! :)





Don`t know, if it helps you:

Caught exception:

Traceback (most recent call last):

File "aqt\webview.py", line 37, in cmd

File "aqt\webview.py", line 123, in _onCmd

File "aqt\webview.py", line 547, in _onBridgeCmd

File "<C:\Program Files (x86)\Anki\decorator.pyc:decorator-gen-34>", line 2, in linkHandler_wrapper

File "anki\hooks.py", line 638, in decorator_wrapper

File "anki\hooks.py", line 635, in repl

File "C:\Users\domin\AppData\Roaming\Anki2\addons21\385888438\reviewer.py", line 193, in myLinkHandler

saveThenRefreshFld(reviewer, note, fld, new_val)

File "C:\Users\domin\AppData\Roaming\Anki2\addons21\385888438\reviewer.py", line 153, in saveThenRefreshFld

saveField(note, fld, new_val)

File "C:\Users\domin\AppData\Roaming\Anki2\addons21\385888438\reviewer.py", line 135, in saveField

txt = Editor.mungeHTML(None, txt)

File "aqt\editor.py", line 421, in mungeHTML

File "aqt\gui_hooks.py", line 1606, in __call__

File "aqt\editor.py", line 1217, in reverse_url_quoting

AttributeError: 'NoneType' object has no attribute 'mw'



I noticed that the AssertionError is often coming, when I copy and paste something during review. I also tried the other Addon, it´s the same. Comment from author If you use 385888438, there will be no AssertionError or it will be different. I can't help with it at the moment.



I don't know when 385888438 will be updated, I'm not the author, but for now 'NoneType' object has no attribute 'mw' can be fixed by manually editing the file (Tools - Add-ons - ... - View Files) and applying similar changes (in green).



https://github.com/kelciour/edit-field-during-review/commit/d5525dc4ce9f9a35956c99bb58672b6050187b36



If you use 1020366288, i.e. this add-on, last time I updated the add-on and added the error message to the AssertionError. If it happens again, please post it here.



When you copy and paste something, do you copy it from Anki itself, i.e. from the card browser, or from your web browser? I can't seem to reproduce it.



Could you paste Help - About - Copy Debug Info?



---



I've updated the add-on and added the error message for AssertionError. Maybe it'll help to find a way to fix it.



If there's a way to reproduce it, please let me know. Excellent and fast support!Don`t know, if it helps you:Caught exception:Traceback (most recent call last):File "aqt\webview.py", line 37, in cmdFile "aqt\webview.py", line 123, in _onCmdFile "aqt\webview.py", line 547, in _onBridgeCmdFile " ", line 2, in linkHandler_wrapperFile "anki\hooks.py", line 638, in decorator_wrapperFile "anki\hooks.py", line 635, in replFile "C:\Users\domin\AppData\Roaming\Anki2\addons21\385888438\reviewer.py", line 193, in myLinkHandlersaveThenRefreshFld(reviewer, note, fld, new_val)File "C:\Users\domin\AppData\Roaming\Anki2\addons21\385888438\reviewer.py", line 153, in saveThenRefreshFldsaveField(note, fld, new_val)File "C:\Users\domin\AppData\Roaming\Anki2\addons21\385888438\reviewer.py", line 135, in saveFieldtxt = Editor.mungeHTML(None, txt)File "aqt\editor.py", line 421, in mungeHTMLFile "aqt\gui_hooks.py", line 1606, in __call__File "aqt\editor.py", line 1217, in reverse_url_quotingAttributeError: 'NoneType' object has no attribute 'mw'I noticed that the AssertionError is often coming, when I copy and paste something during review. I also tried the other Addon, it´s the same.



modify the add-on file meta.json(C:\Users\Username\AppData\Roaming\Anki2\addons21\1020366288) :"max_point_version": -26 → "max_point_version": -33，that make it compatible with 2.1.33.If any errors occurred,click the close button.You may need to modify this file every time you open anki. Comment from author Thank you. The fix was just a one line change and the add-on should work fine with 2.1.33. Use Tools - Add-ons - Check for Updates to update the add-on or maybe uninstall and install it again. great add-on.modify the add-on file meta.json(C:\Users\Username\AppData\Roaming\Anki2\addons21\1020366288) :"max_point_version": -26 → "max_point_version": -33，that make it compatible with 2.1.33.If any errors occurred,click the close button.You may need to modify this file every time you open anki.

PLEASE MAKE COMPATIBLE WITH NEWEST ANKI VERSION 2.1.33 :(



This was my favorite add on but now it is unusable.

Comment from author Thank you. It's been updated to support 2.1.33. Please update for 2.1.26+

NICE !

Can I make a word font-size bigger than text ?



F5 BIGGER SIZE !





<script>

$('[contenteditable=true]').keydown(function(e) {

if (e.keyCode == 116) {

e.preventDefault();

document.execCommand("fontSize", false, "7");

}

});

</script>

Great

Simple to use. Useful for correcting OCR mistakes and minor typing errors.

Facilita a correção

good

Can you please add ability to edit fields in Preview in Browser, too. Edits are not saved in the note. This would be suuuuupppperrr helpful :) Thank you!!!

It helps me a lot!

Works great. Ctrl + Shift + V works for me and can paste without formatting! Amazing stuff!

Works much better than the last one, Remove Formatting is something that I needed

Is it possible to bring back the 'Paste' option when I right-click, it only have the 'Copy' now

It's ok but i suggest you this one https://ankiweb.net/shared/info/385888438 that is the improved version (supports clozes, resizing images while review ecc.).

This works great.



Here's a trick if you don't like how copy-pasting looks:

Press Ctrl+Shift+V on Windows to do a paste without copying the formatting. This will get rid of any strange colors and fonts and keep it copied as plaintext.



Another trick I did was I added a little symbol or indicator on the line before my Meaning/Definition field, so I know where to click in case the box for the field is blank.

excellent, thank you.

Comment from author before post was edited Update. Please try this one instead - https://gist.github.com/kelciour/2491063a1244f6ea8e22396b170149a7

I set the color to blue ("#00f") - https://www.w3schools.com/colors/colors_picker.asp



<script>

$('[contenteditable=true]').keydown(function(e) {

if (e.ctrlKey && e.keyCode == 221) { // Ctrl + ]

e.preventDefault();

document.execCommand("insertOrderedList");

}

if (e.ctrlKey && e.keyCode == 82) { // Ctrl + R

e.preventDefault();

document.execCommand("removeFormat");

}

if (e.ctrlKey && e.shiftKey && e.keyCode == 66) { // Ctrl + Shift + B

e.preventDefault();

document.execCommand("hiliteColor", false, "#00f");

}

});

</script>

-------------------------------------------------

Thank you. Please try this one - https://gist.github.com/kelciour/77ba239f92b225c3771fe77035035a2a

It works the same way as Mini Format Pack - https://ankiweb.net/shared/info/295889520 OMG I love u. Just it.

very useful, thank you!

Works great - thanks very much. This newer version eliminated some of the conflicts I was having with the older version and ANKI 2.1.15

Really really good addon! I use it all the time

Thanks a lot!



Suggestions:

- make it compatible with Replay buttons on card addon

- make it possible to permit text edition, for example, ctrl + B or change the letter color etc. during review

- make it possible to record your own voice during review Comment from author Thank you for the suggestions! I think, Ctrl + B should work just fine out-of-the-box, to change the letter color please see 01.01.2020, i.e. edit the card template and add this script to be able to set the letter color to blue ("#00f") by pressing F7.



<script>

$('[contenteditable=true]').keydown(function(e) {

if (e.keyCode == 118) {

e.preventDefault();

document.execCommand("foreColor", false, "#00f");

}

});

</script>



Let me know if there're any problems.



About recording your own voice, thank you, I'll give it a thought once I'll add support for clozes in the add-on but as for now I'm not sure if or when it'll be implemented.



About replay buttons on card, thank you, it's something that I'd like to add in the future, but at the moment I can only suggest to try the updated version, or maybe there's nothing much left from the original add-on and it's a completely new add-on considering all the changes, by BlueGreenMagick - Edit Field During Review (Cloze) - https://ankiweb.net/shared/info/385888438 - to be able to edit a field that contains [sound:...] tags the same way as in the Edit window. Perfect.Suggestions:- make it compatible with Replay buttons on card addon- make it possible to permit text edition, for example, ctrl + B or change the letter color etc. during review- make it possible to record your own voice during review

it's very convenient, thank you.

Thank you. It saves a lot of time





everytime i am trying to edit the question field after exposing the answer it shows an error.



Edit:

Thanks for the answer, it worked! :) Comment from author before post was edited Please edit your card template and replace {{edit:FrontSide}} on the Back Template with {{FrontSide}}. thank you!everytime i am trying to edit the question field after exposing the answer it shows an error.Edit:Thanks for the answer, it worked! :)





Is there a way to exchange the mouse click with an short cut for example. I experienced an error during reviewing with my controller.

It seems that sometimes it copies the last "back" part of a card to the next one and replaces it.



cheers Comment from author Thank you for reminding me about the issue. It should be fixed now.



About the hotkeys, Tab or Shift+Tab seems to work out-of-the-box and can be used to focus the editable field and probably optionally Esc to make it lose focus and save the changes. Super nice Ad-on... using it all the time.Is there a way to exchange the mouse click with an short cut for example. I experienced an error during reviewing with my controller.It seems that sometimes it copies the last "back" part of a card to the next one and replaces it.cheers

good





Unfortunately i am not able to "undo" underline formatting.

I can underline normal text with cmd+u just fine, but then I am not able remove the underlining with cmd+u. Bolding and italic works both ways via cmd+i/b. Do you have any idea why only underline formatting works for just one direction (=adding)? (Already tried to disable all add-ons for interference purpose - did not work unfortunately)



I am running Anki 2.1.15 (Mac) and your latest add-on version. Comment from author That's strange. Does it work in the Edit window? And I'd very much recommend to create a new Anki profile and try it out with the default Basic note type. If it works in the Edit window and works with a new Anki profile, maybe it's something with the card template, maybe some CSS rules cause this behavior, or maybe the HTML, for example, if it contains some tags with the inline style attribute. Another thing to try is to take a look at the original HTML, then at the same HTML after using cmd+u to underline and at the same HTML after trying to "undo" underline formatting. Maybe it'll be different and might give some idea why it happens. Maybe some sample deck would be helpful too, if it's possible, so I could take a look at it. Fantastic add-on!! Saves so much time in the long run. Thank you so much for your work!Unfortunately i am not able to "undo" underline formatting.I can underline normal text with cmd+u just fine, but then I am not able remove the underlining with cmd+u. Bolding and italic works both ways via cmd+i/b. Do you have any idea why only underline formatting works for just one direction (=adding)? (Already tried to disable all add-ons for interference purpose - did not work unfortunately)I am running Anki 2.1.15 (Mac) and your latest add-on version.

Is it possible to configure to make the text capitalized?

Thanks!!!!

Usefull

Thank you so much for this add on, it is easily my favourite add on because I love to add edits but my computer lags every time it has to go to browse, so this add on has been a game changer.



My question was regarding if there was possibly a script I could add to be able to copy paste screenshots/images. I've added your script for removing formatting and it works beautifully, but I am still unable to copy paste images for some reason with the add on.

Comment from author Thank you. It'll definitely be added in the future. At the moment I can only suggest the updated version of the add-on by BlueGreenMagick with cloze support added - https://ankiweb.net/shared/info/385888438 Thanks a lot! Much love for this add-on, it is perfect. Cloze support, please!!!!!



unfortunately coloring(F7) doesn't work Comment from author Thank you for the feedback! At the moment I can only suggest to manually copy-paste the following code or the same code from this gist - https://gist.github.com/kelciour/08f32dd7462dfd3a68cb7a472e07cf0b - to the end of the Front Template and/or the Back Template. There's no need to add it to the Back Template if it's been already added to the Front Template and the Back Template contains {{FrontSide}}. It'll set the foreground color to blue ("#00f") by pressing F7 (118).



<script>

$('[contenteditable=true]').keydown(function(e) {

if (e.keyCode == 118) {

e.preventDefault();

document.execCommand("foreColor", false, "#00f");

}

});

</script>



1. JavaScript Event KeyCodes - https://keycode.info

2. HTML Color Picker - https://www.w3schools.com/colors/colors_picker.asp

3. Document.execCommand() - https://developer.mozilla.org/en-US/docs/Web/API/Document/execCommand great for bolding texts(CTRL+B)unfortunately coloring(F7) doesn't work

Congratulations

It's a very simple, yet a very useful add-on. Thanks!

Comment from author before post was edited Please replace {{edit:FrontSide}} in the Back Template with {{FrontSide}} to fix it.



> There are some special fields you can include in your templates:

> The content of the front template (only valid in back template): {{FrontSide}}

https://apps.ankiweb.net/docs/manual.html#specialfields thanks for the reply it worked now





1. Cannot underline text (italicizing/bolding works) - not sure if this is a universal problem for people

2. Snapshotted images cannot be directly pasted in the edit field



Otherwise, everything works splendidly and has been immensely helpful with enhancing the content of my cards. If the above problems can be solved, this would become one of, if not already, the best add-ons you can have! Comment from author Thank you! That's really great to know!



About the first issue, I'm not sure, but at the moment I can think only of two possible reasons why Ctrl+U doesn't work:



- There's another add-on with the Ctrl+U shortcut key too. Maybe try to temporarily disable all add-ons except Edit Field During Review to make sure that underline works fine with any other add-on disabled. Or let me know what add-ons do you have installed by going to Help - About - Copy Debug Info.

- Very unlikely, but there may be some JavaScript code in the card template that overrides Ctrl+U default behavior.



Or maybe as a temporary workaround add the following JavaScript code on the Front/Back Template to toggle underline, but using the different shortcut key, for example, Ctrl+Y.



<script>

$('[contenteditable=true]').keydown(function(e){

if(e.ctrlKey && e.keyCode == 89){ // Ctrl + Y - https://keycode.info

e.preventDefault();

document.execCommand("underline");

}

});

</script> Awesome add-on- I've been recommending it to all of my classmates who are hardcore ankiers. However, I've been having some issues with the addon:1. Cannot underline text (italicizing/bolding works) - not sure if this is a universal problem for people2. Snapshotted images cannot be directly pasted in the edit fieldOtherwise, everything works splendidly and has been immensely helpful with enhancing the content of my cards. If the above problems can be solved, this would become one of, if not already, the best add-ons you can have!

Great tool for editing , especially for deleting useless parts.

You are literally god, dude! This is probably the add-on I use the most and which helps me the most. My only problem with it was the styling, so I had to paste it as plain text all the time, but then I found the script in the comments and it works perfectly. One less thing to worry and a productivity boost. Thank you very much!



I have one problem though, it seems to copy the text styling /background as well-- any way to make it just paste plain text- in my card's design ?



Here's a screenshot: http://prntscr.com/pld188 - usually if I just copy-paste the text by going Edit> 'paste' it shows the definition in proper format Comment from author Maybe add the following code to the end of the front/back template - https://gist.github.com/kelciour/032afc3a467803850617a0ff38f5b0cf Excellent add-on for copy pasting definitions quickly.I have one problem though, it seems to copy the text styling /background as well-- any way to make it just paste plain text- in my card's design ?Here's a screenshot: http://prntscr.com/pld188 - usually if I just copy-paste the text by going Edit> 'paste' it shows the definition in proper format

very helpful thanks :)

Good

Comment from author Maybe next weekend or a bit later. I love this addon. Is there any news on when the update to allow cloze edits will happen?

Fantastic! I add definitions while reviewing and this addon saved me a lot of time and trouble.

Works perfectly, great time saver.

Works great.

that's very helpful! thanks dude

So helpful!!!

Thanks a lot!!!

Cracking add-on, nice one!

Terrific add-on!



There is just a drawback: when there are math formulas using LaTeX, the add-on deletes the LaTeX code and saves only the image of the formula in the field.



Thanks!

very useful!!

Extremely practical and efficient. Never again opening the editor to make laborious editions to the same field in multiple cards!

Useful add ons

Best Addon!

Revolutionary idea

Awesome. One of my Anki-life-saver.

Tip: If you have {{edit:Tags}} in your card template, you can edit card's tag while reviewing. Very handy.

It work with editing Extra in cloze cards. {{edit:extra}}. I agree it doesn't work with editing the main cloze text.

thanks

A

Cloze support, please!!!!! Much love for this add-on, it is perfect. Also, it'd be useful if clickable items (e.g., hyperlinks) worked, instead of activating the editing tool.

Amazing! Hopefully it will be functional with cloze cards too in the future

Good, it can work fine with pop up dictionary and other add-ons. But cloze support is needed since all may note cards are cloze. Sadly, whenever I edit field it during review, I cannot view my cloze

Perfect!

I often use it.

it's very convenient.

Thank you very much

Thank you so much! This is a must-have addon and saved my time so much!



Although cloze support would be good to have

Great add-on. Saved tons of time. Thanks.

Thank you

Amazing addon. One question, I'm having an issue, it seems I can't paste images into fields which are editable by adding Edit: prior to the field.

Any solutions?



有一个错误发生了.请在按住shift键的同时启动Anki，这样可以临时的忽略掉你已经安装的插件。

如果仅仅是因为插件引起的问题，请选择工具>插件菜单项来将出错的的插件设置成失效，然后重启Anki，重复以上的步骤直到你发现了具体是哪个插件引起的问题。

当你已经发现是因为插件引起的问题，请在我们的支持网站上 add-ons section 上报告问题。

调试信息

Anki 2.1.12 (eef86bf3) Python 3.6.7 Qt 5.12.1 PyQt 5.11.3

Platform: Windows 10

Flags: frz=True ao=True sv=1



Caught exception:

File "aqt\webview.py", line 27, in cmd

File "aqt\webview.py", line 85, in _onCmd

File "aqt\webview.py", line 363, in _onBridgeCmd

File "C:\Users\MyPC\AppData\Roaming\Anki2\addons21\1020366288\__init__.py", line 75, in myLinkHandler

saveField(note, fld, val)

File "C:\Users\MyPC\AppData\Roaming\Anki2\addons21\1020366288\__init__.py", line 59, in saveField

field = note[fld]

File "anki

otes.py", line 98, in __getitem__

File "anki

otes.py", line 95, in _fieldOrd

<class 'KeyError'>: 'FrontSide' Comment from author Please, replace {{edit:FrontSide}} in the Back Template with {{FrontSide}} to fix this error. 错误有一个错误发生了.请在按住shift键的同时启动Anki，这样可以临时的忽略掉你已经安装的插件。如果仅仅是因为插件引起的问题，请选择工具>插件菜单项来将出错的的插件设置成失效，然后重启Anki，重复以上的步骤直到你发现了具体是哪个插件引起的问题。当你已经发现是因为插件引起的问题，请在我们的支持网站上 add-ons section 上报告问题。调试信息Anki 2.1.12 (eef86bf3) Python 3.6.7 Qt 5.12.1 PyQt 5.11.3Platform: Windows 10Flags: frz=True ao=True sv=1Caught exception:File "aqt\webview.py", line 27, in cmdFile "aqt\webview.py", line 85, in _onCmdFile "aqt\webview.py", line 363, in _onBridgeCmdFile "C:\Users\MyPC\AppData\Roaming\Anki2\addons21\1020366288\__init__.py", line 75, in myLinkHandlersaveField(note, fld, val)File "C:\Users\MyPC\AppData\Roaming\Anki2\addons21\1020366288\__init__.py", line 59, in saveFieldfield = note[fld]File "anki

otes.py", line 98, in __getitem__File "anki

otes.py", line 95, in _fieldOrd : 'FrontSide'

best

Love it! It lowers the threshold for improving the cards. Sometimes during the learning session you're not in the mood to click "edit" and fix the card, but this add-on removes the threshold.



The only problem (big problem for image-heavy learners) is that the images that you paste during a review disappear the next time the card is shown. The card shows an empty placeholder and has the title of the image, but not the image itself.





Edited 1/12/18 - Pretty cool idea, but there is some limitations for me (maybe not for others). Instructions was confusing at first, but you just need to think about it. This add-on is not for anki user who is avoid of monkeying around with card code. Simply downloading the add-on will not get you anywhere. So you need to edit the card template card side in which you want editing (ie. "front" and "back" card). As the instruction says you need to replace {{Field}} with {{edit:Field}}. Field examples include {{Extra}}, {{Front}}, and {{Back}}. However it will NOT work on {{cloze:Text}}. Because most of my cards (80%) involve {{cloze:Text}}, it is quite unfortunate that I cannot edit on those. In addition, for my cards that involve the {{Extra}}, these cards are on card type that involve asking a bunch of questions on just one card type. Great for question making, but as a result, I need to edit every front/back within that card type. Overall, sweet idea but because of my card type organization this will not be a huge part of my studies unless I overlooked something about this add-on.



Edit 4/16/19 Been using this for a couple of months. Loving it. Problem I have been having is that I cannot move pictures around during review AND when editing outside review. In addition, it would be great, if there is a way to incorporate this addon to "cloze deletion" cards. Comment from author before post was edited Thank you for the update too! Some cloze support is on my to-do list and if everything goes well it may be added by the end of the month.



------------------------------------



It looks like you're on Anki 2.0. The add-on supports only Anki 2.1. Please upgrade to the latest version of Anki - https://apps.ankiweb.net Download failed. "Error downloading: 404"Edited 1/12/18 - Pretty cool idea, but there is some limitations for me (maybe not for others). Instructions was confusing at first, but you just need to think about it. This add-on is not for anki user who is avoid of monkeying around with card code. Simply downloading the add-on will not get you anywhere. So you need to edit the card template card side in which you want editing (ie. "front" and "back" card). As the instruction says you need to replace {{Field}} with {{edit:Field}}. Field examples include {{Extra}}, {{Front}}, and {{Back}}. However it will NOT work on {{cloze:Text}}. Because most of my cards (80%) involve {{cloze:Text}}, it is quite unfortunate that I cannot edit on those. In addition, for my cards that involve the {{Extra}}, these cards are on card type that involve asking a bunch of questions on just one card type. Great for question making, but as a result, I need to edit every front/back within that card type. Overall, sweet idea but because of my card type organization this will not be a huge part of my studies unless I overlooked something about this add-on.Edit 4/16/19 Been using this for a couple of months. Loving it. Problem I have been having is that I cannot move pictures around during review AND when editing outside review. In addition, it would be great, if there is a way to incorporate this addon to "cloze deletion" cards.

I like it very much!

Very useful

Amazing one of my favorites!!! Im a medical student and 2nd thinned for the option for adding images during review. It would make my workflow in Anki way more efficient!!! Sometimes the images will paste. I don't know why. I tried changing the code in my cards but it did not help. Im using the edit add on with the hints add on.



Update!! It seems I can only copy and paste images that are in my Evernote notebooks!! Hope this helps!!



2nd update When I go to review the card the image doesn't appear sooo... it doesn't work because the image can't be seen after you paste the image. Curious that at least the image appears as if had been paste in the reviewer

Thank you!

This add-on is awesome and essential. Thank you very much!

Could please include a shortcut key so that we can edit the images/mp3s externally, such as through Preview/Audacity? For example, pressing F10 will immediately open the audios with Audacity or images with Previews.

Medical students frequently need to edit their images when reviewing. If the add-on supports external editing for images/mp3s, it would be great!

Absolutely excellent. Thank you!

This is amazing and I am using it every day.



There is only one problem...I can't paste SOME pictures. Which sucks because I mostly learn from pictures :(



For example if I use the snip tool and attempt to paste the image it doesn't work. Nothing happens -- right clicking shows there is no "paste" option. It's as if Anki is not seeing my clipboard.



However, if I right click on a WIKI image and copy I can usually paste it right into the Anki editable reviewer screen/field no problem. This isn't universal though, some images sourced from other places with either 1) right click:copy OR 2)Ctrl+C act the same way as screen clippings -- nothing happens and the paste option is absent in Anki when I right click.



Any workarounds or suggestions would be amazing.



In any case THANK YOU!!





I am also getting the "Download failed. "Error downloading: 404"" Any tips?



i'm using a Mac. All other add-ons (including the first add=on for this tutorial are working just fine) Comment from author before post was edited It looks like you're using Anki 2.0. Unfortunately, the add-on doesn't work with it. Please install Anki 2.1 - https://apps.ankiweb.net UPDATE: Downloading v 2.1 Worked! Thanks!I am also getting the "Download failed. "Error downloading: 404"" Any tips?i'm using a Mac. All other add-ons (including the first add=on for this tutorial are working just fine)





I've lost tons of images by simply CLICKING the back of a card that contains an image. I wanted this app to work so bad, its a bummer :/



UPDATE

Oh I'm so excited to say that the developer (nice guy btw very active in helping his audience) made the problem something of the past! I would love to see an automatic fix in the near future if possible! I'm willing to donate to him for helping us out, his app has saved me TONS of time especially using Pepper/Salt decks (medschoolanki). Comment from author before post was edited Hi there! I've updated the add-on and fixed this issue and added support for undo to be able to revert back changes from the last edit. The issue wasn't serious and you still should have your pictures in your collection.media folder as long as you didn't use Tools - Check Media - Delete Unused Files. The add-on is simple and doesn't delete anything by itself. The problem was that the add-on, instead of unescaping "foo%20bar.jpg" and saving it as "foo bar.jpg", saved HTML code as it is, i.e. as "foo%20bar.jpg". It can be easily fixed by opening and closing Edit HTML window ( https://streamable.com/ksnfk ) or let me know and I'll come up with some automatic solution to fix all the pictures this way. This app is an absolutely great idea, but editing fields that contain images will result in you LOSING the image. Undo button does not work! Another user mentioned that it was tied to Speed Focus App but uninstalling the app does not fix the problem.I've lost tons of images by simply CLICKING the back of a card that contains an image. I wanted this app to work so bad, its a bummer :/UPDATEOh I'm so excited to say that the developer (nice guy btw very active in helping his audience) made the problem something of the past! I would love to see an automatic fix in the near future if possible! I'm willing to donate to him for helping us out, his app has saved me TONS of time especially using Pepper/Salt decks (medschoolanki).

Very Helpful add-on!





23/01 update: I'm getting this error after I've made my tag field editable:



Debug info:

Anki 2.1.6-beta2 Python 3.6.7 Qt 5.12.0 PyQt 5.11.3

Platform: Windows 10

Flags: frz=True ao=True sv=2



Caught exception:

File "aqt\webview.py", line 27, in cmd

File "aqt\webview.py", line 85, in _onCmd

File "aqt\webview.py", line 346, in _onBridgeCmd

File "C:\Users\David\AppData\Roaming\Anki2\addons21\1020366288\__init__.py", line 38, in myLinkHandler

reviewer.card.note()[fld] = val

File "anki

otes.py", line 101, in __setitem__

File "anki

otes.py", line 95, in _fieldOrd

<class 'KeyError'>: 'Tags'



Anki doesn't crash or anything, just the error window pops up. Any edit made to the tag field doesn't save after the error pop up. Comment from author 24.01.2019. I've updated the add-on and added basic support for {{edit:Tags}} in the card template. Please use Tools - Add-ons - Check for Updates.



------------------------------------



As of now, it's probably better to use something like this in the Styling section of your card template:



span[contenteditable="true"]:empty {

display: inline-block;

width: 100px;

}



or maybe:



span[contenteditable="true"] {

display: inline-block;

min-width: 100px;

} Please make the field editable even if it's empty when using 'span' rather than 'div' >.< (thank you for the response - that works!)23/01 update: I'm getting this error after I've made my tag field editable:Debug info:Anki 2.1.6-beta2 Python 3.6.7 Qt 5.12.0 PyQt 5.11.3Platform: Windows 10Flags: frz=True ao=True sv=2Caught exception:File "aqt\webview.py", line 27, in cmdFile "aqt\webview.py", line 85, in _onCmdFile "aqt\webview.py", line 346, in _onBridgeCmdFile "C:\Users\David\AppData\Roaming\Anki2\addons21\1020366288\__init__.py", line 38, in myLinkHandlerreviewer.card.note()[fld] = valFile "anki

otes.py", line 101, in __setitem__File "anki

otes.py", line 95, in _fieldOrd : 'Tags'Anki doesn't crash or anything, just the error window pops up. Any edit made to the tag field doesn't save after the error pop up.

Great!

Amazing! I wait this idea for a long time.

Thank you very much.





Edit: I updated my review when I realized that it wasn't necessarily your addon that caused the problems. I went back in to try and replicate the error and I realized that its a compatibility problem with another addon that I am using (Speed Focus Mode (auto-alert, auto-reveal, auto-fail)).

This is an image of the problem I am having ->https://imgur.com/a/6Ddj4eS



The problem occurs because the timer continues to run while editing (I have it set to hit again after 20 seconds). Cmd + z doesnt work in this case as it deselects the editing window and moves you along to the next card. This causes a weird issue in that it somehow dissociates that image from the card causing the above problem to occur. This doesnt seem to resolve with the Check Media or database feature (these images are all locally stored)

Another problem I noticed is that it copies the contents of the card that was being edited to the next card. I dont have an example of that as I noticed these yesterday and I fixed them already.



I want to make it clear that I do appreciate your effort in making this addon! Comment from author Thank you for the update! I've updated the add-on and added a fix to support Speed Focus Mode add-on and clear all timeouts (set to zero) if the field is selected (gains focus). It should fix the issues with Ctrl+Z and with "copies the contents of the card that was being edited to the next card".



By the look at the imgur image, I can't tell anything specific and I can't think of anything that will cause to make an image to be "deleted" from the card. If these images are all locally stored, Check Media should help with finding any missing images, but if it doesn't find any missing images, it probably can only mean that this image isn't locally stored and it's just a link to some picture on the Internet or maybe, but unlikely, it's base64 encoded image. This can be checked by using Edit HTML option from the Edit window - https://apps.ankiweb.net/docs/manual.html#features ("The last button shows more advanced features, such as editing the underlying HTML of a field").



------------------------------------



> However for some reason this deletes images from a card that already has them after you are done editing the card.



Can you provide some sample when it happens? I can't repeat it and usually it's better to use different fields for text and images.



> In addition trying to undo the action does not seem to work, as it just returns to the previous card instead of fixing the edits done to your card.



"During review click on the field, edit it and click outside of it or press Esc to save it, or press Ctrl+Z to undo any changes."

It means that Ctrl+Z only works when the field is active, it's been edited and it's still has focus. This is default behavior of contenteditable element when Ctrl+Z is pressed. When the field loses focus, its content will be saved and Ctrl+Z won't work anymore.



Please note that the add-on is experimental and very, very simple, its functionality is very basic and some new functionality may be added in the future, and my English may not be very good. Decent idea. However for some reason this deletes images from a card that already has them after you are done editing the card. In addition trying to undo the action does not seem to work, as it just returns to the previous card instead of fixing the edits done to your card.Edit: I updated my review when I realized that it wasn't necessarily your addon that caused the problems. I went back in to try and replicate the error and I realized that its a compatibility problem with another addon that I am using (Speed Focus Mode (auto-alert, auto-reveal, auto-fail)).This is an image of the problem I am having ->https://imgur.com/a/6Ddj4eSThe problem occurs because the timer continues to run while editing (I have it set to hit again after 20 seconds). Cmd + z doesnt work in this case as it deselects the editing window and moves you along to the next card. This causes a weird issue in that it somehow dissociates that image from the card causing the above problem to occur. This doesnt seem to resolve with the Check Media or database feature (these images are all locally stored)Another problem I noticed is that it copies the contents of the card that was being edited to the next card. I dont have an example of that as I noticed these yesterday and I fixed them already.I want to make it clear that I do appreciate your effort in making this addon!





"by {{Field}} I mean the name of the field in your card template, in your case it's either Front or Back field, i.e. to make, for example, Front field editable, replace {{Front}} with {{edit:Front}} in the card template.



About the cloze deletion cards, the add-on won't work with {{cloze:Text}} on the Front Template that contains some cloze deletion, but it's possible to use the add-on with {{Extra}} field, i.e. {{edit:Extra}}, on the Back Template." Comment from author Please note that pictures aren't supported (yet?) and any pictures copied from the internet browser won't work without internet connection. This can be fixed by using one of these add-ons:



Localize Media - https://ankiweb.net/shared/info/1293255374

Media Internalizer - https://ankiweb.net/shared/info/221033553 Great app that's saving me a lot of time editing Zanki cards during my step review. Basically it works for basic cards and the extra sections in cloze deletions as of now. To edit an empty field I just have to slowly go over the note with my mouse until a text cursor comes up and then I can click it and edit it. For some reason windows snippets won't copy but regular pictures copied off of an internet browser will. For those that are anki noobs like me these were instructions I got from the dev that helped me use this add on:"by {{Field}} I mean the name of the field in your card template, in your case it's either Front or Back field, i.e. to make, for example, Front field editable, replace {{Front}} with {{edit:Front}} in the card template.About the cloze deletion cards, the add-on won't work with {{cloze:Text}} on the Front Template that contains some cloze deletion, but it's possible to use the add-on with {{Extra}} field, i.e. {{edit:Extra}}, on the Back Template."

Comment from author This isn't supported by the add-on (yet?) but something like this can be done by updating the Front Template and/or the Back Template with a bit of JavaScript / jQuery code.



For example, to highlight selected text with "#fd9796" color by pressing Ctrl+H (Ctrl+72) paste the following code in your card template (the Front Template or/and the Back Template). If the Back Template contains {{FrontSide}} and the Front Template already contains the code, there's no need to add it the second time. For example, https://gist.github.com/kelciour/e33e47a73e10f9cc02c06014f34923c7



<script>

$('[contenteditable=true]').keydown(function(e){

if(e.ctrlKey && e.keyCode == 72){

e.preventDefault();

document.execCommand("HiliteColor", false, "#fd9796");

}

});

</script>



Useful links:

1. JavaScript Event KeyCodes - https://keycode.info

2. HTML Colors - https://www.w3schools.com/html/html_colors.asp

3. Is this possible to write own hotkey for content editable in HTML Jquery? - https://stackoverflow.com/a/32991862

4. Document.execCommand() - https://developer.mozilla.org/en-US/docs/Web/API/Document/execCommand It do benefit user. However, could you add shortcut for highlighting words with red? That will be perfect.

save me a lot of time THANK YOU

a brilliant idea.