Description of issue or problem I’m having:
I am pasting in some HTML content to be displayed on the home page, however the TinyMCE editor is stripping out all anchor tags from my code. The code is valid HTML and should result in a clickable div (once the div is made display:block;)
Steps I took leading up to the issue:
Pasted in the following code to display a grid of clickable divs:
What I tried to resolve the issue:
I have looked on the forums for something specific to this but cannot find anything helpful.
Application Version - e.g., OJS 3.1.2:
Additional information, such as screenshots and error log messages if applicable:
It doesn’t seem to matter whether I put the anchor tags around or within the DIV, they will always be stripped on saving.
Obviously I don’t feel right in modifying the TinyMCE core, but if there is a way to configure the editor via the call from OJS then that would be preferable.
Thanks for clarifying. I’m not familiar enough with the code to be able to answer these questions, but I’ll see if I can get a member of our dev team to weigh in when they’re available. I think it would be inadvisable, as you note, to modify the code, as new changes that are introduced in new versions of OJS as you upgrade, could override them (that’s generally the risk with a lot of customizations) - so it can lead to headaches down the road.
Just a quick follow-up on this one to see if anyone there has any ideas how to allow certain nested tags within the TinyMCE editor. Our current live site, which is based on OJS 3.1.2, currently uses a text field to incorporate some HTML on the home page. The editor on OJS 3.1.2 doesn’t strip the tags, and this enables our users to periodically update the content of the home page with HTML code.
Now that OJS 3.3 strips out the tags this will cause this operation of the live site to fail and corrupt the display, so unless I can find a way to allow HTML tags in the editor then I won’t be able to upgrade our live site unless I can come up with another [easy] way to allow HTML to be displayed on the home page via the settings form in the backend. There has to be a way right?
I appreciate any help I can get on this one because I’m kind of stumped here. If I edit the TinyMCE core code then I’ll be version-locking our site which is something I don’t want to do.
@ctgraham Do you know if there is a way to configure the TinyMCE editor to allow the nested tags? Our site can’t be the only one using the text fields in this manner surely (perhaps it is!)
I can always just hard-code the content of the home page into the .tpl file but it’s not optimal for our use case. Having the admins be able to make minor changes to the content themselves means a developer doesn’t have to intervene each time.
I don’t have the OJS skills at this time, having just started to use it, however this HTML5 purifier would be of immense usefulness in my case as we commonly paste HTML code into the backend for display on the frontend.
I appreciate the importance of stripping certain HTML tags from fields that public-facing people can create, but I do believe the ability to choose which fields have the HTML stripped from them would be very useful. The alternative is to hard-code the HTML content into the templates themselves which isn’t ideal.
I’ll see if I can think of a way to get this to work for my case but I’m sure it will involve editing the core software so wouldn’t constitute a permanent solution.
Hi @ctgraham , just looking at the things being stripped out, I don’t think having
Pending implementation of the issue which Alec just filed, the only trivial workarounds would be to disable htmlpurifier entirely (which introduces XSS risks) or to hardcode the HTML into the templates (which introduces maintenance headaches).