Skip to content

Instantly share code, notes, and snippets.

@sylvaincombes
Last active February 7, 2020 14:53
Show Gist options
  • Save sylvaincombes/1cda1d94ac2ebc587ba1aabc91ed8bbe to your computer and use it in GitHub Desktop.
Save sylvaincombes/1cda1d94ac2ebc587ba1aabc91ed8bbe to your computer and use it in GitHub Desktop.
Ckeditor : Allow and preserve twig syntax
<script type="text/javascript">
// Allow and preserve twig syntax @see http://stackoverflow.com/questions/20977910/editing-twig-templates-in-ckeditor
// Can also be coupled with this plugin : http://ckeditor.com/addon/showprotected
CKEDITOR.config.protectedSource.push(/\{\{[\s\S]*?\}\}/g);
CKEDITOR.config.protectedSource.push(/\{\%[\s\S]*?%\}/g);
CKEDITOR.config.protectedSource.push(/\{\#[\s\S]*?#\}/g);
</script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment