BlueGreenMagick / Edit-Field-During-Review-Cloze

Code for the Anki addon Edit Field During Review Cloze
https://ankiweb.net/shared/info/385888438
Other
18 stars 3 forks source link

Adding an image during review (from clipboard/after I copied an image) does not work after I updated to Version ⁨2.1.48. #63

Closed ccont123 closed 2 years ago

ccont123 commented 3 years ago

The below checklist isn't manditory, but suggested before creating an issue.

Describe the bug What is the bug, and what behaviour did you expect instead?

To Reproduce Steps to reproduce the behavior:

  1. Go to '...'
  2. Click on '....'
  3. Scroll down to '....'
  4. See error

Screenshots If applicable, please add screenshots to help explain your problem.

Debug Info In the toolbar, go to Help > About.... In the About window, click the Copy Debug Info button at the bottom beside an 'OK' button. Please paste the contents below.

ccont123 commented 3 years ago

It either doesnt work, or it just adds the name of the image (it varies).

ccont123 commented 3 years ago

Update:

ccont123 commented 3 years ago
Anki 2.1.48 (fb07bad3) Python 3.8.6 Qt 5.14.2 PyQt 5.14.2
Platform: Mac 10.16
Flags: frz=True ao=True sv=2
Add-ons, last update check: 2021-10-09 19:15:25

===Add-ons (active)===
(add-on provided name [Add-on folder, installed at, version, is config changed])
'' ['Clickable tags v20   Anki 2120 support', 0, 'None', '']
'' ['popup_dictionary', 0, 'None', mod]
'' ['put_ALL_due_learning_cards_first', 0, 'None', '']
AMBOSS Official  Medical School Step  Shelf Study Resource ['1044112126', 2021-09-18T17:04, 'None', mod]
Add Hyperlink ['318752047', 2021-07-10T11:40, 'None', '']
Additional Card Fields Fork for 21 ['744725736', 2021-09-18T17:03, 'None', mod]
Anki Simulator ['817108664', 2021-09-18T17:03, 'None', '']
Anki Speed Limit ['395996975', 2021-10-07T09:27, 'None', '']
Anki Zoom ['538879081', 2020-04-03T17:20, 'v1.1.3', mod]
AnkiConnect ['2055492159', 2021-10-06T23:02, 'None', '']
Batch Editing ['291119185', 2020-10-20T08:19, 'None', '']
Browser Resizer ['1435775540', 2021-08-01T14:11, 'None', '']
Browser TableEditor side-by-side horizontal split ['831846358', 2021-05-27T09:47, 'None', mod]
Convert Subdecks to Tag Hierarchy ['1172858842', 2020-02-23T14:03, 'None', '']
Create Filtered Deck from the Browser ['861263371', 2019-03-01T19:14, 'None', '']
Custom Background Image and Gear Icon ['1210908941', 2021-08-19T18:20, 'None', mod]
Custom Styles font color background colour classes ['1899278645', 2021-03-02T16:41, 'None', '']
Customize Keyboard Shortcuts ['24411424', 2021-10-07T09:18, 'None', mod]
Edit Field During Review Cloze ['385888438', 2021-07-30T22:57, '6.7', mod]
Extended Card Stats During Review ['1008566916', 2017-08-29T11:59, 'None', '']
Extended Tag AddEdit Dialog ['1135507717', 2021-09-18T17:02, 'None', mod]
Free Weekend - or Any Other Day ['742185195', 2020-04-10T04:57, 'None', mod]
Frozen Fields ['516643804', 2020-02-29T20:12, 'None', '']
Hierarchical Tags 2 ['594329229', 2021-09-18T17:03, 'None', '']
Highlight Search Results in the Browser ['225180905', 2021-09-18T17:02, 'None', '']
Hint Hotkeys ['1844908621', 2019-02-26T10:58, 'None', '']
Image Occlusion Enhanced for Anki 21 alpha ['1374772155', 2020-08-09T14:00, 'None', '']
Image Style Editor ['1593969147', 2021-09-18T17:02, 'None', mod]
ImageResizer ['1214357311', 2021-09-18T17:02, 'None', '']
Improved Quizlet to Anki 21 Importer ['538351043', 2020-11-14T18:16, 'None', '']
Learning Step and Review Interval Retention ['1949865265', 2021-09-18T17:02, 'None', '']
More Decks Stats and Time Left ['1556734708', 2021-09-18T17:02, 'None', mod]
More Overview Stats 21 ['738807903', 2021-07-30T12:13, 'None', mod]
More Overview Stats ['2116130837', 2021-05-29T04:24, 'None', '']
Placeholder - The KING of Study Timers ignore this  do NOT download this now ['907028815', 2020-04-25T12:57, 'None', '']
Progress Bar ['2091361802', 2019-03-02T18:27, 'None', '']
Quick Colour Changing ['2491935955', 2021-01-24T20:41, 'None', mod]
Rebuild All  Empty All for Anki 21 ['1810938259', 2018-07-19T21:40, 'None', '']
Refocus Card when Reviewing 21 ['1642550423', 2019-03-04T10:20, 'None', '']
Resize images in editor ['1103084694', 2021-07-18T23:35, 'None', mod]
Review Heatmap ['review_heatmap', 2020-04-30T06:23, 'None', '']
Speed Focus Mode auto-alert auto-reveal auto-fail/good ['1046608507', 2019-06-02T02:11, 'None', '']
Symbols As You Type ['2040501954', 2021-09-18T17:02, 'None', '']
Symbols ['1461102936', 2019-04-23T06:37, 'None', mod]
The KING of Button Add-ons ['374005964', 2020-04-17T15:33, 'None', mod]
add-on dialog searchfilter bar ['561945101', 2020-08-09T14:00, 'None', '']

===IDs of active AnkiWeb add-ons===
1008566916 1044112126 1046608507 1103084694 1135507717 1172858842 1210908941 1214357311 1374772155 1435775540 1461102936 1556734708 1593969147 1642550423 1810938259 1844908621 1899278645 1949865265 2040501954 2055492159 2091361802 2116130837 225180905 24411424 2491935955 291119185 318752047 374005964 385888438 395996975 516643804 538351043 538879081 561945101 594329229 738807903 742185195 744725736 817108664 831846358 861263371 907028815

===Add-ons (inactive)===
(add-on provided name [Add-on folder, installed at, version, is config changed])
Customize Sidebar ['1988760596', 2020-01-16T14:12, 'None', mod]
Legacy ReMemorize ['323586997', 2021-09-18T17:03, 'None', mod]
Pokemanki ['633922407', 2021-02-24T10:49, 'None', '']
ccont123 commented 3 years ago

any idea on how to fix the issue?

BlueGreenMagick commented 3 years ago

I can't reproduce this on my Windows v2.1.48, so I suspect it's just that specific image, or that specific way of copy-pasting image, or macOS related.

If you have the time for it, can you try editing the source file global_card.js and search for this part:

  const handlePaste = function (e) {
    if (!EFDRC.CONF.process_paste) {
      return
    }
    const mimetype = ['text/html', 'image/', 'video/', 'audio/', 'application/']
    const paste = (e.clipboardData || window.clipboardData)
    for (let x = 0; x < paste.types.length; x++) {
      const mtype = paste.types[x]
      let toSend = false
      for (let y = 0; y < mimetype.length; y++) {
        if (mtype.indexOf(mimetype[y]) !== -1) {
          toSend = true
          break
        }
      }
      if (toSend) {
        e.preventDefault()
        window.pycmd('EFDRC!paste') // python code accesses clipboard
        break
      }
    }
  }

and change the entire part to below and see if that fixes the image paste bug?

  const handlePaste = function (e) {
    if (!EFDRC.CONF.process_paste) {
      return
    }
    e.preventDefault()
    e.stopPropagation()
    window.pycmd('EFDRC!paste')
  }

You can find the file by going to Anki > Tools > Add-ons > Select this add-on > View Files > Web folder > global_card.js file. Just open the file in a text editor and search for const handlePaste

ballin4dapandas commented 2 years ago

similar issue - I can't paste screenshots in the editor but I used to be able to. I can only paste copied images, but when I try to use windows+shift+s and paste, nothing occurs.

ccont123 commented 2 years ago

I was never able to solve it, but I did notice that as long as I am pasting something immediately after the text it works.

For example, if I paste a picture after the word "girl" :

Hope this helps and hopefully we can get this problem fixed!

IMGHandover commented 2 years ago

Adding

https://paste.pics/19bdf85edb9dd521b3328455d9887664

to my back template fixed it when trying to paste pictures into the extra field. Hopefully that helps figure out cause/solution.

BlueGreenMagick commented 2 years ago

I believe I found the issue and fixed it! The fixed version should be uploaded to AnkiWeb within this week after some testing.

BlueGreenMagick commented 2 years ago

The new version with the fix was uploaded