承接 alexantr/yii2-tinymce 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

alexantr/yii2-tinymce

最新稳定版本:1.0.0

Composer 安装命令:

composer require alexantr/yii2-tinymce

包简介

TinyMCE widget for Yii 2

README 文档

README

This extension renders a TinyMCE widget for Yii framework 2.0.

Latest Stable Version Total Downloads License

Installation

Install extension through composer:

composer require alexantr/yii2-tinymce 

Note: By default, the latest TinyMCE 5 will be installed. But you can install 4.x version manually:

composer require "tinymce/tinymce:^4.8" 

Usage

The following code in a view file would render a TinyMCE widget:

<?= alexantr\tinymce\TinyMCE::widget(['name' => 'attributeName']) ?>

Configuring the TinyMCE options should be done using the clientOptions attribute:

<?= alexantr\tinymce\TinyMCE::widget([ 'name' => 'attributeName', 'clientOptions' => [ 'plugins' => [ 'anchor', 'charmap', 'code', 'help', 'hr', 'image', 'link', 'lists', 'media', 'paste', 'searchreplace', 'table', ], 'height' => 500, 'convert_urls' => false, 'element_format' => 'html', // ... ], ]) ?>

If you want to use the TinyMCE widget in an ActiveForm, it can be done like this:

<?= $form->field($model, 'attributeName')->widget(alexantr\tinymce\TinyMCE::className(), [ 'clientOptions' => [ // ... ], ]) ?>

Using presets

To avoid repeating identical configuration in every widget you can create preset in @app/config/tinymce.php. Options from widget's clientOptions will be merged with this configuration.

Preset example:

<?php return [ 'plugins' => [ 'anchor', 'charmap', 'code', 'help', 'hr', 'image', 'link', 'lists', 'media', 'paste', 'searchreplace', 'table', ], 'height' => 500, 'convert_urls' => false, 'element_format' => 'html', 'image_caption' => true, 'keep_styles' => false, 'paste_block_drop' => true, 'table_default_attributes' => new yii\web\JsExpression('{}'), 'table_default_styles' => new yii\web\JsExpression('{}'), 'invalid_elements' => 'acronym,font,center,nobr,strike,noembed,script,noscript', 'extended_valid_elements' => 'strong/b,em/i,table[style]', // elFinder file manager https://github.com/alexantr/yii2-elfinder 'file_picker_callback' => alexantr\elfinder\TinyMCE::getFilePickerCallback(['elfinder/tinymce']), ];

You can change default path with presetPath attribute:

<?= alexantr\tinymce\TinyMCE::widget([ 'name' => 'attributeName', 'presetPath' => '@backend/config/my-tinymce-config.php', 'clientOptions' => [ 'height' => 1000, ], ]) ?>

统计信息

  • 总下载量: 34.31k
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 6
  • 点击次数: 3
  • 依赖项目数: 2
  • 推荐数: 0

GitHub 信息

  • Stars: 6
  • Watchers: 1
  • Forks: 1
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2026-01-04

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固