Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/black-lamp/yii2-code-editor

Widget for Ace code editor
https://github.com/black-lamp/yii2-code-editor

black-lamp php yii-extension yii-widgets yii2

Last synced: 9 days ago
JSON representation

Widget for Ace code editor

Awesome Lists containing this project

README

        

# Code editor for Yii2
Widget for [Ace](https://ace.c9.io) code editor

[![Latest Stable Version](https://poser.pugx.org/black-lamp/yii2-text-editor/version)](https://packagist.org/packages/black-lamp/yii2-text-editor)
[![Latest Unstable Version](https://poser.pugx.org/black-lamp/yii2-text-editor/v/unstable)](//packagist.org/packages/black-lamp/yii2-text-editor)
[![License](https://poser.pugx.org/black-lamp/yii2-text-editor/license)](https://packagist.org/packages/black-lamp/yii2-text-editor)

Installation
------------
#### Run command
```
composer require black-lamp/yii2-text-editor
```
or add
```json
"black-lamp/yii2-text-editor": "2.0.0"
```
to the require section of your composer.json.

Using
-----
Use widget with ActiveForm
```php
$form = ActiveForm::begin();
// ...
echo $form->field($model, 'text')
->widget(bl\ace\AceWidget::className(), [
'language' => 'javascript'
]);
$form->end();
```
#### Widget configuration properties
| Option | Option | Default | Description |
|---|---|---|---|
|language|string|html|Programming language|
|theme|string|github|Code editor theme|
|enableEmmet|boolean|false|Enable emmet plugin for HTML|
|attributes|array|['style' => 'max-width: 600px; min-height: 400px;']|HTML attributes for editor container|

For more information about 'language' and 'theme' configuration attributes read [Ace documentation](https://ace.c9.io/#nav=howto)