gpt4 book ai didi

laravel-5 - Laravel 5.5 和 CKEditor 选项

转载 作者:行者123 更新时间:2023-12-04 21:04:09 26 4
gpt4 key购买 nike

我想在 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/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com