Comments (3)
Thanks for this report. I didn't properly test this when I released the add-on. So the add-on that is published on Ankiweb also for me has the problem that changes aren't uploaded to ankiweb if between syncs I only change the _editor_button_styles.css
file from my config dialog.
I just added a change and tested it with with Anki 2.1.15 (flatpak) on linux and the latest ankidroid from the playstore. I copied from the linked Refresh Media References to the end of my function updateConfig this code:
media_dir = mw.col.media.dir()
fpath = os.path.join(media_dir, "syncdummy.txt")
if not os.path.isfile(fpath):
with open(fpath, "w") as f:
f.write("anki sync dummy")
os.remove(fpath)
(I haven't uploaded this change to github yet).
This still seems to be the official solution to trigger an update of the media dir, see this line in media.py?
With this updated code in my setup changes to _editor_button_styles.css
seem to be synced to my ankidroid: Between syncs the only thing I changed was one color in my add-on config. So glutanimate's code seems to fix the sync problem for me.
But you write "However it doesn't work on 2.1". So I assume that changes to my css file are not synced between your computer and your ios device? I'll have to read up on this and try to get an ios device.
Updating the styling is not directly visible in all parts of Anki on the desktop. That's why I have the showInfo function that reminds a user to restart Anki. Actually the reviewer uses the most recent styling if you reload the reviewer, e.g. by going to the main screen and back to reviews. But I was too lazy to do something for the editor. I only modify the Editor class when you start Anki (see here). Fixing this would require more work since other add-ons also modify editor._html. So it's not about clearing a cache. (P.S. to clear the webengine cache I use editor.web.page().profile().clearHttpCache() in my "OpenInExternalEditor" add-on). But I guess your report didn't refer to this.
You already made the add-on much better. I'm looking forward to merging your other enhancements/improvements (see #4). Thanks for your help.
from anki__editor__apply__font_color__background_color__custom_class__custom_style.
I just tried with an old ios device running ios9.
In my Ankimobile version I sync from the deck list screen. After a sync I click on a deck and start reviewing. Then the updated stylesheet is not applied as you described.
If after a sync I force close ankimobile and reopen it then the proper stylesheet is loaded. I don't see anything else I can do? Apparently ankimobile reuses the same webview longer.
Does force close and reopen Ankimobile also help on your more modern ios device with a more recent Ankimobile?
Do you have a better idea than mentioning this workaround in the manual?
With "force close" I mean: double click the home button, then swipe up on the app's preview
from anki__editor__apply__font_color__background_color__custom_class__custom_style.
Just tested it. Works now without any hiccups.
from anki__editor__apply__font_color__background_color__custom_class__custom_style.
Related Issues (20)
- ankiweb: raise minimum version required to 2.1.28 HOT 1
- Feature requests: Custom HTML wrapping HOT 1
- Sorting Entries
- 少了文件?
- Improvement in the backcolor category
- broken in 2.1.41 HOT 5
- 2.1.41+ night-mode css not applied in editor HOT 3
- Text Wrapping function malfunctions when wrapping string contains quotation marks. HOT 1
- 2.1.41+ wrong colors in editor and in actual card HOT 2
- Simplifying the context menu - just an idea.
- Selection of multiple lines not recognised when disabling entries in options
- Add option to disable the dialog asking to auto update templates HOT 1
- Feature Request: Placeholder for text under selection
- Changing font family?
- shorten the red box? HOT 2
- clear formatting: It doesn't work
- broken in 2.1.50 (Attribute error, ...) HOT 8
- Change "class" name on all previously produced cards. HOT 2
- css not loaded into the editor in 2.1.60 (and presumably .55+) HOT 6
- shortcuts don't apply the setting(class, style, ...) intended
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from anki__editor__apply__font_color__background_color__custom_class__custom_style.