Permalink
Browse files

1.0

  • Loading branch information...
1 parent ba34bdc commit c72034debe960ba50c47fa73dea4fdd6b251b8b1 @samdark samdark committed Dec 11, 2012
Showing with 2,289 additions and 1,289 deletions.
  1. +17 −49 ImperaviRedactorWidget.php
  2. +265 −133 assets/redactor.css
  3. +1,861 −1,073 assets/redactor.js
  4. +6 −6 assets/redactor.min.js
  5. +27 −12 changelog.md
  6. +39 −0 license.md
  7. +25 −16 readme.md
  8. +49 −0 readme_ru.md
View
@@ -3,61 +3,29 @@
* ImperaviRedactorWidget class file.
*
* @author Veaceslav Medvedev <slavcopost@gmail.com>
- * @link https://github.com/yiiext/imperavi-redactor-widget
- * @license http://www.opensource.org/licenses/bsd-license.php
- */
-/**
- * ImperaviRedactorWidget wrapper around {@link http://redactorjs.com Fantastic WYSIWYG-editor on jQuery}.
- *
- * Usage:
- *
- * First, import the class file
- * <pre>
- * Yii::import('ext.imperavi-redactor-widget.ImperaviRedactorWidget');
- * </pre>
+ * @authro Alexander Makarov <sam@rmcreative.ru>
*
- * Next, render the textarea and create it into redactor
- * <pre>
- * $this->widget('ImperaviRedactorWidget',array(
- * // you can either use it for model attribute
- * 'model'=>$my_model,
- * 'attribute'=>'my_field',
- * // or just for input field
- * 'name'=>'my_input_name',
- * // imperavi redactor {@link http://redactorjs.com/docs/ options}
- * 'options'=>array(
- * 'lang'=>'en',
- * ),
- * ));
- * </pre>
- * Or create redactor from textarea by selector
- * <pre>
- * $this->widget('ImperaviRedactorWidget',array(
- * // the textarea selector
- * 'selector'=>'.redactor',
- * // imperavi redactor {@link http://redactorjs.com/docs/ options}
- * 'options'=>array(),
- * ));
- * </pre>
+ * @version 1.0
*
- * @author Veaceslav Medvedev <slavcopost@gmail.com>
- * @version 0.7
- * @package yiiext.imperavi-redactor-widget
- * @link http://redactorjs.com
+ * @link https://github.com/yiiext/imperavi-redactor-widget
+ * @license https://github.com/yiiext/imperavi-redactor-widget/blob/master/license.md
*/
class ImperaviRedactorWidget extends \CInputWidget
{
/**
* Assets package ID.
*/
const PACKAGE_ID = 'imperavi-redactor';
+
/**
- * @var array {@link http://redactorjs.com/docs redactor options}.
+ * @var array {@link http://imperavi.com/redactor/docs/ redactor options}.
*/
public $options = array();
+
/**
- * @var string|null The textarea selector. If it null, will be render the textarea.
- * Defaults to null.
+ * @var string|null Selector pointing to textareas to initialize redactor for.
+ * Defaults to null meaning that textarea doesn't exist yet and will be
+ * rendered by this widget.
*/
public $selector;
@@ -73,10 +41,10 @@ public function init()
$this->selector = '#' . $this->id;
if ($this->hasModel()) {
- echo \CHtml::activeTextArea($this->model, $this->attribute, $this->htmlOptions);
+ echo CHtml::activeTextArea($this->model, $this->attribute, $this->htmlOptions);
} else {
$this->htmlOptions['id'] = $this->id;
- echo \CHtml::textArea($this->name, $this->value, $this->htmlOptions);
+ echo CHtml::textArea($this->name, $this->value, $this->htmlOptions);
}
}
@@ -88,10 +56,10 @@ public function init()
*/
protected function registerClientScript()
{
- /** @var $cs \CClientScript */
+ /** @var $cs CClientScript */
$cs = Yii::app()->clientScript;
if (!isset($cs->packages[self::PACKAGE_ID])) {
- /** @var $am \CAssetManager */
+ /** @var $am CAssetManager */
$am = Yii::app()->assetManager;
$cs->packages[self::PACKAGE_ID] = array(
'basePath' => dirname(__FILE__) . '/assets',
@@ -110,9 +78,9 @@ protected function registerClientScript()
$cs->registerPackage(self::PACKAGE_ID);
$cs->registerScript(
- __CLASS__ . '#' . $this->id,
- 'jQuery(' . \CJavaScript::encode($this->selector) . ').redactor(' . \CJavaScript::encode($this->options) . ');',
- \CClientScript::POS_READY
+ get_class($this) . '#' . $this->id,
+ 'jQuery(' . CJavaScript::encode($this->selector) . ').redactor(' . CJavaScript::encode($this->options) . ');',
+ CClientScript::POS_READY
);
}
}
View
Oops, something went wrong.
Oops, something went wrong.

0 comments on commit c72034d

Please sign in to comment.