Laravel 5.5和CKEditor选项

Jim*_*Jim 5 ckeditor laravel-5

我想在CKEditor中使用一些可选的附加功能,特别是视频嵌入.

我已将整个内容下载到公共区域的ckeditor,并在插件目录中有视频.

我从CKeditor的CDN开始:

<script src="//cdn.ckeditor.com/4.7.3/full-all/ckeditor.js"></script>
Run Code Online (Sandbox Code Playgroud)

然后我添加了视频插件的选项:

<script>
 CKEDITOR.plugins.addExternal( 'video', '{{ public_path('\ckeditor\plugins\video\ ') }}', 'video.js' );
</script>
Run Code Online (Sandbox Code Playgroud)

(video.js实际上是在我尝试过的子目录对话框中).

我可以看到我的页面上显示的CKEditor但没有视频按钮.

有什么想法吗?

小智 2

首先,您需要将插件存档的内容上传到网站上的任何文件夹。不过,最好给该文件夹命名,以便您知道它包含 CKEditor 插件。为了我们的示例,让\xe2\x80\x99s 将其命名为ckeditor/plugins。那么你最终应该得到以下路径:

\n\n
ckeditor/plugins/jsplus_image_editor\n
Run Code Online (Sandbox Code Playgroud)\n\n

现在,我们需要告诉 CKEditor 从上面的文件夹加载插件。将以下代码添加到 HTML 代码中 CKEditor 替换标准控件的行上方:

\n\n
<textarea name="editor1"></textarea>\n...\n<script>\nCKEDITOR.plugins.addExternal( \'yourpluginname\', \n\'/ckeditor/plugins/yourpluginname\', \'plugin.js\' );\nCKEDITOR.replace(\'editor1\');\n...\n</script>\n
Run Code Online (Sandbox Code Playgroud)\n\n

通常,您通过 config.js 安装插件,但由于您使用的是 CDN,我们需要替换配置。将上面的内容更新为以下代码:

\n\n
CKEDITOR.replace(\'editor1\', { customConfig: \'/ckeditor/custom_config.js\'});\n
Run Code Online (Sandbox Code Playgroud)\n\n

制作上述的 custom_config.js 并放置以下代码\n CKEDITOR.editorConfig = function( config ) {

\n\n
CKEDITOR.editorConfig = function( config ) {\n\nconfig.language = \'en\';\n\nconfig.extraPlugins = \'PLUGINNAME\';\n\nconfig.toolbar = \'custom\';\nconfig.toolbar_custom = [\n    { name: \'clipboard\', groups: [ \'clipboard\', \'undo\' ], items: [ \'Cut\', \'Copy\', \'Paste\', \'PasteText\', \'PasteFromWord\', \'-\', \'Undo\', \'Redo\' ] },\n    { name: \'editing\', groups: [ \'find\', \'selection\', \'spellchecker\' ], items: [ \'Scayt\' ] },\n    { name: \'links\', items: [ \'Link\', \'Unlink\', \'Anchor\' ] },\n    { name: \'insert\', items: [ \'Image\', \'Table\', \'HorizontalRule\', \'SpecialChar\' ] },\n    { name: \'tools\', items: [ \'Maximize\' ] },\n    { name: \'document\', groups: [ \'mode\', \'document\', \'doctools\' ], items: [ \'Source\' ] },\n    { name: \'others\', items: [ \'-\' ] },\n    \'/\',\n    { name: \'basicstyles\', groups: [ \'basicstyles\', \'cleanup\' ], items: [ \'Bold\', \'Italic\', \'Strike\', \'-\', \'RemoveFormat\' ] },\n    { name: \'paragraph\', groups: [ \'list\', \'indent\', \'blocks\', \'align\', \'bidi\' ], items: [ \'NumberedList\', \'BulletedList\', \'-\', \'Outdent\', \'Indent\', \'-\', \'Blockquote\' ] },\n    { name: \'styles\', items: [ \'Styles\', \'Format\' ] },\n    { name: \'about\', items: [ \'About\' ] },\n    { name : \'new_group\', items: [\'PLUGINNAME\'] }\n];}\n
Run Code Online (Sandbox Code Playgroud)\n\n

希望这可以帮助!

\n