torchbox / wagtail-footnotes

MIT License
20 stars 18 forks source link

Page/RichText Footnote Validation #17

Open CamLamb opened 3 years ago

CamLamb commented 3 years ago

Draftail allows copying and pasting of text from one instance to another. If I copy text containing a footnote reference from one page to another, there won't be a footnote related to that page to display.

Current Behaviour: The page saves fine and renders with no errors. However, there is an unlinked footnote reference in the page as there isn't a related footnote to link to.

Expected Behaviour: On save, a validation error is raised that informs the user that there is an invalid footnote in the RichText.

Current thoughts on how to fix: I think this is going to need a Mixin that people can add to their Page models. The mixin will define the validation logic for the footnotes.

zerolab commented 3 years ago

One way around it is to keep track of the references on the page and probably drop on paste. Could the footnotes be re-used? i.e. create/edit in one place, update everywhere. This would allow re-use, including copy/paste

CamLamb commented 3 years ago

Reusing footnotes across multiple pages is something that has crossed my mind a few times, but I feel like this could get out of control quite quickly depending on the number of footnotes a website has. Things that would need to be REALLY good would be:

benjaoming commented 2 years ago

It's too complex to reuse Footnotes IMHO. We run into a complex issue where if the footnote is edited on one page, the consequences on another page reusing the same footnote are undefined and need to be resolved by the user through additional UI.