Extension howto for TinyMCE

Despite I have very little time to play with Yii  :cry: … I'd like to learn how to write a Yii widget and extension, and since I would need a WYSIWYG editor, I'd like to write a TinyMCE extension/widget. But I'd like to have some guidelines:

  • Where to place the javascript files? (TinyMCE has tons of them, I guess they would be used as assets...)
  • TinyMCE uses several HTML pages and PHP scripts for certain tasks and pop-up forms (spellchecker comes to my mind)... what should I do with them?
  • Which prefix should I use, if I wanted to submit it to Qiang for consideration and possible inclusion into Yii's extension repo? [tt]ETinyMceWidget[/tt] perhaps?
  • Should I follow Qiang's syntax style? :D

It would be useful to start an official “Extension how-to”, so developers have guidelines… or has this already being started? The compression format and metadata format has been discussed elsewhere, at least.

Thanks :)

My thoughts.

I placed my extraneous files in a folder under where the widget is stored and I publish them in the init  of the widget eg.

$this->assets = Yii::app()->assetManager->publish(dirname(FILE).'/tinymce');

Then register them during the "run" process

You should also have an "Action" class to handle the callbacks (most pluggables allow you to configure the callback url) Examine CCaptchaAction to see how that works.

As long as the code is legible I would not care to much about style…

nz

P.s.

Why are you set on TinyMCE ? There are quite a few pluggables for jquery like http://www.wymeditor.org/ or http://code.google.com/p/jwysiwyg/

Thanks nz

Quote

Why are you set on TinyMCE ? There are quite a few pluggables for jquery like http://www.wymeditor.org/ or http://code.google.com/p/jwysiwyg/

Being lazy here: I already have some custom TinyMCE plugins (for WebEq, file management and so on) in Prado 2, and I would like to use them in Yii with as few modification as possible. But I'll take a look to the other editors you're pointing to. Thanks :slight_smile:

BTW, and this is off topic, but having a WYSIWYG can be a real pain in the *ss, even more when ppl start copypasting from M$-Word and want to see the text exactly as in that wp  >:(

thats why the FCK editor has a “clean word crap” button  ;D

Quote

thats why the FCK editor has a "clean word crap" button  ;D

LOL yeah, even TinyMCE has one, and I even use PHP's tidy extension, and HTML Purifier… then the luser comes and yells: "but this is not what I pasted!" sigh

look at xstandard …

unfortunately this is a plugin (commercial) but it might be an option for your project?

Thank you remco, I didn't know that one, will give it a try…

http://dev.jquery.co…Plugins/tinyMCE