ECLEditor extension


(Thiagovidal) #1

[size="4"]Just release this extension. Share your comments, bug reports and suggestions here.

Extension page[/size]


(Antonio) #2

Pretty good version, much more better approach than mine are easier to use. Didn’t thought about extending CInputWidget

Best


(Thiagovidal) #3

Oh thanks. Have you developed the other one? I tried to correct to send to developer my version but it was taking to much time so I developed another one.

Buy the way I didn`t have time to see your swfupload review. I will try this weekend.

Best regards

thiagovidal

www.othys.com


(Antonio) #4

No problem man! I am really busy, having three projects at this time -and using my free time to go through the forum and learn more -very frekyii

You gave me a good hint and I have reviewed my autocomplete widget.cya


(Gerald) #5

Hi,

have installed this extension and it was really easy to get it run.

But i have no idea how to get out the formatted HTML code and display it in the view.

Code of _form.php:


		<?php echo $form->labelEx($model,'description'); ?>

		<?php $this->widget('application.extensions.cleditor.ECLEditor', array(

            'model'=>$model,

            'attribute'=>'description', //Model attribute name. Nome do atributo do modelo.

            'options'=>array(

                'width'=>'500',

                'height'=>250,

                'useCSS'=>false,

            'controls'=>     // controls to add to the toolbar

                  "bold italic | removeformat | bullets numbering | outdent " .

                  "indent | alignleft center alignright justify | undo redo | " .

                  "rule image link unlink | cut copy paste pastetext | print source",

            'colors'=>       // colors in the color popup

                  "",

            'fonts'=>        // font names in the font popup

                  "Arial,Arial Black,Comic Sans MS,Courier New,Narrow,Garamond," .

                  "Georgia,Impact,Sans Serif,Serif,Tahoma,Trebuchet MS,Verdana",

            'sizes'=>        // sizes in the font size popup

                  "1,2,3,4,5,6,7",

            'styles'=>       // styles in the style popup

                  array(

                    array("Paragraph", "<p>"),

                    array("Header 1", "<h1>"),

                    array("Header 2", "<h2>"),

                    array("Header 3", "<h3>"),

                    array("Header 4","<h4>"),

                    array("Header 5","<h5>"),

                    array("Header 6","<h6>")

                  ),

            'docType'=>      // Document type contained within the editor

                  '<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">',

            'docCSSFile'=>   // CSS file used to style the document contained within the editor

                 "",

            'bodyStyle'=>    // style to assign to document body contained within the editor

                 "margin:4px; font:10pt Arial,Verdana; cursor:text"


            ),

            'value'=>$model->description, //If you want pass a value for the widget. I think you will. Se você precisar passar um valor para o gadget. Eu acho irá.

          )); ?>

Code of _view.php:


<?php echo CHtml::encode($data->getAttributeLabel('description')); ?>:

????

Could someone help me out?

THX

BJ


(Rossmccaughrain) #6

Hi BJ,

What is it outputting? Im guessing its displaying the HTML? I think you just want to output the contents directly as its already in html

i.e.




<?php echo $data->attributeName; ?>




(Rossmccaughrain) #7

Ive added the following to incorporate plugins and minified js in my version which may or may not benefit you. Posting here in case you want it!

in ECLEditor (or extended class if you wish as below)

Note: i had to change the ECLEditor->publishAssets() from being a static method to being an instance method. Not sure why it is static but there may be some reason im missing.




<?php


require_once('ECLEditor.php');


class ECLEditorExt extends ECLEditor {

	

    public $useMin = true;

	

    public $plugins = array();

	

    protected function publishAssets()

    {

        $minId = $this->useMin ? '.min' : '';

		

        $assets=dirname(__FILE__).'/assets';

        $baseUrl=Yii::app()->assetManager->publish($assets);

        if(is_dir($assets)){

            Yii::app()->clientScript->registerCoreScript('jquery');

            Yii::app()->clientScript->registerScriptFile($baseUrl."/jquery.cleditor$minId.js",CClientScript::POS_HEAD);

			

            foreach ($this->plugins as $plugin) {

                $pluginId = ".$plugin";

                Yii::app()->clientScript->registerScriptFile($baseUrl."/jquery.cleditor$pluginId$minId.js",CClientScript::POS_HEAD);

            }


        Yii::app()->clientScript->registerCssFile($baseUrl.'/jquery.cleditor.css');			

        } else {

            throw new Exception('EClEditor - Error: Couldn\'t find assets to publish.');

        }

    }

}




Then in your view




$this->widget('application.extensions.cleditor.ECLEditorExt', array(

    'model'=>$model,

    'attribute'=>'comment', //Model attribute name.

    'useMin'=>true,

    'plugins'=>array('xhtml', 'icon'),

    'options'=>array(

        ....

    ),

    'value'=>'',

));



Then just drop the available plugins into the extensions/cleditor/assets and as long as they maintain the naming conventions they currently have e.g. jquery.cleditor.<pluginname>.js or jquery.cleditor.<pluginname>.min.js it should work.

Hope this benefits someone somewhere!

Ta

Ross


(Lennart Borregaard) #8

You can’t put more than one of these per page.


(Dominick) #9

hi, thanks for your great extension!

everything is working fine so far with me, but now I want users to be able to embed YouTube and Vimeo videos.

How would that be possible?

Thanks,

zastava


(Edgar Fernandes) #10

Hi i have the same question.

How can we use this extension to include youtube, vimeo, etc videos?

I know that Yii cleans the code for security reasons and iframe and objects are cleared out of the way, but how can we use videos without compromising security?

I know that yiitube works, but lets say i’m building a blog, and i want to include videos on my posts, i need this to be dynamic. Any ideas?


(Jzhong5) #11

This one is still not working… still out put HTML like <xxx>…</xxx>, any ideas?


(Dunghoi0208) #12

Hi all !

i have a question? how to user choose a picture from their compute when user click ‘Insert image’ in ECLEditor? (not use img url)

thanks all!


(Jzhong5) #13

Dear all,

I am using Cleditor in a form and i rendered this same form as a fast reply in my other view(It’s like multiple blogs in the same page and you can reply it without clicking and opening it).

However, i realized that if i use Cleditor for the same model multiple times at the same page, only the first field will change to CLeditor, others will still remain text area…

Any ideas would be appreciated.

My form.php view:

I am rendering the _form multiple times.


<?php $this->renderPartial('/reply/_form',array(          

  'model'=>$reply,           

 'answer'=>$answer,       

 )); ?>

code in _form.php:


 <div class="form" style="margin-bottom:-15px;">  

<?php $form=$this->beginWidget('application.extensions.ActiveForm', array( 	'id'=>'reply-form', 	'enableAjaxValidation'=>false,         'disableAfterSubmit'=>true,         'disableText'=>'Processing…',         'disableCssClass'=>'btn btn-large btn-success',         'htmlOptions'=>array('enctype'=>'multipart/form-data'), )); ?>  	

<?php echo $form->errorSummary($model); ?>  	

<div class="row"> 		

<?php echo $form->labelEx($model,'description',array('label'=>'Reply')); ?>  

<?php $this->widget('ext.cleditor.ECLEditor', array(

                        'model'=>$model,

                        'attribute'=>'description',

                        'options'=>array(

                                'width'=>500,

                                'height'=>320,

                                'useCSS'=>true,

                        ),

                        'value'=>$model->description,

                ));

 

                ?>	</div>  

......

.....

</div><!-- form -->


(Rooney10) #14

Hey guys,

just integrated the extension into my project but when I want to display the editor I only get a textarea without any controls. This happens when I use the method with a model explained at the extension site:

My code:




$this->widget('ext.cleditor.ECLEditor', array(

        'model'=>$texts,

        'attribute'=>'display_value', //Model attribute name.

        'options'=>array(

            'width'=>900,

            'height'=>250,

            'useCSS'=>true,

        ),

        'value'=>$texts->display_value, //If you want pass a value for the widget. I think you will.

    ));



The "simple usage" does work allthough. Does anyone have an idea where the problem is?

Thx in advance :)


(Rooney10) #15

Ok figured out what the problem was. I had an input field with the same attribute before I used the widget. After I got rid of the other input field, it worked :)


(Eder Lima) #16

tem como ocultar o botao de exibir o coidgo html?

nao gostaria que o usuario pudesse editar em html.


(Mbogner) #17

This is my implementation, and it doesn’t work. All I see is a text area. Am I doing something wrong? Am I missing something? a JS link? or some other item?


	<div class="row">

		<?php echo $form->labelEx($model,'desc_of_work'); ?>

                <?php

                    $this->widget('ext.cleditor.ECLEditor', array(

                        'model'=>$model,

                        'attribute'=>'desc_of_work',

                        'options'=>array(

                            'width'=>'600',

                            'height'=>'250',

                            'useCSS'=>true,

                            'controls'=> "bold italic | removeformat | bullets numbering | outdent | indent | alignleft center alignright justify | undo redo | rule image link unlink | cut copy paste pastetext | print source",

                            'fonts'=> "Arial,Arial Black,Comic Sans MS,Courier New,Helvetica,Narrow,Garamond,Georgia,Impact,Sans Serif,Serif,Tahoma,Trebuchet MS,Verdana",

                            'sizes'=> "1,2,3,4,5,6,7",

                            'colors'=>"FFF FCC FC9 FF9 FFC 9F9 9FF CFF CCF FCF CCC F66 F96 FF6 FF3 6F9 3FF 6FF 99F F9F

                                  BBB F00 F90 FC6 FF0 3F3 6CC 3CF 66C C6C 999 C00 F60 FC3 FC0 3C0 0CC 36F 63F C3C

                                  666 900 C60 C93 990 090 399 33F 60C 939 333 600 930 963 660 060 366 009 339 636

                                  000 300 630 633 330 030 033 006 309 303",   

                            'styles'=> array(

                                array("Paragraph", "<p>"),

                                array("Header 1", "<h1>"),

                                array("Header 2", "<h2>"),

                                array("Header 3", "<h3>"),

                                array("Header 4","<h4>"),

                                array("Header 5","<h5>"),

                                array("Header 6","<h6>"),

                            ),

                            'docType'=> '',

                            'bodyStyle'=> "margin:4px; font:10pt Arial,Helvetica,Sans Serif; cursor:text",

                            'value'=>$model->desc_of_work)

                    ));

                ?>		          

		<?php echo $form->error($model,'desc_of_work'); ?>

	</div>