Skip to content

Changing CSS in a note model doesn't propagate (to other devices) after import #237

Description

@aplaice

When only the CSS is changed in a note model (in a deck.json), then after an import this change is not propagated to AnkiWeb and other devices.

To reproduce:

  1. Import a CrowdAnki deck.
  2. Sync to AnkiWeb.
  3. In the deck.json for the deck, change the CSS (.note_models.[].css) for one of the note models.
  4. Import the CrowdAnki deck again.
  5. Sync to AnkiWeb again.
  6. In another Anki instance (e.g. other profile/other computer) sync to AnkiWeb and check the CSS for that note model.

(Step 6 is needed because AFAICT AnkiWeb doesn't show the raw CSS. (I'm not 100% sure if the CSS is applied in AnkiWeb — if it is and the CSS change is clearly visible you can probably check visually (I had changed padding which didn't really show up).)

Expected behaviour:

The CSS change is applied locally (in Anki) and is synced to AnkiWeb/other devices.

Actual behaviour:

The CSS change is applied locally (in Anki), but is not synced elsewhere.

Diagnosis

https://github.com/Stvad/CrowdAnki/blob/master/crowd_anki/representation/note_model.py#L29

        field_names = ("flds", "tmpls")

should probably be:

        field_names = ("flds", "tmpls", "css")

NB This is unrelated to #236 — the bug is present both before and after applying #236.

(Changing, say the front/back templates does require a full sync and hence does propagate.)

Aside: it seems that Anki itself now doesn't require a full sync after changing templates and/or CSS (within Anki itself), and the changes do propagate as expected. Maybe we should copy what Anki does both for CSS and templates? (For fields a full sync likely still makes sense (?).)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions