sahilr2050/yii2-redactor-s3

Extension redactor for Yii2 Framework.

Installs: 822

Dependents: 0

Suggesters: 0

Security: 0

Stars: 0

Watchers: 1

Forks: 0

Open Issues: 2

Language:JavaScript

Type:yii2-extension

1.2.3 2024-03-11 10:13 UTC

This package is auto-updated.

Last update: 2024-11-11 11:54:22 UTC


README

yii2-redactor

This is a clone and modified version of Yii2-Redactor

Extension redactor for Yii2 Framework.

Installation

The preferred way to install this extension is through composer.

Either run

composer require --prefer-dist sahilr2050/yii2-redactor-s3 "*"

or

 "sahilr2050/yii2-redactor-s3": "*"

to the require section of your composer.json.

Configure

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

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

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

    'modules' => [
        'redactor' => [
            'class' => 'Sahilr2050\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(\Sahilr2050\redactor\widgets\Redactor::className()) ?>

or not use ActiveField

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

or config advanced redactor reference Docs

<?= $form->field($model, 'body')->widget(\Sahilr2050\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!