Within a Global block, I have a content area modal. Inside the modal, I enter pure HTML code, with various <div>
, and a section with <script>
, and also some <!-- HTML comments>
.
As soon as I click on the “Rich Text” tab, the editor will interpret my code as pure text, an it will insert <p>...</p>
around code lines. Just clicking on the “T” and back on the </>
is enough - no editing within the RichText field is necessary.
I understand that this would be proper behavior if it would actually be text - giving that text a proper HTML format. However, in this case, where the “text” is actually code, this is obviously not correct.
Thanks!
Hi @striata,
Thanks for reaching out.
The HTML tags are permissible only in the HTML editor, wheras Rich Text editor can be used as Visual editor which generates the HTML. The <p>
tag can be added from Rich Text editor by adding an Enter or New Line, and can be seen in HTML editor.
For your case, it’s best to disable it in X/Pro > Settings > User Preferences.
Hope it helps.
Thanks
Thank you, @tristup
I understand. I am normally working with the html editor,and never switch to the rich text editor. I just noticed when I have accidentally clicked on the rich text editor, and immediately switched back, that it messed up the code. I wanted to make you aware of this. Everything was proper html, but the rich text editor added additional html tags. It respected certain existing html tags, and did not wrap them inside a <p>... </p>
(for example an existing h2 element), but other tags were not respected (such as <script>
).
Apparently, there is a logic behind this in interpreting the raw text and making it rich text. This logic does not catch certain things.
Is it possible to wrap some portion of the raw text (in my case: the complete raw text) in some tag, that the rich text editor will not touch? Something like <donottouch>... MyCode... </donottouch>
. Would a div accomplish that? Or a span? Probably not, because “MyCode” contains script.
Hi @striata,
I suggest that you put your HTML code in a div tag, not with a p tag then add a class name in your div, in that way the Rich Editor will able to read the HTML code properly.
Hope that helps.
Thank you.
This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.