Subscribe: RSS
  • 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.
      Studying MODX in the desert - http://sottwell.com
      Tips and Tricks from the MODX Forums and Slack Channels - http://modxcookbook.com
      Join the Slack Community - http://modx.org
    • 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.