定制 comradepashka/yii2-tinymce 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

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

comradepashka/yii2-tinymce

Composer 安装命令:

composer require comradepashka/yii2-tinymce

包简介

TinyMCE widget with inline mode support

README 文档

README

There are about 20 extensions at GitHub which usually wrap TinyMCE in Html::activeTextarea() or Html::textarea() so we got htmlencoded content sent to the end user and moreover - TinyMCE wrapped in textarea tag which is completely inacceptable to extremly usefull inline mode behavior.

This extension wrap TinyMCE with div tag and made it inline by default.

2do list

There are few things that better to fix and/or add more flexibility:

  • i18n for widget uses yii::$app->language settings but for English language it will be changed to en_GB by default. Not the best way.
  • content_css options ALWAYS use static url to '/css/site.css' file and dynamically detects location of the Bootstrap CSS. Have to figure out how to attach them automatically. See below
  • widget ALWAYS use beforeValidate event handler for changing name of hidden input generated by TinyMCE for correct posting form variables

Here is short description for parts used in final substitution:

$('#{$id}').attr('name');   // original name-attribute for inline editor
$('#{$id}').html();         // original post inside inline editor
$('[name={$id}]')           // hidden input

Bugs

Due to dynamic change of form elements there might be strange behavior related to CSRF. I've got HTTP 400 error during posting form data and couldn't realize what happens but later when I switch languages in my app everything start working normally. Need more investigation.

Installation

The preferred way to install this extension should be composer. Now package published at Packagist and support Semantic Versioning

So you either run

php composer.phar require --prefer-dist comradepashka/yii2-tinymce

or add

"comradepashka/yii2-tinymce": "*"

to the require section of your composer.json file.

Usage

$form->field($model, "body")->widget(TinyMce::className(), $optionsArray)

Now you can pass configuration value 'extraCss'

'extraCss' => "/css/site.css,/css/tinyMCE.css,",

using configuration array.

Styles will be used in addition to default bootstrap styles internally in editor.

统计信息

  • 总下载量: 47
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 1
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 2
  • Forks: 1
  • 开发语言: JavaScript

其他信息

  • 授权协议: Apache-2.0
  • 更新时间: 2016-03-23

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固