You need to be logged in to post in the forum - Log In

An active JCE Pro Subscription is required to post in the forum - Buy a Subscription

Support is currently Offline

Official support hours
Monday to Friday
09:00 - 17:00 Europe/London (BST)

Please create a new Ticket and we will get back to you as soon as we can.

#117505 Code cleaning

Posted in ‘Editor’
This is a public ticket

Everybody will be able to see its contents. Do not include usernames, passwords or any other sensitive information.

Latest post by Ryan on Wednesday, 07 January 2026 19:04 GMT

Crazyhorse50

I am have increasingly woprking on the code in JCE but when I check it in the editor and go back all teh layoput has been removed which makes it hade to follow. How do i stop that or do i need to use a different editor. I like JCE its very good and useful but for instance I want to experiment with class="float-end ms-3 my-3"

instesd of 

10px; margin-bottom: 10px; margin-left: 10px; float: right;

but its difficult to make sense of oyt when all teh spacing has been stripped out.

Ryan

If you want to use existing css classes (presumably part of your template's stylesheet), then you can uses the Classes option in the dialog to apply them. For example if you are inserting an image, select each class in turn from the Classes list in the Advanced tab of the Image Manager dialog.

You can also do this to an existing image in the content using the Style Select list in the editor toolbar.

but its difficult to make sense of oyt when all teh spacing has been stripped out.

Can you explain what you mean by this?

Ryan Demmer

Lead Developer / CEO / CTO

Just because you're not paranoid doesn't mean everybody isn't out to get you.

Crazyhorse50

Sorry ...an example 

To make sense of teh CSS I format thus

<p><a href="https://www.joomlacontenteditor.net/images/Animals/Marley-5D4_9326.jpg"
type="image/jpeg"
class="jcepopup zoom-top-right float-end ms-3 my-3"
data-mediabox="1"
data-mediabox-title="Marley"
data-mediabox-caption="One of our original Sheep,">
<img src="https://www.joomlacontenteditor.net/images/Animals/thumbnails/thumb_Marley-5D4_9326.jpg" alt="" width="300" height="200" data-alt="Marley" /> </a></p>

but when i go back to teh editeor to chacj that and then go back to dcode i getr:

<p>These are are Marley and Cracker,&nbsp;<strong>Jacob sheep</strong>, a distinctive British breed of domestic sheep known for its unique appearance.</p>
<p><a href="https://www.joomlacontenteditor.net/images/Animals/Marley-5D4_9326.jpg" type="image/jpeg" class="jcepopup zoom-top-right float-end ms-3 my-3" data-mediabox="1" data-mediabox-title="Marley" data-mediabox-caption="One of our original Sheep,"> <img src="https://www.joomlacontenteditor.net/images/Animals/thumbnails/thumb_Marley-5D4_9326.jpg" alt="" width="300" height="200" data-alt="Marley" /> </a></p>
<p><a href="https://www.joomlacontenteditor.net/images/Animals/Cracker-5D4_9353.jpg" type="image/jpeg" class="jcepopup zoom-top-right" data-mediabox="1" data-mediabox-title="Cracker" data-mediabox-caption="Our other Jacob sheep" data-mediabox-type="image/jpeg"><img src="https://www.joomlacontenteditor.net/images/Animals/thumbnails/thumb_Cracker-5D4_9353.jpg" alt="Cracker 5D4 9353" width="300" height="200" style="margin-top: 10px; margin-bottom: 10px; margin-right: 10px; float: left;" /></a>

It woudl be nice it the code formating did not change... but not essential and I didnt expect an answer on a sunday!!!

Ryan

I am not able to reproduce this in my tests with this code:

<p><a href="https://www.joomlacontenteditor.net/images/Animals/Marley-5D4_9326.jpg"
type="image/jpeg"
class="jcepopup zoom-top-right float-end ms-3 my-3"
data-mediabox="1"
data-mediabox-title="Marley"
data-mediabox-caption="One of our original Sheep,">
<img src="https://www.joomlacontenteditor.net/images/Animals/thumbnails/thumb_Marley-5D4_9326.jpg" alt="" width="300" height="200" data-alt="Marley" /> </a></p>

After saving it in a new article, the code remains the same, with no inline styles added as in your "after" code above, eg:

style="margin-top: 10px; margin-bottom: 10px; margin-right: 10px; float: left;"

In your article, if you switch to the Code tab before saving, do you notice the inline style added, or does this only happen when you save the article?

Ryan Demmer

Lead Developer / CEO / CTO

Just because you're not paranoid doesn't mean everybody isn't out to get you.

Crazyhorse50

Some misunderstanding — I didn’t explain myself very well

If I work on the JCE code view panel I will put some extra new lines in to make it easier to read:

See before image attached,

If I now go back to JCE Editor View panel then back to the JCE code view panel. The extra new lines have been removed.

See the after image attached

Its not a big deal but would be good if it did not remove the extra new lines.

Attachments

Ryan

White space between tags and attributes is not retained when switching from the Code tab to the Editor tab, as it is unavoidably removed when the code is processed by the editor.

Ryan Demmer

Lead Developer / CEO / CTO

Just because you're not paranoid doesn't mean everybody isn't out to get you.