for the contents of the fields anki uses html. you have the content and some invisible styling information like “show lines/borders” but also things like font, font size, text color, background color etc. you can see this by e.g. using https://ankiweb.net/shared/info/1765712663 and then have a look at the html source code. But this add-on is not a solution for you. don’t use it on regular basis:
The editor my addon bundles as well as the anki editor remove a lot of this invisible styling information as it can lead to all kind of problems, e.g. when switching to night mode you really don’t want to have invisible styling that sais “the font must always be black”. The creators have to make one solution for all users and this solution won’t fit all users … I don’t want to change this because I think the default behavior is probably better for most users.
Maybe you can re-add the styling manually? In my addon select all cells in your table, right click this selection and then check the properties.
If you want to have visible lines/borders on all your tables: you could use css in your card template, see Styling & HTML - Anki Manual
I guess today with chatgpt etc. you could also get a custom add-on that reads you clipboard, processes the html but keeps only the fact that the lines/borders should be visible.
Thank you so much for this add-on, it is hands downs the best add-on out there.
Kind of echoing what @jason-scott mentioned, I would love to set my default table style so that all tables are center-aligned, has minimal cell padding, and has black solid borders. If you would please share some insight on how to do this (e.g. by adding the _tinymce_custom.css file), I would so greatly appreciate it!
@ijgnd please help, i have a test in a couple days! i am unable to edit existing/already made tables with this add-on. it keeps saying no field focussed… aborting.
click into the field that you want to edit and enter a word like “test”. Then click the icon of my addon or use your shortcut. Does this help?
if you use the shortcut: change the default shortcut to another one. I’m not sure if the default shortcut ctrl+0 works in the latest version, I’ll have to check next weekend
if it still doesn’t work: disable all other addons, restart anki and try again: does it work now
if it does find out the conflicting add-on by using this approach, Troubleshooting - Anki Manual "If the problem goes away, that indicates an add-on is causing the problem. Remove any add-ons you don’t need, and disable half of the others. If the problem continues, try the other half. Repeat the process until you’ve figured out which add-on is causing the problem. Then please report the issue to the add-on author, using the Copy Debug Info button, and pasting that into the report.: "
if it still doesn’t work: which anki version do you use, which os, do you also have this problem with other notes, when did you first notice this problem, …
to change the shortcut for the addon: after adjusting the addon settings restart anki to be sure the change is applied (though usually it’s enough to just close and reopen all browser, add, edit, windows)
When you click the Save button, the iframe block is deleted. But you can paste the iframe block code into the field yourself and everything will work. So there is no certainty that this add-on will not delete something else. Is it possible to somehow allow all types of blocks?
thansk for the report. So basically the problem is that my addon in some narrow cases drastically changes the contents of a field (i.e. by removing an infrme). I’ll try to look into this soon to find out where we “lose” the iframe …
In dialog.py if you change the code:
js_editor_out = self.web.sync_execJavaScript(self.js_save_command)
ok = askUser(js_editor_out)
Then it will show it without changes. Even if you put it in a comment !== the code will pass.
Then there is a call
self.editor.edited_field_content =
I don't understand these codes well here, but it seems that Anki is already responsible for this.
In Anki, the editor.py file has the line
removeTags = ["script", "iframe", "object", "style"]
in the config of my addon set use Anki's built-in html processing to false.
Explanation: this option processes the field content as if you had just pasted it into anki. The idea was that when you past into my external editor window the pasted code is not processed as if anki would process it if you pasted the content directly into the build-in add or browser window. And not processing pasted content like this might lead to all kind of strange problems later. At some point I could move this processing logic into the external editor so that it only runs if the user actually pastes something but that should be more complicated.
I couldn’t find where it is. Well, okay, I use “extended html editor” https://ankiweb.net/shared/info/1043915942 and it adds it. I really didn’t understand how to do it and the hint from GROC didn’t really help. Well, I made a replacement of iframe to iframe2 and a message about it so that I could change it manually… and iframe2 to iframe for subsequent changes. At least I’ll somehow get around it if there is an iframe
the hint from Groc was not totally off because my addon by default runs the line it cited and by adjusting the addon setting as described earlier you can prevent my addon from running this line from the anki code.
general point: after adjusting addon settings the only way to be sure that they are actually applied (and not still the old ones) is to restart anki. admittedly in many cases for many addons that’s not always necessary but that’s useful to keep in mind when you are running into problems in anki any you’are not sure if changing addon settings helps or not.
I constantly close the anki and open them again, because the python is cached. About save and ok, I compared the code in one and in the other add-on, but of course I couldn’t figure out what was happening and how to solve it. There is no point in writing to the developers, and I don’t have time to study everything myself, I’ll do it as is, because I don’t really use iframes, but only give a link to YouTube and below the frame itself shows it. This is literally in several cards, because I noticed that these iframes slow down the loading of the card display. Thank you.
I rechecked and noticed that I forgot to upload the new version I referred to (if I only had more time or maybe I should maintain fewer addons in my free time… ). So my suggestion couldn’t work for you. I’ll upload this on the weekend. So thanks
Is it possible to make it so that the columns can auto-adjust it’s width to the lowest possible width needed for the text to fit in a single line? The columns take up the width of entire screen and the only way I have been able to adjust the width is my manually dragging the border.
I don’t know a solution at the moment. But for the next versions I plan to add some commands that control the widht of the tables/columns. But finding time besides family and work obligations is a problem so I don’t know when I can publish this new version