[EXTENSION] TinyMCE using jQuery

This is my version of a TinyMCE widget, using jQuery for initialization.

http://www.yiiframew…ension/tinymce/

hello,

your extension is very nice! but there is one problem i'm not able to handle…

i want to set a default value for the content of the editor. every time i enter data, send the complete formular to the sever and some entered data is wrong the editor is empty.

it would bei nice when there would be the possibiltiy to use something like this:

<?php $this->widget('application.extensions.tinymce.ETinyMce',


		array(


			'name'=>'entryInput',


			'plugins' => array('safari', /* ... */),


			'options' => array(


				'theme' => 'advanced',


				'skin' => 'o2k7',


				/* fruther options... */


			),





			'innerHTML' => $entries->text,   // <<< here: set the default value !!!


		)); ?>

Hi, this is a great extension. Thank you!

But an Exception was thrown while I was adding:

'innerHTML' => $entries->text,   // <<< here: set the default value !!!

Quote

Description

Property "ETinyMce.innerHTML" is not defined.

Thanks again!

You are right, a exception will be thrown when you use this code at the moment. This is a feature i want to have but is not implemented at the moment.

here is the solution:

<?php $this->widget('application.extensions.tinymce.ETinyMce',


      array(


         'name'=>'entryInput',


         'plugins' => array('safari', /* ... */),


         'options' => array(


            'theme' => 'advanced',


            'skin' => 'o2k7',


            /* fruther options... */


         ),





         'value' => $entries->text,   // <<< here: set the default value !!!


      )); ?>

use the value-attribute! ETinyMce is a child class of the CInputWidget and there is the property value defined =)

That really GREAT! I was just looking for an extension to implement TinyMCE!

I'm now getting a little problem trying to use it on a mandatory field: I already specified the attribute "name" for the textarea using 'name'=>'fieldName' in the widget call, but when I submit the form YII alert me that fieldName cannot be empty (even if I have entered data).

Can you help me on this?

Thanks.

Quote

I'm now getting a little problem trying to use it on a mandatory field: I already specified the attribute "name" for the textarea using 'name'=>'fieldName' in the widget call, but when I submit the form YII alert me that fieldName cannot be empty (even if I have entered data).

Do you have a required field validator somewhere, I guess… ? Can you disable it and then check the corresponding $_POST value to see if it has something?

Yes of course it is marked as required in the model class.

I made a print_r of the POST array and the mentioned ‘fieldName’ is correct (for both the name and the value) but it is outside the Model array.

I'm sorry but I cannot make a c&p of the printed array because the laptop I'm working on is not connected to the Internet (I'm using a different pc to post here).

In any case, the situation is:

Array([ModelName]=>Array([title]=>value [date]=>value …) [fieldName]=>value)

I hope it's clear.

Actually you use [tt]name[/tt] when you're not using a model. When you use a model you need to set [tt]model[/tt] and [tt]attribute[/tt].

You are totally right!

It works perfectly now, thank you very much!

Hi, great extension and easy to set up and use, but I can't get it to load in IE7.  I just get a blank screen and error loading.  The error received is as follows:

Line: 1


Char: 1


Error: 'tinymce' is undefined


Code: 0


Any ideas?

R

rpaulpen> I have seen this problem intermitently with TinyMCE. Usually deleting the "temporary internet files" helps. If not, maybe an update to the latest TinyMC (haven't tried myself)

No, neither worked.  I updated IE to version 8 and same problem.  I also updated tinyMCE to latest and same problem.  Here are the errors.

Webpage error details





User Agent: Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 5.1; Trident/4.0; GTB6; .NET CLR 2.0.50727)


Timestamp: Sat, 11 Jul 2009 17:41:15 UTC








Message: 'tinymce' is undefined


Line: 1


Char: 1


Code: 0


URI: http://www.mysite/dev/deh/index.php?r=jobs/create








Message: 'tinymce' is undefined


Line: 1


Char: 1


Code: 0


URI: http://www.mysite/dev/deh/index.php?r=jobs/create








Message: 'tinymce' is undefined


Line: 1


Char: 13


Code: 0


URI: http://www.mysite/dev/deh/assets/b46b71a9/themes/advanced/editor_template.js








Message: 'tinymce' is undefined


Line: 1


Char: 1


Code: 0


URI: http://www.mysite/dev/deh/index.php?r=jobs/create


Are you using gzip compression in your server for  text/javascript MIME type files?

Yes, but I turned it off and same problem. 

Would you be so kind to provide a demo? Thanks.

Thanks, greatly appreciated!

Let me suggest you to add a demo link to your extension resources, others my also find this useful.

I thought you were asking for a link to see the problem.  I think you just wanted to see the extension working and your email is directed to MetaYii?

R

Yes, that was the case. :) Sorry for not checking the author.

When using IE, turning gzip off is not enough since it aggressively caches everything compressed. I recommend you to empty your local cache once compression is disabled, then try again.

I turned of gzip, checked the headers to make sure there was no compression happening, but the same problem in IE. 

This seems to be a very common problem with IE and tinyMCE.  :-(.