diff options
Diffstat (limited to 'protected/extensions/ddeditor/README')
| -rw-r--r-- | protected/extensions/ddeditor/README | 108 |
1 files changed, 108 insertions, 0 deletions
diff --git a/protected/extensions/ddeditor/README b/protected/extensions/ddeditor/README new file mode 100644 index 0000000..0d5e252 --- /dev/null +++ b/protected/extensions/ddeditor/README @@ -0,0 +1,108 @@ +# DDEditor Yii Extension + +This extension contains a widget to render an activeTextarea to enter Markdown text. + +The rendered widget contains some buttons to add markdown tags for + +* Bold, italic text +* Links +* Images +* Code +* Table structure. + +It is also capable of displaying dropdown lists with _additional text snippets_ for insertion. + + +### Requirements +* Yii 1.1.3 or above + +### Installation +* Extract the release file under `protected/extensions` + +### Usage + +#### Include New Extension + +In your `config/main.php` file, add + + // autoloading model and component classes + 'import'=>array( + ... + 'application.extensions.ddeditor.*', + ... + ), + +#### Create the controll in a form view: + +In e.g. `views/post/_form.php`, include the following code: + + <?php $this->widget( + 'application.extensions.ddeditor.DDEditor', + array( + 'model'=>$model, + 'attribute'=>'content', + 'htmlOptions'=>array('rows'=>10, 'cols'=>70), + 'previewRequest'=>'post/preview')); ?> + +If you want to display an **extra dropdown list** with **snippets**, you may add the +_additionalSnippets_ parameter: + + <?php $mySnippets = array( + 'Users' => array( + 'id1' => 'John', + 'id2' => 'Paul', + ), + 'Phrases' => array( + 'Text Foo' => 'foo', + 'Text Bar' => 'bar' + ) + ); ?> + + <?php $this->widget( + 'application.extensions.ddeditor.DDEditor', + array( + 'model'=>$model, + 'attribute'=>'content', + 'htmlOptions'=>array('rows'=>10, 'cols'=>70), + 'previewRequest'=>'post/preview', + 'additionalSnippets'=>array('My Snippets'=>$mySnippets), + ); ?> + + +#### Add a Controller Preview Action + +In order to receive a rendered preview of the textarea Markdown, add an action method to a controller: + + public function actionPreview() + { + $parser=new CMarkdownParser; + echo $parser->safeTransform($_POST['Post'][$_GET['attribute']]); + } + + +### Resources + +* [Demo](http://www.diggin-data.de/ddeditor) +* [Discussion](http://www.yiiframework.com/forum/index.php?/topic/11384-new-extension-markdown-editor) + + +### Changes + +#### March 29, 2010 +* **V0.4** + * Added code sample for using _additionalSnippets_ in README + * Added reset of _additional snippets_ dropdown list after selection + +#### March 28, 2010 +* **V0.3** + * Fixed _Depreciated: split_ warning + * Added _additionalSnippets_ member + * Added _Code Highlighter_ dropdown list + +#### August 31, 2010 +* **V0.2** + * Fixed setting `$previewReaquest` + * Fixed setting client script id's for using multiple editors in one form + +#### August 30, 2010 +* **V0.1** Initial release. |
