laravel-5 - Laravel 5.5 和 CKEditor 选项

标签 laravel-5 ckeditor

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

我已经将整个东西下载到公共(public)区域的ckeditor,并且在plugins目录中有视频。

我从CKeditor的CDN开始:

<script src="//cdn.ckeditor.com/4.7.3/full-all/ckeditor.js"></script>

然后我添加了视频插件的选项:
<script>
 CKEDITOR.plugins.addExternal( 'video', '{{ public_path('\ckeditor\plugins\video\ ') }}', 'video.js' );
</script>

(video.js 实际上位于我也尝试过的子目录对话框中)。

我可以看到出现在我的页面上的 CKEditor,但没有视频按钮。

请问有人有什么想法吗?

最佳答案

首先,您需要将插件存档的内容上传到您网站上的任何文件夹。虽然,命名文件夹是个好主意,这样您就知道它包含 CKEditor 插件。为了我们的示例,我们将其命名为 ckeditor/plugins。您应该最终得到以下路径:

ckeditor/plugins/jsplus_image_editor

现在,我们需要告诉 CKEditor 从上面的文件夹中加载插件。将以下代码添加到您的 HTML 代码中 CKEditor 替换标准控件的行上方:
<textarea name="editor1"></textarea>
...
<script>
CKEDITOR.plugins.addExternal( 'yourpluginname', 
'/ckeditor/plugins/yourpluginname', 'plugin.js' );
CKEDITOR.replace('editor1');
...
</script>

通常您通过 config.js 安装插件,但由于您使用的是 cdn,我们需要替换配置。用以下代码更新上面的替换:
CKEDITOR.replace('editor1', { customConfig: '/ckeditor/custom_config.js'});

制作上述 custom_config.js 并放置以下代码
CKEDITOR.editorConfig = 功能(配置){
CKEDITOR.editorConfig = function( config ) {

config.language = 'en';

config.extraPlugins = 'PLUGINNAME';

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

希望这可以帮助!

关于laravel-5 - Laravel 5.5 和 CKEditor 选项,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/50736211/

相关文章:

php - 如何将laravel迁移文件迁移到mongodb

jquery - CKeditor 有自动完成功能吗?

CKEditor - 如何禁用 pastefromword

javascript - 如何停止 IE 中缓存 js 文件?

CKEditor 4.x:禁止一个标签位于另一个标签内

php - LARAVEL 5.0 + 单元测试 - 不同包的 assertSessionHasErrors

mysql - Laravel 中加入 Query 以避免举报滥用用户

php - Laravel 5.1 oAuth 2 服务器 'invalid scope' 错误

php - 在@foreach Laravel 5.2 中获取重复行的总和

twitter-bootstrap - 如何将响应类添加到 ckeditor 图像对话框?