S
S
SingleBug2017-08-01 23:18:48
JavaScript
SingleBug, 2017-08-01 23:18:48

How to make a CKeditor plugin that renders a non-dynamic page containing dynamic. code (noscript mode)?

I've been struggling with this task for an hour. How to implement it in such a way that the dynamic code is rendered without dynamics by activating such a plugin, while not violating the integrity of the html document itself. I'm thinking of writing a parser that comments on tags like

Answer the question

In order to leave comments, you need to log in

1 answer(s)
S
Shamsudin Serderov, 2017-08-01
@Steein

// разрешить теги <style>
CKEDITOR.config.protectedSource.push(/<(style)[^>]*>.*<\/style>/ig);
// разрешить теги <script>
CKEDITOR.config.protectedSource.push(/<(script)[^>]*>.*<\/script>/ig);
// разрешить php-код
CKEDITOR.config.protectedSource.push(/<\?[\s\S]*?\?>/g);
// разрешить любой код: <!--dev-->код писать вот тут<!--/dev-->
CKEDITOR.config.protectedSource.push(/<!--dev-->[\s\S]*<!--\/dev-->/g);
CKEDITOR.config.allowedContent = true;

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question