wbraganca / yii2-ace-widget
Yii2 Ace (Ajax.org Cloud9 Editor) 小部件
1.0.0
2015-09-11 21:12 UTC
Requires
- bower-asset/ace-builds: ~1.2
- yiisoft/yii2: ~2.0.5
This package is not auto-updated.
Last update: 2024-09-14 19:09:20 UTC
README
Ace (Ajax.org Cloud9 Editor) 的源代码仓库可在此找到 - https://github.com/ajaxorg/ace.
原始演示可在此找到 - http://ace.c9.io/#nav=embedding.
安装
安装此扩展的首选方式是通过 composer.
运行以下命令之一
$ php composer.phar require "wbraganca/yii2-ace-widget" "*"
或者将以下内容添加到您的 composer.json
文件的 require
部分。
"wbraganca/yii2-ace-widget": "*"
用法
<?php use wbraganca\AceEditor\AceEditorWidget; // For basic usage echo AceEditorWidget::widget([ 'name' => 'editor_name', 'value' => 'your text code', ]); // Ace editor with emmet $this->registerJsFile('https://cloud9ide.github.io/emmet-core/emmet.js'); echo AceEditorWidget::widget([ 'id' => 'attribute_id', 'model' => $model, 'attribute' => 'attribute_name', 'theme' => 'sqlserver', 'extensions' => [ 'emmet' ], 'aceOptions' => [ 'showPrintMargin' => false, 'minLines' => 20, 'maxLines' => 500, 'newLineMode' => 'unix' ] ]); ?>
选项
varNameAceEditor
- 全局 JavaScript 变量(默认为aceEditor
)。mode
- 代码语言(默认为php
)。theme
- 主题(默认为github
)。editable
- 是否显示可编辑的文本输入或仅突出显示输出(默认为true
)。autocompletion
- 是否启用简单的自动完成功能(仅在editable = true
时有效)。aceOptions
- ACE 编辑器的选项。