-
☆ A M B ☆
- 24,524 Posts
If you use CKEditor, it has a configuration option to ignore specified code. It treats the code as if it were an HTML comment. For example, in the modx.config.js file you can put
CKEDITOR.config.protectedSource.push( /\[\[(.*?)\]\]/g );
CKEDITOR.config.protectedSource.push( /\[!(.*?)!\]/g );
CKEDITOR.config.protectedSource.push( /\[~(.*?)~\]/g );
CKEDITOR.config.protectedSource.push( /\[\((.*?)\)\]/g );
CKEDITOR.config.protectedSource.push( /\[\+(.*?)\+\]/g );
CKEDITOR.config.protectedSource.push( /\[\^(.*?)\^\]/g );
CKEDITOR.config.protectedSource.push( /\[\*(.*?)\*\]/g );
CKEDITOR.config.protectedSource.push( /{{(.*?)}}/g );
This will protect all of the MODx tags. They will not be meddled with, and they will not be displayed in the rich text editor's content. This works best if the tags are inserted into the content in Source mode.
Is it possible to protect MODx Revo tags? These can be nested, so I don't know whether it is possible to use RegExp for the matching.