perminder-klair/yii2-sir-trevor-js
Composer 安装命令:
composer require perminder-klair/yii2-sir-trevor-js
包简介
Sir Trevor Editor for Yii2
README 文档
README
Sir Trevor Editor for Yii2
Installation
The preferred way to install this extension is through composer.
Either run
php composer.phar require --prefer-dist perminder-klair/yii2-sir-trevor-js "*"
or add
"perminder-klair/yii2-sir-trevor-js": "*"
to the require section of your composer.json file.
Usage
Once the extension is installed, simply use it in your code by :
<?= $form->field($model, 'content')->widget(\kato\sirtrevorjs\SirTrevor::classname()); ?>
To Use Converter
Thanks to drmabuse!
To echo out html content, in Yii2 active record do as done is following example:
public function renderSirTrevor() { $convertor = new \kato\sirtrevorjs\SirTrevorConverter(); return $convertor->toHtml($this->content); }
Then in view:
echo $model->renderSirTrevor()
To Upload Images
To upload Images, a demo file is included with extension actions/UploadAction.php
Extend or copy it to your application and modify according to needs.
Include action in controller:
public function actions() { return [ 'upload' => [ 'class' => 'kato\actions\SirTrevorUploadAction', ], ]; }
Yii 1
This widget may be used in Yii 1 applications.
- Follow instructions on how to include Yii 2 in Yii 1 applications
- Include the widget as follows:
<?php $this->widget('\kato\sirtrevorjs\yii1compat\ESirTrevor', array( 'model' => $model, 'attribute' => 'content', )); ?>
统计信息
- 总下载量: 1.12k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 7
- 点击次数: 0
- 依赖项目数: 3
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2014-03-27