Giter Site home page Giter Site logo

Media references are not refreshed upon restart about anki__editor__apply__font_color__background_color__custom_class__custom_style HOT 3 CLOSED

ijgnd avatar ijgnd commented on July 18, 2024
Media references are not refreshed upon restart

from anki__editor__apply__font_color__background_color__custom_class__custom_style.

Comments (3)

ijgnd avatar ijgnd commented on July 18, 2024

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.

ijgnd avatar ijgnd commented on July 18, 2024

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.

hgiesel avatar hgiesel commented on July 18, 2024

Just tested it. Works now without any hiccups.

from anki__editor__apply__font_color__background_color__custom_class__custom_style.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.