PHP code example of pjkui / kindeditor
1. Go to this page and download the library: Download pjkui/kindeditor library . Choose the download type require .
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
pjkui / kindeditor example snippets
'pjkui\\kindeditor\\' => array($vendorDir . '/pjkui/kindeditor'),
public function actions()
{
return [
'Kupload' => [
'class' => 'pjkui\kindeditor\KindEditorAction',
],
];
}
use pjkui\kindeditor\KindEditor;
// Standalone
echo KindEditor::widget([]);
// Bound to a model attribute
echo $form->field($model, 'content')->widget(KindEditor::class, [
'clientOptions' => [
'allowFileManager' => 'true',
'allowUpload' => 'true',
],
]);
echo $form->field($model, 'article_pic')->widget(KindEditor::class, [
'clientOptions' => [
'allowFileManager' => 'true',
'allowUpload' => 'true',
],
'editorType' => 'image-dialog',
]);
use pjkui\kindeditor\KindEditor;
echo KindEditor::widget([
'id' => 'thisID', // id of the generated textarea
'clientOptions' => [
'height' => '500',
'items' => [
'source', '|', 'undo', 'redo', '|', 'preview', 'print', 'template', 'code',
'cut', 'copy', 'paste', 'plainpaste', 'wordpaste', '|',
'justifyleft', 'justifycenter', 'justifyright', 'justifyfull',
'insertorderedlist', 'insertunorderedlist', 'indent', 'outdent',
'subscript', 'superscript', 'clearhtml', 'quickformat', 'selectall', '|',
'fullscreen', '/',
'formatblock', 'fontname', 'fontsize', '|',
'forecolor', 'hilitecolor', 'bold', 'italic', 'underline', 'strikethrough',
'lineheight', 'removeformat', '|',
'image', 'multiimage', 'flash', 'media', 'insertfile', 'table', 'hr',
'emoticons', 'baidumap', 'pagebreak', 'anchor', 'link', 'unlink', '|', 'about',
],
],
]);
public function actions()
{
return [
'Kupload' => [
'class' => 'pjkui\kindeditor\KindEditorAction',
'root_path' => Yii::getAlias('@webroot') . '/attached/',
'root_url' => Yii::getAlias('@web') . '/attached/',
'max_size' => 5 * 1024 * 1024, // 5 MB
],
];
}
'pjkui\\kindeditor\\' => array($vendorDir . '/pjkui/kindeditor'),
public function actions()
{
return [
'Kupload' => [
'class' => 'pjkui\kindeditor\KindEditorAction',
],
];
}
use pjkui\kindeditor\KindEditor;
echo KindEditor::widget([]);
// 或绑定到模型字段
echo $form->field($model, 'content')->widget(KindEditor::class, [
'clientOptions' => [
'allowFileManager' => 'true',
'allowUpload' => 'true',
],
]);
echo $form->field($model, 'article_pic')->widget(KindEditor::class, [
'clientOptions' => [
'allowFileManager' => 'true',
'allowUpload' => 'true',
],
'editorType' => 'image-dialog',
]);
use pjkui\kindeditor\KindEditor;
echo KindEditor::widget([
'id' => 'thisID',
'clientOptions' => [
'height' => '500',
'items' => [
'source', '|', 'undo', 'redo', '|', 'preview', 'print', 'template', 'code',
'cut', 'copy', 'paste', 'plainpaste', 'wordpaste', '|',
'justifyleft', 'justifycenter', 'justifyright', 'justifyfull',
'insertorderedlist', 'insertunorderedlist', 'indent', 'outdent',
'subscript', 'superscript', 'clearhtml', 'quickformat', 'selectall', '|',
'fullscreen', '/',
'formatblock', 'fontname', 'fontsize', '|',
'forecolor', 'hilitecolor', 'bold', 'italic', 'underline', 'strikethrough',
'lineheight', 'removeformat', '|',
'image', 'multiimage', 'flash', 'media', 'insertfile', 'table', 'hr',
'emoticons', 'baidumap', 'pagebreak', 'anchor', 'link', 'unlink', '|', 'about',
],
],
]);