I have a custom made suggestion system on my site that shows you a colored diff to the original text. I just append it to the comment form per JavaScript. This works, albeit the the auto formatting causes some inconsistencies.
Anyway, there are two major problems. The first one, as in the title, is that the <ins> and <del> tags are filtered out. Which baffles me since they are content tags that do no harm. I need to mark the inserted and deleted texts. Right now, I misappropriate the sup/sub tags for that and add a class to style them as I like.
Which leads me to the second problem. When you edit the comment, the CSS classes get stripped and the whole formatting is gone. I either would like for that not to happen or allow more content tags I can safely use.
Hi @tetrakern
Read this doc please - https://wpdiscuz.com/docs/codex/filters/wpdiscuz_allowedtags/
You can add custom tags with its attributes using the hook provided in this doc.
Unfortunately, this doesn't work. Provided I did it right.
add_filter( "wpdiscuz_allowedtags", function ( $allowedtags ) { $allowedtags["ins"] = true; $allowedtags["del"] = true; return $allowedtags; });
The visual editor will reject or rather vandalize the appended HTML, remove all tags including their content and only leave a plain block. I didn't test it for the non-visual editor but that's not what I want to use. I think the Quill Editor does not care for the allowed tags by this filter.
Thank you for the effort; seems to be more involved than one might expect. Unfortunately, it still doesn't work. The ql-editor still sanitizes the tags away -- I could not test if they are saved and loaded, obviously.
I did clear all caches I could think of, deactivated any plugins like WP Super Cache and Autoptimize to be sure, turned wpDiscuz off and on, cleared the browser data, hard reloaded, used a different browser, used a different computer, used a different WordPress installation on a live test server.
I'm to 99% sure it was not a caching issue.
It is inside the functions.php and I did test it for <del> and <ins>. After all, that's how the diff-match-patch script works.
What the script is trying to append:
What appears:
I also get "Uncaught ReferenceError: Quill is not defined". This might be the issue.
Yep, I think I found the error. It's Autoptimize that aggregates all scripts and apparently causes the script to be executed before it is ready. Or whatever. I turned it off before and it changed nothing, but oh well. I'll find a solution for that myself. Thanks for the help.
For those who might encounter a similar problem with the plugin: add "wp-content/plugins/wpdiscuz" to the "Exclude scripts from Autoptimize" list.