# Edit Field During Review Cloze add-on deleting images

**URL:** <https://forums.ankiweb.net/t/edit-field-during-review-cloze-add-on-deleting-images/3703>\
**Category:** Add-ons\
**Created:** [September 25, 2020, 5:25pm UTC](https://forums.ankiweb.net/t/edit-field-during-review-cloze-add-on-deleting-images/3703 "2020-09-25T17:25:42Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![NickFlint](https://sea2.discourse-cdn.com/flex002/user_avatar/forums.ankiweb.net/nickflint/32/35471_2.png) [@NickFlint](https://forums.ankiweb.net/u/NickFlint)\
**Post date:** [September 25, 2020, 5:25pm UTC](https://forums.ankiweb.net/t/edit-field-during-review-cloze-add-on-deleting-images/3703/1 "2020-09-25T17:25:42Z")

</div>

@dae it appears an issue was introduced into this add-on beginning in Anki 2.1.29 or 30. I have been unable to get ahold of @BlueGreenMagick and figured I would at least mention this to you in case it is a simple fix within anki’s code rather than the add-on code. Perhaps someone else could help diagnose and fix the issue?

I shared on github [here](https://github.com/BlueGreenMagick/Edit-Field-During-Review-Cloze/issues/36)

Error:

```auto
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 "</Applications/Anki.app/Contents/MacOS/decorator.pyc:decorator-gen-152>", line 2, in linkHandler_wrapper
  File "anki/hooks.py", line 638, in decorator_wrapper
  File "anki/hooks.py", line 635, in repl
  File "/Users/Nick/Library/Application Support/Anki2/addons21/popup_dictionary/main.py", line 216, in linkHandler
    return _old(self, url)
  File "</Applications/Anki.app/Contents/MacOS/decorator.pyc:decorator-gen-86>", line 2, in linkHandler_wrapper
  File "anki/hooks.py", line 638, in decorator_wrapper
  File "anki/hooks.py", line 635, in repl
  File "/Users/Nick/Library/Application Support/Anki2/addons21/385888438/reviewer.py", line 193, in myLinkHandler
    saveThenRefreshFld(reviewer, note, fld, new_val)
  File "/Users/Nick/Library/Application Support/Anki2/addons21/385888438/reviewer.py", line 153, in saveThenRefreshFld
    saveField(note, fld, new_val)
  File "/Users/Nick/Library/Application Support/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'

```

---

<div class="post-metadata">

**Author:** ![hkr](https://avatars.discourse-cdn.com/v4/letter/h/c6cbf5/32.png) [@hkr](https://forums.ankiweb.net/u/hkr)\
**Post date:** [September 25, 2020, 7:01pm UTC](https://forums.ankiweb.net/t/edit-field-during-review-cloze-add-on-deleting-images/3703/2 "2020-09-25T19:01:55Z")

</div>

I just tried changing [this line](https://github.com/BlueGreenMagick/Edit-Field-During-Review-Cloze/blob/5b48455267ceb67886c070792beccccfc1d3dc77/edit_field_during_review_cloze/reviewer.py#L135) as follows, and it seems to work on Ver 2.1.34, though I haven’t tested it enough.

```python
# txt = Editor.mungeHTML(None, txt)
dummy_editor = type("", (), {})() # create an empty object
dummy_editor.mw = mw
txt = Editor.mungeHTML(dummy_editor, txt)

```

---

<div class="post-metadata">

**Author:** ![NickFlint](https://sea2.discourse-cdn.com/flex002/user_avatar/forums.ankiweb.net/nickflint/32/35471_2.png) [@NickFlint](https://forums.ankiweb.net/u/NickFlint)\
**Post date:** [September 25, 2020, 7:15pm UTC](https://forums.ankiweb.net/t/edit-field-during-review-cloze-add-on-deleting-images/3703/3 "2020-09-25T19:15:29Z")

</div>

That seems to solve the issue! Would you mind creating a PR for @BlueGreenMagick? If you don’t have time I can do it this weekend! Thanks!!

---

<div class="post-metadata">

**Author:** ![hkr](https://avatars.discourse-cdn.com/v4/letter/h/c6cbf5/32.png) [@hkr](https://forums.ankiweb.net/u/hkr)\
**Post date:** [September 25, 2020, 7:41pm UTC](https://forums.ankiweb.net/t/edit-field-during-review-cloze-add-on-deleting-images/3703/4 "2020-09-25T19:41:21Z")

</div>

OK, I will send a PR in a day or two.

Edit: I’ve just send a PR to the repo.

> <https://github.com/BlueGreenMagick/Edit-Field-During-Review-Cloze/pull/37>
