Я использую CKEditor v4.5.5. Ниже приведен мой config.js, и я не могу понять, как его настроить, чтобы он позволял использовать теги сценария в содержимом.
CKEDITOR.editorConfig = function( config ) {
config.toolbarGroups = [
{ name: 'clipboard', groups: [ 'clipboard', 'undo' ] },
{ name: 'editing', groups: [ 'find', 'selection', 'spellchecker' ] },
{ name: 'links' },
{ name: 'insert' },
{ name: 'forms' },
{ name: 'tools' },
{ name: 'document', groups: [ 'mode', 'document', 'doctools' ] },
{ name: 'others' },
'/',
{ name: 'basicstyles', groups: [ 'basicstyles', 'cleanup' ] },
{ name: 'paragraph', groups: [ 'list', 'indent', 'blocks', 'align', 'bidi' ] },
{ name: 'styles' },
{ name: 'colors' },
{ name: 'about' }
];
config.allowedContent = true;
config.extraAllowedContent = 'div(*)';
config.height = "250";
config.removeButtons = 'Underline,Subscript,Superscript';
config.format_tags = 'p;h1;h2;h3;pre;div';
config.removeDialogTabs = 'image:advanced;link:advanced';
};
Я попытался добавить script
, script*
script(*)
в config.extraAllowedContent
Я попытался добавить следующее, а затем добавить класс preserve
в тег сценария
config.protectedSource.push( /<([\S]+)[^>]*class="preserve"[^>]*>.*<\/\1>/g );
config.protectedSource.push( /<[^>]+class="preserve"[^>\/]*\/>/g );
Я даже заменил все содержимое выше на следующий код, который был рекомендован другим потоком.
CKEDITOR.editorConfig = function( config ) {
config.allowedContent = {
script: true,
$1: {
elements: CKEDITOR.dtd,
attributes: true,
styles: true,
classes: true
}
};
};
Независимо от того, что я делаю, я не могу добавлять теги сценария. Это следующий скрипт, который я пытаюсь добавить, он удаляет все, кроме iframe
<script type="text/javascript" src=" https://cdnjs.cloudflare.com/ajax/libs/iframe-resizer/3.5.14/iframeResizer.min.js"></script>
<iframe src=" https://hello.dubsado.com:443/public/form/view/######" frameborder="0" style="width:1px; min-width:100%;"></iframe>
<script type="text/javascript">setTimeout(function(){iFrameResize({checkOrigin: false, heightCalculationMethod: "taggedElement"});}, 30)</script>