ijgnd / anki__preview_card_edit_note_in_extra_window_linked_from_reviewer

0 stars 1 forks source link

点击链接预览时,如果能返回正面卡更好! #1

Closed wangcb80 closed 4 years ago

wangcb80 commented 5 years ago

最好在配置里给我们选择预览正面卡或反面卡的权利!另:链接在某些笔记类型中能产生,但点击无反应,如安装了此插件所生产的笔记类型中:https://ankiweb.net/shared/info/935264945

真的很感谢你花时间开发出这么好的插件,谢谢你!

ijgnd commented 5 years ago

Thanks for your report.

I just published this comment to Ankiweb:

The latest version can also show just the question of linked cards - so that you can show your IR cards that are made from the IR3 note type in a preview window.

But it doesn't work the other way: You can't have clickable hyperlinks in your IR cards themselves. The IR add-on overwrites built-in functions from Anki that my add-on relies on. That's a problem of the IR add-on that also breaks other add-ons like "Pop-up Dictionary". The next version of the IR add-on should fix this (see this commit: https://github.com/luoliyan/incremental-reading/commit/7901a43b6d64a87d06af834a2ad90cb54c2d6c4b#diff-99cc40076232bade658c8123c4d6e01a) . But this hasn't been released to Ankiweb yet.

In the meantime a workaround might be to use the add-on "Modified reviewer context menu search with browser search" so that at least you can open these cards/notes in the browser from your IR cards.

wangcb80 commented 5 years ago

更新你的最新版本,已经可以了,非常感谢! 另我突发奇想,是否可以链接到卡片中的指定段落。这对于增量阅读是有帮助的。在看增量阅读的笔记时,通常需要返回原始卡的指定段落中。

ijgnd commented 5 years ago

That would be really useful.

When you open a card in an extra window it shouldn't be too hard to create some code that jumps to a position that has a unique ID.

The problem is getting this unique ID into the card/note in the first place.

It's complicated because you use the IR add-on. The IR add-on allows to edit text during reviews which you normally don't do in Anki. Editing text in the reviewer is made possible by special code in the IR add-on. As far as I see the solution must be in the IR add-on. But I don't know the code of this add-on.

Processing texts from within Anki is becoming more popular. Maybe in the coming months someone will release a solution?

wangcb80 commented 5 years ago

我今天发现一个新的问题,我有的卡片ID是15位数字,而你这个插件只能识别13位。如通过插件中的“copy cid”,我得到了这样一串数字:“153318030657773”,而生成的链接只涵盖了前13位,这导致当我点击链接时,反馈的是“153318030657773卡片不存在”。

ijgnd commented 5 years ago

strange.

The cid 153318030657773 corresponds to the year 6828 ...

a card.id = cid should always 13 digits, see https://github.com/dae/anki/blob/master/anki/cards.py#L34 and from there go to https://github.com/dae/anki/blob/master/anki/utils.py#L220 and https://github.com/dae/anki/blob/master/anki/utils.py#L31 .

Share a screenshot of the "Info" window for the card that gives you the id 153318030657773. I mean the window you see after you right click the card in the browser table and then select "info" from the context menu.

wangcb80 commented 5 years ago

当我试图显示此卡的“Info”时,它显示了错误。错误如下: image

如果图片不能显示,错误信息如下:    调试信息    Anki 2.1.15 (442df9d6) Python 3.6.7 Qt 5.12.1 PyQt 5.11.3    Platform: Windows 7    Flags: frz=True ao=True sv=1

   Caught exception:   File "aqt\browser.py", line 1127, in showCardInfo   File "aqt\browser.py", line 1153, in _cardInfoData   File "anki\stats.py", line 27, in report   File "anki\stats.py", line 76, in date   <class 'OSError'>: [Errno 22] Invalid argument

虽然产生了错误,这张卡片的ID是存在的,卡片也是可以使用的。

ijgnd commented 5 years ago

Something is wrong in your database. Some parts of Anki can handle this problem, other parts can't. So you just sometimes see an error message.

My add-on doesn't modify the card id. So this must have be caused by something different. Maybe you even imported this bad cid from a shared deck.

I would do https://anki.tenderapp.com/kb/problems/when-problems-occur

Does a database check remove this error?

wangcb80 commented 5 years ago

无论是检查数据库,还是暂停所有的插件加载项,都不能解决这个错误。我的笔记拥有多个模板,每个模板通过字段有无内容来生成新的卡片,这个新生成的卡片就会产生这样的错误;奇怪的是,笔记中首次生成的卡片是正常的,后期通过控制字段的内容而新生成的卡片,当需要显示卡片信息时,就会显示错误。但这并不影响我使用它。

ijgnd commented 5 years ago

If you can't open the card info window from the browser without any add-ons something is broken in your database and this might cause more problems in the long run. Maybe ask in the official forum at help.ankiweb.net about this card-id and the browser. This is not about my add-on.

So far I have never seen 15 digit cids and I don't want to adjust my add-on for this because this might cause other problems in other cases.

You could adjust your copy of the add-on on your computer: maybe change cidd\\d{13} to something like cidd\\d{13,15}, see https://github.com/ijgnd/anki__preview_card_edit_note_in_extra_window_linked_from_reviewer/blob/master/src/reviewer.py#L63 and some lines below for nidd

wangcb80 commented 5 years ago

感谢您! 运行加载项的副本我已经解决了问题;卡片信息错误的提示,我也已经提交了anki平台,地址如下:https://anki.tenderapp.com/discussions/ankidesktop/37337-7437282ba5c64a4f324a8df779d0e349aa7d03a7

再次感谢您!祝您生活愉快!