WYSIWYG editor

To the author of Yii, would you consider adding this editor ( http://code.google.com/p/xheditor/ ) to the zii lirary or Yii js bundle and make it easily pluggable in view files? It’s based on Jquery and i think it’s pretty light weight and good overall and i also think it would prove very useful. please check it out and let me know what you think http://code.google.com/p/xheditor/

Is there english documentation available?

What do you mean by easily pluggable? Most wysiwyg editors (and there are many to choose from) are easy to use. Usually its one or two lines of js code to swap textareas with editor and another one or two lines to customize toolbar and output html.

few time ago, i wrote a jquery wysiwyg plugin. get it at: http://code.google.com/p/lwrte/

the only problem - i almost have no time to continue to work on it.

when i say easily pluggable i mean like a widget or a line of php like


Chtml::editor('xheditor',array('id'=>'text_area_id','width'=>300...));

etc… unfortunately there is no english documentation yet but the editor was recently translated to english so there might be one soon.

@jayrulez:

There already are some extensions for different editors. If you take one of them as template i think it’s not that hard to create a widget for xheditor. Not to mention that it’s a nice exercise to get used to building extensions for Yii ;)

http://www.yiiframework.com/search/extension?q=editor

i can probably do that if i need to. i just wanted to know what the author thinks about it.

I don’t see it loaded in a PHP framework. It’s getting ridiculous for people more on the prototype/motools side. Why not an extension? I think jquery and jquery ui is just enough to be bundled in a PHP framework

it’s implemented in the I-Framework (http://ifphp.cn)

It may be. That doesn’t mean that you have to force people using what they don’t want to use. It’s like distributing Zend Framework with Yii just because it has more libraries. It should be a choice.

Considering that I use mootools, extjs, dojo, scriptaculous, prototype or anything else besides jquery this adds unusable code to my framework. The more unusable code you add, the bigger you make it and you will end up thinking how much you use to make Yii your tool of choice. Even worst, I may like fckeditor so why not add it, tinymce?

I think Yii should stick to PHP and provide the basics of loading javascript and css as it does now.

I stick to my opinion, as an extension is ok but not in the core of Yii.

yea, i meant as an addition to zii, no need to be a part of the core

I have a problem when I try to display the editor as a BBCode editor.

My widget config is the following :


$this->widget('application.components.widgets.XHeditor',array(

                'model'=>$model,

                'modelAttribute'=>'content',

                'showModelAttributeValue'=>false, // defaults to true, displays the value of $modelInstance->attribute in the textarea

                'config'=>array(

                   // 'id'=>'xh1',

                 //   'name'=>'xh',

                 //   'tools'=>'fill', // mini, simple, fill or from XHeditor::$_tools

                 //  'width'=>'200',

                    'beforeSetSource'=>'ubb2html',

                    'beforeGetSource'=>'html2ubb',

                    //see XHeditor::$_configurableAttributes for more

                ),

                'htmlOptions'=>...

I also added the following line into XHeditor.php :


Yii::app()->clientScript->registerScriptFile($this->_baseUrl . '/xheditor_plugins/ubb.js');

now ubb.js is correctly loaded but I’m still having the following error @ firebug log when I click on the [Edit source code] button :

_this.settings.beforeGetSource is not a function @ xheditor-en.js / line 385

Then the editor hangs.

Could you suggest me something, please ?

xhEditor is quite sleek but can never get it to work when the inside or after JUI tabs. More so over, if it is ajax content. I have spent 5 hrs to no avail.

Works in Chrome only.

Did you try elRTE http://www.elrte.org ?

There’s also the elFinder file manager http://elrte.org/elfinder

They are based on jQuery and jQuery UI.

However, they are not developed for IE6, so there could be issues with the obsolete IE6.

I’ve always used CK Editor, which has a good feature set.

Maybe there should be a zii CMS extension?

I ended up with CKE and KCFinder

@saegeek:

I think your problem is that this code:

‘beforeSetSource’=>‘ubb2html’,

‘beforeGetSource’=>‘html2ubb’,

passes the function names as strings, but the js is expecting a function. Try this:

‘beforeSetSource’=>‘js:ubb2html’,

‘beforeGetSource’=>‘js:html2ubb’,

The js: prefix tells Yii to pass the string without quotes around it. Then the js can interpret it as a function name.

Greg

hi guyz i’m kinda new at yii, before i was using ckeditor and I really liked it, however i’m workin on a new project and i want to try yii and xheditor. I have tried the demo, and i figured out that xheditor has a built in uploader.

i’ve have the upload.php file on “extensions/xheditor/upload.php”


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

                'language'=>'en', //options are en, zh-cn, zh-tw

                'config'=>array(

                    'id'=>'xh1',

                    'name'=>'xh',

                    'tools'=>'full', // mini, simple, fill or from XHeditor::$_tools

                    'width'=>'100%',

                    'upLinkUrl'=>'{editorRoot}upload.php',

                    'upLinkExt'=>"zip,rar,txt",

                    'upImgUrl'=>'{editorRoot}upload.php',

                    'upImgExt'=>"jpg,jpeg,gif,png"

                ),

                'contentValue'=>'Enter your text here', 

                'htmlOptions'=>array('rows'=>5, 'cols'=>10)

            ));

this shows me the editor, but on then image button it does not display the upload option

any suggestions?

NOte: im using the latest version of xheditor1.1.3

I am using Yii 1.1.7 and Xheditor (http://www.yiiframework.com/extension/xheditor), occured following problem.

I correctly installed, but Xheditor tools not displayed, only shows blank html textarea . How to solve it?

My Code :

$this->widget(‘application.extensions.xheditor.JXHEditor’, array(

		'model' => $model,


		'attribute' => 'content_en',


		'options'=>array(


    		'tools'=>'full', // mini, simple, full or from XHeditor::$_tools


    		'width'=>'100%',


    		'skin'=>'o2007silver',


		),


		));