CKeditor protectedSource handlebars

I am trying to use CKeditor with steering templates so that users can customize messages in our application.

CKEditor does some weird stuff

He turns this:

<table> <thead> <tr> <td>Activity</td> <td>Quantity</td> <td>Rate</td> <td>Amount</td> </tr> </thead> <tbody> {{line_items}} </tbody> </table> 

In it:

 {{line_items}} <table> <thead> <tr> <td>Activity</td> <td>Quantity</td> <td>Rate</td> <td>Amount</td> </tr> </thead> <tbody></tbody> </table> 

Then googling made me use config.protectedSource to protect all the rudders.

 CKEDITOR.replace('template_body', { //... other stuff protectedSource: [ /{{[\s\S]*?}}/g ] } 

This option correctly protects the handle marks from being moved or deleted, but then prevents them from being viewed / edited!

CKEditor hides a protected source in edit mode and shows it in source mode! this is mistake? Can I see {{}} in the original editor mode, but not in normal mode?

+5
source share
1 answer

Looking at the number of requests, it looks like the author. This plugin did an excellent job, try it. You can edit the protected source in wysiwyg mode with it.

+1
source

Source: https://habr.com/ru/post/1215074/


All Articles