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.

#117260 Adding hidden comments…

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 tapiochre on Thursday, 03 July 2025 11:28 BST

tapiochre

Hi Ryan

i often add plugin shortcodes into articles but if my end user edits the article I don’t want them to edit or delete the shortcode.

is there a way to add ‘messages’ to the editor content such as 

‘do not edit below this line’ or

’the shortcodr below must not be removed or changed’

of course these messages will only be seen in the back (or front end) edit screens, never in the website front end.

possible?

Ryan

You can use "non-editable" blocks for this. Create a paragraph or div element (with a collection of paragraphs for example) that contain your message or any other content that the user can't edit, adding a class of mceNonEditable to the block element, eg:

<div class="mceNonEditable">
<h3>Do not edit below this line</h3>
<p>The shortcode below must not be removed or changed</p>
</div>

A non-editable block can also contain editable elements, eg:

<div class="mceNonEditable">
<p>Type your response in the paragraph below</p>
<div class="mceEditable">
<p>Type here....</p>
</div>
</div>

Ryan Demmer

Lead Developer / CEO / CTO

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

tapiochre

Great. A couple of follow up questions if I may:

1. Is there a quick way to insert these non/editable blocks (like a toolbar icon etc) rather than having to add via the code or HTML editor? Have i missed such icons?

2. Once added, is there a method to show these in a different style (i.e maybe red, italics) or is it just as easy to add inline style such as :

<div class="mceNonEditable" style="color: #888888; background: #efefef; border: dotted 1px #666666;">
<p><strong>Do not edit the shortcode below this line</strong></p>
</div>

3. Do I have to add the following to my custom.css as, at the moment, I can see the 'instruiction' in the front end.

.mceNonEditable, .mceEditable {display:none!important;}

Ryan

1. Is there a quick way to insert these non/editable blocks (like a toolbar icon etc) rather than having to add via the code or HTML editor? Have i missed such icons?

Use a Template Item in the Template Manager (in a profile assigned to you only) to create a list of non-editable items that you can easily add to editor content, eg:

 2. Once added, is there a method to show these in a different style (i.e maybe red, italics) or is it just as easy to add inline style such as :

Inline styles are fine. You can also style them using the mceNonEditable class in your template stylesheet, eg:

.mceNonEditable {
    border: 1ps dashed #ccc;
    color: red;
    background-color: #eee;
}

3. Do I have to add the following to my custom.css as, at the moment, I can see the 'instruiction' in the front end.

.mceNonEditable, .mceEditable {display:none!important;}

This will hide them in the editor too, as the editor loads the custom.css styles as well. You need a little bit more on the selector to prevent the style being applied in the editor, eg:

.item-content .mceNonEditable {display:none !important;}
.item-content .mceEditable {display:none !important;}

Ryan Demmer

Lead Developer / CEO / CTO

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

tapiochre

Nice! Thanks - I'll give this all a good try!