wagtail-localize icon indicating copy to clipboard operation
wagtail-localize copied to clipboard

`extract_strings` treats custom Draftail inline styles as blocks

Open tognee opened this issue 1 year ago • 1 comments

Currently the list of inline tags is hardcoded: https://github.com/wagtail/wagtail-localize/blob/main/wagtail_localize/strings.py#L9

This won't work when adding InlineStyleFeature using the register_rich_text_features wagtail hook. Adding for example a generic inline style with a span will break it up as different string as if it was a block tag.

The best solution would be to retrieve the features from the richtext instance and follow all the InlineStyleFeature tags and attributes defined.

tognee avatar Feb 19 '24 09:02 tognee

@tognee it makes sense. I would make it so we the list is additive. That is, we start with our set list, and add anything in InlineStyleFeature

If you have the time, please do submit a PR. Will happily review

zerolab avatar Feb 19 '24 10:02 zerolab