Thursday, July 25, 2013

Ckeditor : How can i make few tags like div, p, non editable

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 can add attribute contenteditable=false to the tag. E.g.
ckeditor.insertHtml('<h1 contenteditable="false">Not editable text</h1>');

 
http://docs.cksource.com/ckeditor_api/symbols/CKEDITOR.config.html#.protectedSource
config.protectedSource.push( /<\?[\s\S]*?\?>/g );   // PHP code
config.protectedSource.push( /<%[\s\S]*?%>/g );   // ASP code
config.protectedSource.push( /(]+>[\s|\S]*?<\/asp:[^\>]+>)|(]+\/>)/gi );   // ASP.Net code 
            

No comments:

Post a Comment