tecsin/yii2-tinymce

为Yii2的TinyMCE扩展,具有以elFinder作为其文件选择功能的特性。

安装次数: 363

依赖者: 0

建议者: 0

安全: 0

星标: 2

关注者: 3

分支: 0

类型:yii2-extension

1.0.1 2017-07-12 18:54 UTC

This package is auto-updated.

Last update: 2024-08-29 04:14:40 UTC


README

为Yii2的TinyMCE扩展,具有以elFinder作为其文件选择功能的特性。

安装

安装此扩展的首选方式是通过 composer

运行以下命令之一:

php composer.phar require --prefer-dist tecsin/yii2-tinymce "*"

或者在您的 composer.json 文件的 require 部分添加:

"tecsin/yii2-tinymce": "*"

到 require 部分。

使用

扩展安装后,只需在您的代码中使用即可

tinyMCE WYSIWYG 编辑器

带模型

    /**
     * @var array clientOptions The client options for TinyMCE JS plugin.
     * @see http://www.tinymce.com/wiki.php/Configuration
     */
<?= $form->field($model, 'content')->widget(\tecsin\tinymce\Tinymce::className(), [
    'options' => ['rows' => 6],
    'language' => 'en_GB',
    'clientOptions' => [
        'plugins' => [
            "image imagetools  lists charmap print preview hr anchor pagebreak spellchecker",
            "searchreplace wordcount visualblocks visualchars code fullscreen insertdatetime media nonbreaking",
            "save table contextmenu directionality emoticons template paste textcolor"
        ],
        'toolbar' => "insertfile undo redo | styleselect | bold italic | alignleft aligncenter alignright alignjustify | bullist numlist outdent indent | link image | print preview media fullpage | forecolor backcolor emoticons "
    ],
/*elfinder options*/
'file'  => '/admin/file-browser',//relative or absolute url
'title' => 'file browser',
'width' => 750,
'height' => 350,
'resizable' => 'yes'
]);?>

不带模型

    
   /**
     * @var array clientOptions The client options for TinyMCE JS plugin.
     * @see http://www.tinymce.com/wiki.php/Configuration
     */
<?= \tecsin\tinymce\Tinymce::widget([
    'options' => ['rows' => 6],
    'language' => 'en_GB',
    'clientOptions' => [
        'plugins' => [
            "image imagetools  lists charmap print preview hr anchor pagebreak spellchecker",
            "searchreplace wordcount visualblocks visualchars code fullscreen insertdatetime media nonbreaking",
            "save table contextmenu directionality emoticons template paste textcolor"
        ],
        'toolbar' => "insertfile undo redo | styleselect | bold italic | alignleft aligncenter alignright alignjustify | bullist numlist outdent indent | link image | print preview media fullpage | forecolor backcolor emoticons "
    ]
]); ?>

欢迎通过错误报告或编码更多功能来做出贡献。