Git Product home page Git Product logo

yii2-redactor's Introduction

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'=>'http://domain/path/to/uploadfolder'
        ],
    ],

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'=>[
        'imageGetJson' => '/redactor/upload/imagejson',
        'imageUpload' => '/redactor/upload/image',
        'clipboardUploadUrl' => '/redactor/upload/clipboard',
        'fileUpload' => '/redactor/upload/file',
        'lang'=>'zh_cn',
        'plugins'=>['clips','fontcolor']
    ]
])?>

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!

yii2-redactor's People

Contributors

alez avatar zinzinday avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.