Open Mte90 opened 5 months ago
I am working on a fix to avoid a new app execution.
This solution, trying to combine the case in which the hook for the ReactJS plugin does not exist with the case in which it does exist is overcomplicated. If you need the JavaScript plugin to be loaded when certain conditions are met, you could inject the plugin then instead.
Covering the two cases makes the code difficult to understand, specially when it is not documented. I appreciate your willing to help extend the functionality of this application. I thank you for that. But frontend-wise, it's much cleaner to fork the project and build the frontend plugin the way you want it apart. The backend code won't change much since it is stable since very long ago.
For an extended explanation on why I don't want to over complicate the frontend code, please read my comment in the PR #420.
Thank you again.
Inject the plugin is not an easy task as depends on how the UI is built, instead in this way the library itself monitor for new stuff in the DOM and supports also this way to load the options.
I can document it better if this is the problem. I understand your issue to not overcomplicate the frontende code but looking at the tickets and the project history (to develop a new UI) those changes are tiny workaround that let's to get everything without to wait for a new one.
Ref: https://github.com/danirus/django-comments-xtd/issues/418
So this PR implements:
window.comments_props
is not defined or if thecomments
div not exists.comments
class, not just the IDmutationObserver
in this way the new comments can be added in the page as you want on the flyThis requires some updates to the documentation: