2017 © Pedro Peláez
 

yii2-extension yii2-tinymce

TinyMCE widget with inline mode support

image

comradepashka/yii2-tinymce

TinyMCE widget with inline mode support

  • Friday, February 24, 2017
  • by ComradePashka
  • Repository
  • 2 Watchers
  • 0 Stars
  • 24 Installations
  • JavaScript
  • 0 Dependents
  • 0 Suggesters
  • 1 Forks
  • 0 Open issues
  • 3 Versions
  • 0 % Grown

The README.md

TinyMCE widget extension with inline mode support for Yii2 framework

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., (*1)

This extension wrap TinyMCE with div tag and made it inline by default., (*2)

2do list

There are few things that better to fix and/or add more flexibility:, (*3)

  • 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:, (*4)

$('#{$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., (*5)

Installation

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

So you either run, (*7)

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

or add, (*8)

"comradepashka/yii2-tinymce": "*"

to the require section of your composer.json file., (*9)

Usage

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

Now you can pass configuration value 'extraCss', (*10)

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

using configuration array., (*11)

Styles will be used in addition to default bootstrap styles internally in editor., (*12)

The Versions

24/02 2017

dev-master

9999999-dev

TinyMCE widget with inline mode support

  Sources   Download

Apache-2.0

The Requires

 

by Pavel Sokolov

extension yii2 tinymce

03/04 2016

0.0.3.6

0.0.3.6

TinyMCE widget with inline mode support

  Sources   Download

Apache-2.0

The Requires

 

by Pavel Sokolov

extension yii2 tinymce

29/03 2016

0.0.3.5

0.0.3.5

TinyMCE widget with inline mode support

  Sources   Download

Apache-2.0

The Requires

 

by Pavel Sokolov

extension yii2 tinymce