Skip to content

Commit

Permalink
rebuild assets
Browse files Browse the repository at this point in the history
  • Loading branch information
BigKuCha committed Jan 30, 2015
1 parent 2cb80a1 commit 8796f73
Show file tree
Hide file tree
Showing 251 changed files with 30,798 additions and 32,707 deletions.
12 changes: 9 additions & 3 deletions UEditor.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@

use Yii;
use yii\helpers\ArrayHelper;
use yii\helpers\Html;
use yii\helpers\Json;
use yii\helpers\Url;
use yii\web\View;
Expand All @@ -17,16 +18,20 @@ class UEditor extends InputWidget
//配置选项,参阅Ueditor官网文档(定制菜单等)
public $jsOptions = [];

//预设配置
//默认配置
protected $_options;

/**
* @throws \yii\base\InvalidConfigException
*/
public function init()
{
$this->id = $this->hasModel() ? Html::getInputId($this->model, $this->attribute) : $this->id;
$this->_options = [
'serverUrl' => Url::to(['upload']),
'initialFrameWidth' => '100%',
'initialFrameHeight' => '400',
'lang' => strtolower(Yii::$app->language),
];
$this->jsOptions = ArrayHelper::merge($this->_options, $this->jsOptions);
parent::init();
Expand All @@ -36,9 +41,10 @@ public function run()
{
$this->registerClientScript();
if ($this->hasModel()) {
$this->value = $this->model->getAttributes($this->attribute);
return Html::activeTextarea($this->model, $this->attribute, ['id' => $this->id]);
} else {
return Html::textarea($this->id, $this->value, ['id' => $this->id]);
}
echo '<script id="' . $this->id . '" type="text/plain" style="width:1024px;height:500px;">' . $this->value . '</script>';
}

/**
Expand Down
10 changes: 3 additions & 7 deletions UEditorAsset.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,14 @@


use yii\web\AssetBundle;
use yii\web\View;

class UEditorAsset extends AssetBundle
{
public $js = [
'js/ueditor.config.js',
'js/ueditor.all.js',
'lang/zh-cn/zh-cn.js'
];
public $jsOptions = [
'position' =>View::POS_HEAD,
'ueditor.config.js',
'ueditor.all.js',
];

public function init()
{
$this->sourcePath = dirname(__FILE__) . DIRECTORY_SEPARATOR . 'assets';
Expand Down
Loading

0 comments on commit 8796f73

Please sign in to comment.