andrew72ru / yii2-pen
Content editor like Medium.com for yii-2 based on https://github.com/sofish/pen
Installs: 15
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 1
Forks: 0
Open Issues: 0
Language:JavaScript
Type:yii2-extension
Requires
- bower-asset/to-markdown: ~1.2.0
- michelf/php-markdown: *
- yiisoft/yii2: *
This package is auto-updated.
Last update: 2024-10-23 02:17:52 UTC
README
Content editor like Medium.com for yii-2 based on https://github.com/sofish/pen
Installation
The preferred way to install this extension is through composer.
Either run
php composer.phar require --prefer-dist andrew72ru/yii2-pen "*"
or add
"andrew72ru/yii2-pen": "*"
to the require section of your composer.json
file.
Usage
Use this in Active Form.
There is two cases of usage.
First, for multiple string text (like textarea).
This code add a editable section
element to your form and make a p
tag in there for each paragraph.
use andrew72ru\pen\Pen; echo $form->field($model, 'text')->widget(andrew72ru\pen\Pen::className());
Next case add a inline-editing feature – for headers and other one-line texts.
This code make a h1
tag with page-geader
class an add editablecontent
to there.
use andrew72ru\pen\Pen; echo $form->field($model, 'title')->widget(Pen::className(), [ 'clientOptions' => [ 'inline' => true, 'tag' => 'h1', 'class' => 'page-header' ] ]);