cakecoded/ckeditor
Composer 安装命令:
composer require cakecoded/ckeditor
包简介
CkEditor plugin for CakePHP 3.x & 4.x
README 文档
README
Installation
You can install this plugin into your CakePHP application using composer.
The recommended way to install composer packages is:
composer require cakecoded/ckeditor
Then in config/bootstrap.php add:
Plugin::load('CkEditor');
In either src/Controller/AppController.php, or any controller where you want to use CKEditor, add:
public $helpers = ['CkEditor.Ck'];
Finally, in your template file, simply add this to call CKEditor:
echo $this->Ck->input('field_name');
This is the equilivant of using
echo $this->Form->input('field_name');
Except that CKEditor will be loaded instead of a text area!
Advanced Options
You can make adjustments to CKEditor and the form input as needed. There is full flexibility in this regard.
The full explaination is as follows:
echo $this->Form->input($input, $options, $ckEditorOptions, $ckEditorUrl, $ckEditorPlugins);
@param string $input
The name of the field, can be field_name or model.field_name
@param array $options
Options include $options['label'] for a custom label and any other custom Form Helper options
@param array $ckEditorOptions
This will pass any options from http://docs.ckeditor.com/#!/guide/dev_configuration to CKEditor
@param string $ckEditorUrl
This gives an option to overwrite the CKEditor URL. You can use a local URL then if required.
@param array $ckEditorPlugins
An array of locally installed CKEditor plugins to include, as one sub-array per plugin, in the format specified in the CKEditor documentation at https://docs.ckeditor.com/ckeditor4/latest/api/CKEDITOR_plugins.html#addExternal.
Examples
Use an associated field name
echo $this->Ck->input('category.description');
Generate a custom label
echo $this->Ck->input('field_name', ['label' => 'A unique label']);
Add options to CKEditor from http://docs.ckeditor.com/#!/guide/dev_configuration
echo $this->Ck->input('field_name', [], ['fullPage' => true, 'allowedContent' => 'true']);
Load a local version of CKEditor, or a different version
echo $this->Ck->input('field_name', [], [], '/js/ckeditor.js');
Load a locally installed CKEditor plugin
echo $this->Ck->input('field_name', [], [], null, [['myplugin', '/ckplugins/myplugin/', 'myplugin.js']]);
Example showing all the options together
echo $this->Ck->input('field_name', ['label' => 'A unique label'], ['fullPage' => true, 'allowedContent' => 'true'], '/js/ckeditor.js', [['myplugin', '/ckplugins/myplugin/', 'myplugin.js']]);
cakecoded/ckeditor 适用场景与选型建议
cakecoded/ckeditor 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 19.2k 次下载、GitHub Stars 达 8, 最近一次更新时间为 2016 年 11 月 06 日, 在 PHP 生态内属于活跃度较高的组件。
我们在过去多个企业项目中使用过 cakecoded/ckeditor 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 cakecoded/ckeditor 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
统计信息
- 总下载量: 19.2k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 8
- 点击次数: 10
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: Unknown
- 更新时间: 2016-11-06