2017-09-18 1 views
0

Gedub GistsをCKeditorに埋め込むにはどうしたらいいですか?通常ceditorにGithubの要点を埋め込む

私の入力は、この例の場合:

<script src="https://gist.github.com/ericbarnes/f8f533409af88cf35be520c101181384.js"></script> 

は無視され、削除されます。

アップテーブル:

スクリプト使用...................................... ..................

<script> 
    var editor_config = { 
    path_absolute : "/", 
    selector: "textarea.my-editor", 
    plugins: [ 
     "advlist autolink lists link image charmap print preview hr anchor pagebreak", 
     "searchreplace wordcount visualblocks visualchars code fullscreen", 
     "insertdatetime media nonbreaking save table contextmenu directionality", 
     "emoticons template paste textcolor colorpicker textpattern codesample" 
    ], 
    toolbar: "insertfile undo redo | styleselect | bold italic | alignleft aligncenter alignright alignjustify | bullist numlist outdent indent | link image media | emoticons charmap | code codesample | forecolor backcolor", 
    relative_urls: false, 
    remove_script_host: false, 
    file_browser_callback : function(field_name, url, type, win) { 
     var x = window.innerWidth || document.documentElement.clientWidth || document.getElementsByTagName('body')[0].clientWidth; 
     var y = window.innerHeight|| document.documentElement.clientHeight|| document.getElementsByTagName('body')[0].clientHeight; 

     var cmsURL = editor_config.path_absolute + 'laravel-filemanager?field_name=' + field_name; 
     if (type == 'image') { 
     cmsURL = cmsURL + "&type=Images"; 
     } else { 
     cmsURL = cmsURL + "&type=Files"; 
     } 

     tinymce.activeEditor.windowManager.open({ 
     file: '<?= route('elfinder.tinymce4') ?>',// use an absolute path! 
     title: 'file manager', 
     width: 900, 
     height: 450, 
     resizable: 'yes' 
     }, { 
     setUrl: function (url) { 
      win.document.getElementById(field_name).value = url; 
     } 
     }); 
    } 
    }; 

    tinymce.init(editor_config); 
</script> 

答えて

0

は、あなたの設定オプションに追加してください:

config.extraAllowedContent = 'script[src]';

詳しい情報はこちら - https://docs.ckeditor.com/#!/guide/dev_acf

PS。しかし、スクリプトタグを提出することは安全ではないことに注意してください。

+0

あなたは何を提案しますか? – mafortis

+0

私はあなたの目標と状況を知らないので何かを提案することはできません。基本的には、ユーザーがあなたのウェブサイト上で何かを実行できるようにします。 – SAZ

+0

どこでもあなたのコードを使用しています私のエディタは通常のテキストエリアのようになります。私の質問には私の 'js'が含まれています。 – mafortis

関連する問題