views:

193

answers:

2

Hi there,

It's me again, the one who doesn't want to use a plugin, but write my own or use some lines from other plugins ;-).

I want to write a simple RTE with the functions bold, italic, list, emoticons and blockquote. I found this simple lightweight plugin http://batiste.dosimple.ch/blog/posts/2007-09-11-1/rich-text-editor-jquery.html and it is very simple and very small.

I already added a emoticon pallet that loads emoticons from a defined folder. But now I want to add a blockquote function, but I can't find out how to do that. I read a few things on the internet that it isn't in the default functions of IE/FF, but I saw a few RTE's that had the blockquote function.

The plugin uses this for bold

$('.bold', tb).click(function(){ formatText(iframe, 'bold');return false; });

Altering 'bold' into 'blockquote' won't help (maybe thought to simple ;-))

Is there anyone who can help me with this?

Tnx in advance

Grtzzz

Wim

edit:

Ok, I tried this

$('.bold', tb).click(function(){ formatText(iframe, 'formatblock', '<blockquote>');return false; });
But this only works with FF, and not with IE, damn :(

A: 

Other RTE's probably use custom css in spans. TinyMCE for example, I'm pretty sure it uses that.

yoda
tnx for your reaction, but I saw that fckeditor uses the tag blockquote, so it should be possible, at least, that is what I think
Megapool020
you can use it, but is there a real gain on using it? styles are commonly more reliable.
yoda
wel, I can do it with styles, but I'm curious on how to do that with the tags in stead of the styles
Megapool020
try using firefox addon firebug, and "listen" the actions of the RTE you mentioned. Then browsing the code and finding the guilty.
yoda
A: 

OK,

It costed me some time, but I think I have the solution (it works fine for me).

I found out that FF and IE respond different if you want to add a "blockquote", so if used the following code

$('.quote', tb).click(function(){
 if($.browser.msie){
  formatText(iframe,'indent');
 }else if($.browser.mozilla){
  formatText(iframe, "formatblock", '<blockquote>'); 
 }
 return false; 
});

The indent in IE gives a blockquote as output (IE7 and IE8).

If there is someone who has a better solution, then I'd like to here it, but for now I can work with this.

Grtzzzz

Wim

Megapool020