Question

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 :(

Was it helpful?

Solution 2

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

OTHER TIPS

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

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top