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.

#111085 Preventing a User from removing too much html

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 Friday, 20 May 2022 12:26 BST

dlcmpls
I'm wondering if there is way to prevent a JCE Editor user from deleting specific bits of html.

Let's say that every Article has this div: <div class"something"> the user puts content here </div>

Right now the user can backspace over that opening div tag when working visually and not even be aware they removed the div tag. Doing so removes all the formatting provided by the "something" class.

I only want the user to be able to edit the content between the div tags but not edit or delete the div tags.

Any suggestions?

Ryan
You can use the "mceNonEditable" and "mceEditable" classes to make elements non-editable and editable respectively. So in your instance, you might use:

<div class="something mceNonEditable">
    <div class="mceEditable">
        <!-- User Content -->
    </div>
</div>

Ryan Demmer

Lead Developer / CEO / CTO

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

Ryan
Ensure that the NonEditable option is checked in Editor Profiles -> Features & Layout -> Additional Features

The mceNonEditable and mceEditable class names can be changed in Editor Profiles -> Plugin Parameters -> NonEditable, to something more suitable tou your needs if required.

Ryan Demmer

Lead Developer / CEO / CTO

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