yii2-redactor

用于Yii2框架的Redactor WYSIWYG扩展。(Extension Redactor WYSIWYG for Yii2 framework)

  • Owner: yiidoc/yii2-redactor
  • Platform: BSD, Linux, Mac, Windows
  • License:: BSD 3-Clause "New" or "Revised" License
  • Category::
  • Topic:
  • Like:
    0
      Compare:

Github stars Tracking Chart

yii2-redactor

Extension redactor for Yii2 Framework.

Installation

The preferred way to install this extension is through composer.

Either run

php composer.phar require --prefer-dist yiidoc/yii2-redactor "*"

or

 "yiidoc/yii2-redactor": "*"

to the require section of your composer.json.

Configure

Add to config file (config/web.php or common\config\main.php)

    'modules' => [
        'redactor' => 'yii\redactor\RedactorModule',
    ],

or if you want to change the upload directory.
to path/to/uploadfolder
default value @webroot/uploads

    'modules' => [
        'redactor' => [
            'class' => 'yii\redactor\RedactorModule',
            'uploadDir' => '@webroot/path/to/uploadfolder',
            'uploadUrl' => '@web/path/to/uploadfolder',
            'imageAllowExtensions'=>['jpg','png','gif']
        ],
    ],

note: You need to create uploads folder and chmod and set security for folder upload
reference: Protect Your Uploads Folder with .htaccess,
How to Setup Secure Media Uploads

Config view/form

<?= $form->field($model, 'body')->widget(\yii\redactor\widgets\Redactor::className()) ?>

or not use ActiveField

<?= \yii\redactor\widgets\Redactor::widget([
    'model' => $model,
    'attribute' => 'body'
]) ?>

or config advanced redactor reference Docs

<?= $form->field($model, 'body')->widget(\yii\redactor\widgets\Redactor::className(), [
    'clientOptions' => [
        'imageManagerJson' => ['/redactor/upload/image-json'],
        'imageUpload' => ['/redactor/upload/image'],
        'fileUpload' => ['/redactor/upload/file'],
        'lang' => 'zh_cn',
        'plugins' => ['clips', 'fontcolor','imagemanager']
    ]
])?>

Bummer! i was tested on my project but not have many time to write document on file and usage.
If you have problem please create a issue

Thanks!

Main metrics

Overview
Name With Owneryiidoc/yii2-redactor
Primary LanguageJavaScript
Program languagePHP (Language Count: 3)
PlatformBSD, Linux, Mac, Windows
License:BSD 3-Clause "New" or "Revised" License
所有者活动
Created At2013-09-19 21:15:46
Pushed At2022-04-15 01:47:07
Last Commit At2016-01-07 13:45:09
Release Count2
Last Release Name2.0.1 (Posted on )
First Release Name2.0.0 (Posted on )
用户参与
Stargazers Count186
Watchers Count20
Fork Count87
Commits Count44
Has Issues Enabled
Issues Count78
Issue Open Count49
Pull Requests Count6
Pull Requests Open Count3
Pull Requests Close Count7
项目设置
Has Wiki Enabled
Is Archived
Is Fork
Is Locked
Is Mirror
Is Private