Ckeditor : How can i make few tags like h3 , h4 , h5 non editable in ckeditor
open to js solution or css any will do
Ckeditor : How can i make few tags like h3 , h4 , h5 non editable in ckeditor
open to js solution or css any will do
The protectedSource configuration setting is the setting of choice for that.
{Array} CKEDITOR.config.protectedSource
List of regular expressions to be executed over the input HTML, indicating code that must stay untouched.
I'm no expert on regular expressions but something like this should do the trick:
config.protectedSource.push(/[^<]*(<h1>([^<]+)<\/h1>)/g);
you may have to play around with it a bit. Caveat: The regex in that form will catch only <h1>...</h1>
tags, not for example deviations like < h1 >...< /h1>
.
In config.js, use the following code to define which elements you want to allow in CKEditor (I removed h1) :
config.format_tags = 'p;h2;h3;h4;h5;h6;pre;address;div'